Merge "ASoC: msm: add machine driver for kona"
diff --git a/asoc/codecs/aqt1000/aqt1000-api.h b/asoc/codecs/aqt1000/aqt1000-api.h
index ef2e526..fc5d23a 100644
--- a/asoc/codecs/aqt1000/aqt1000-api.h
+++ b/asoc/codecs/aqt1000/aqt1000-api.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef AQT1000_API_H
@@ -18,11 +10,12 @@
#include <linux/of_device.h>
#include <sound/soc.h>
-extern int aqt_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
+extern int aqt_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int volt, int micb_num);
-extern int aqt_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable);
+extern int aqt_cdc_mclk_enable(struct snd_soc_component *component,
+ bool enable);
extern int aqt_get_micb_vout_ctl_val(u32 micb_mv);
-extern int aqt_micbias_control(struct snd_soc_codec *codec, int micb_num,
- int req, bool is_dapm);
+extern int aqt_micbias_control(struct snd_soc_component *component,
+ int micb_num, int req, bool is_dapm);
#endif /* AQT1000_API_H */
diff --git a/asoc/codecs/aqt1000/aqt1000-clsh.c b/asoc/codecs/aqt1000/aqt1000-clsh.c
index 640795d..218425b 100644
--- a/asoc/codecs/aqt1000/aqt1000-clsh.c
+++ b/asoc/codecs/aqt1000/aqt1000-clsh.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -144,7 +136,7 @@
{13, 9},
};
-static void (*clsh_state_fp[NUM_CLSH_STATES])(struct snd_soc_codec *,
+static void (*clsh_state_fp[NUM_CLSH_STATES])(struct snd_soc_component *,
struct aqt_clsh_cdc_data *,
u8 req_state, bool en, int mode);
@@ -177,12 +169,13 @@
/*
* Function: aqt_clsh_imped_config
- * Params: codec, imped, reset
+ * Params: component, imped, reset
* Description:
* This function updates HPHL and HPHR gain settings
* according to the impedance value.
*/
-void aqt_clsh_imped_config(struct snd_soc_codec *codec, int imped, bool reset)
+void aqt_clsh_imped_config(struct snd_soc_component *component,
+ int imped, bool reset)
{
int i;
int index = 0;
@@ -197,7 +190,7 @@
/* reset = 1, which means request is to reset the register values */
if (reset) {
for (i = 0; i < MAX_IMPED_PARAMS; i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
imped_table_ptr[index][i].reg,
imped_table_ptr[index][i].mask, 0);
return;
@@ -213,7 +206,7 @@
return;
}
for (i = 0; i < MAX_IMPED_PARAMS; i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
imped_table_ptr[index][i].reg,
imped_table_ptr[index][i].mask,
imped_table_ptr[index][i].val);
@@ -250,22 +243,23 @@
};
static inline void
-aqt_enable_clsh_block(struct snd_soc_codec *codec,
+aqt_enable_clsh_block(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *clsh_d, bool enable)
{
if ((enable && ++clsh_d->clsh_users == 1) ||
(!enable && --clsh_d->clsh_users == 0))
- snd_soc_update_bits(codec, AQT1000_CDC_CLSH_CRC, 0x01,
- (u8) enable);
+ snd_soc_component_update_bits(component, AQT1000_CDC_CLSH_CRC,
+ 0x01, (u8) enable);
if (clsh_d->clsh_users < 0)
clsh_d->clsh_users = 0;
- dev_dbg(codec->dev, "%s: clsh_users %d, enable %d", __func__,
+ dev_dbg(component->dev, "%s: clsh_users %d, enable %d", __func__,
clsh_d->clsh_users, enable);
}
-static inline bool aqt_clsh_enable_status(struct snd_soc_codec *codec)
+static inline bool aqt_clsh_enable_status(struct snd_soc_component *component)
{
- return snd_soc_read(codec, AQT1000_CDC_CLSH_CRC) & 0x01;
+ return snd_soc_component_read32(
+ component, AQT1000_CDC_CLSH_CRC) & 0x01;
}
static inline int aqt_clsh_get_int_mode(struct aqt_clsh_cdc_data *clsh_d,
@@ -292,87 +286,106 @@
clsh_d->interpolator_modes[ffs(clsh_state)] = mode;
}
-static inline void aqt_clsh_set_buck_mode(struct snd_soc_codec *codec,
+static inline void aqt_clsh_set_buck_mode(struct snd_soc_component *component,
int mode)
{
if (mode == CLS_H_HIFI || mode == CLS_H_LOHIFI ||
mode == CLS_AB_HIFI || mode == CLS_AB)
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
- 0x08, 0x08); /* set to HIFI */
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_RX_SUPPLIES,
+ 0x08, 0x08); /* set to HIFI */
else
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
- 0x08, 0x00); /* set to default */
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_RX_SUPPLIES,
+ 0x08, 0x00); /* set to default */
}
-static inline void aqt_clsh_set_flyback_mode(struct snd_soc_codec *codec,
- int mode)
+static inline void aqt_clsh_set_flyback_mode(
+ struct snd_soc_component *component, int mode)
{
if (mode == CLS_H_HIFI || mode == CLS_H_LOHIFI ||
mode == CLS_AB_HIFI || mode == CLS_AB)
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
- 0x04, 0x04); /* set to HIFI */
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_RX_SUPPLIES,
+ 0x04, 0x04); /* set to HIFI */
else
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
- 0x04, 0x00); /* set to Default */
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_RX_SUPPLIES,
+ 0x04, 0x00); /* set to Default */
}
-static inline void aqt_clsh_gm3_boost_disable(struct snd_soc_codec *codec,
- int mode)
+static inline void aqt_clsh_gm3_boost_disable(
+ struct snd_soc_component *component, int mode)
{
if (mode == CLS_H_HIFI || mode == CLS_H_LOHIFI ||
mode == CLS_AB_HIFI || mode == CLS_AB) {
- snd_soc_update_bits(codec, AQT1000_HPH_CNP_WG_CTL,
- 0x80, 0x0); /* disable GM3 Boost */
- snd_soc_update_bits(codec, AQT1000_FLYBACK_VNEG_CTRL_4,
- 0xF0, 0x80);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_CNP_WG_CTL,
+ 0x80, 0x0); /* disable GM3 Boost */
+ snd_soc_component_update_bits(component,
+ AQT1000_FLYBACK_VNEG_CTRL_4,
+ 0xF0, 0x80);
} else {
- snd_soc_update_bits(codec, AQT1000_HPH_CNP_WG_CTL,
- 0x80, 0x80); /* set to Default */
- snd_soc_update_bits(codec, AQT1000_FLYBACK_VNEG_CTRL_4,
- 0xF0, 0x70);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_CNP_WG_CTL,
+ 0x80, 0x80); /* set to Default */
+ snd_soc_component_update_bits(component,
+ AQT1000_FLYBACK_VNEG_CTRL_4,
+ 0xF0, 0x70);
}
}
-static inline void aqt_clsh_flyback_dac_ctl(struct snd_soc_codec *codec,
- int vref)
+static inline void aqt_clsh_flyback_dac_ctl(
+ struct snd_soc_component *component, int vref)
{
- snd_soc_update_bits(codec, AQT1000_FLYBACK_VNEGDAC_CTRL_2,
- 0xE0, (vref << 5));
+ snd_soc_component_update_bits(component,
+ AQT1000_FLYBACK_VNEGDAC_CTRL_2,
+ 0xE0, (vref << 5));
}
-static inline void aqt_clsh_mode_vref_ctl(struct snd_soc_codec *codec,
- int vref_ctl)
+static inline void aqt_clsh_mode_vref_ctl(struct snd_soc_component *component,
+ int vref_ctl)
{
if (vref_ctl == I2C) {
- snd_soc_update_bits(codec, AQT1000_CLASSH_MODE_3, 0x02, 0x02);
- snd_soc_update_bits(codec, AQT1000_CLASSH_MODE_2, 0xFF, 0x1C);
+ snd_soc_component_update_bits(component, AQT1000_CLASSH_MODE_3,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, AQT1000_CLASSH_MODE_2,
+ 0xFF, 0x1C);
} else {
- snd_soc_update_bits(codec, AQT1000_CLASSH_MODE_2, 0xFF, 0x3A);
- snd_soc_update_bits(codec, AQT1000_CLASSH_MODE_3, 0x02, 0x00);
+ snd_soc_component_update_bits(component, AQT1000_CLASSH_MODE_2,
+ 0xFF, 0x3A);
+ snd_soc_component_update_bits(component, AQT1000_CLASSH_MODE_3,
+ 0x02, 0x00);
}
}
-static inline void aqt_clsh_buck_current_bias_ctl(struct snd_soc_codec *codec,
- bool enable)
+static inline void aqt_clsh_buck_current_bias_ctl(
+ struct snd_soc_component *component, bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, AQT1000_BUCK_5V_IBIAS_CTL_4,
- 0x70, (I_2UA << 4));
- snd_soc_update_bits(codec, AQT1000_BUCK_5V_IBIAS_CTL_4,
- 0x07, I_0P25UA);
- snd_soc_update_bits(codec, AQT1000_BUCK_5V_CTRL_CCL_2,
- 0x3F, 0x3F);
+ snd_soc_component_update_bits(component,
+ AQT1000_BUCK_5V_IBIAS_CTL_4,
+ 0x70, (I_2UA << 4));
+ snd_soc_component_update_bits(component,
+ AQT1000_BUCK_5V_IBIAS_CTL_4,
+ 0x07, I_0P25UA);
+ snd_soc_component_update_bits(component,
+ AQT1000_BUCK_5V_CTRL_CCL_2,
+ 0x3F, 0x3F);
} else {
- snd_soc_update_bits(codec, AQT1000_BUCK_5V_IBIAS_CTL_4,
- 0x70, (I_1UA << 4));
- snd_soc_update_bits(codec, AQT1000_BUCK_5V_IBIAS_CTL_4,
- 0x07, I_1UA);
- snd_soc_update_bits(codec, AQT1000_BUCK_5V_CTRL_CCL_2,
- 0x3F, 0x20);
+ snd_soc_component_update_bits(component,
+ AQT1000_BUCK_5V_IBIAS_CTL_4,
+ 0x70, (I_1UA << 4));
+ snd_soc_component_update_bits(component,
+ AQT1000_BUCK_5V_IBIAS_CTL_4,
+ 0x07, I_1UA);
+ snd_soc_component_update_bits(component,
+ AQT1000_BUCK_5V_CTRL_CCL_2,
+ 0x3F, 0x20);
}
}
-static inline void aqt_clsh_rdac_hd2_ctl(struct snd_soc_codec *codec,
+static inline void aqt_clsh_rdac_hd2_ctl(struct snd_soc_component *component,
u8 hd2_div_ctl, u8 state)
{
u16 reg = 0;
@@ -382,34 +395,41 @@
else if (state == AQT_CLSH_STATE_HPHR)
reg = AQT1000_HPH_NEW_INT_RDAC_HD2_CTL_R;
else
- dev_err(codec->dev, "%s: Invalid state: %d\n",
+ dev_err(component->dev, "%s: Invalid state: %d\n",
__func__, state);
if (!reg)
- snd_soc_update_bits(codec, reg, 0x0F, hd2_div_ctl);
+ snd_soc_component_update_bits(component, reg,
+ 0x0F, hd2_div_ctl);
}
-static inline void aqt_clsh_force_iq_ctl(struct snd_soc_codec *codec,
+static inline void aqt_clsh_force_iq_ctl(struct snd_soc_component *component,
int mode)
{
if (mode == CLS_H_LOHIFI || mode == CLS_AB) {
- snd_soc_update_bits(codec, AQT1000_HPH_NEW_INT_PA_MISC2,
- 0x20, 0x20);
- snd_soc_update_bits(codec, AQT1000_RX_BIAS_HPH_LOWPOWER,
- 0xF0, 0xC0);
- snd_soc_update_bits(codec, AQT1000_HPH_PA_CTL1,
- 0x0E, 0x02);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_NEW_INT_PA_MISC2,
+ 0x20, 0x20);
+ snd_soc_component_update_bits(component,
+ AQT1000_RX_BIAS_HPH_LOWPOWER,
+ 0xF0, 0xC0);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_PA_CTL1,
+ 0x0E, 0x02);
} else {
- snd_soc_update_bits(codec, AQT1000_HPH_NEW_INT_PA_MISC2,
- 0x20, 0x0);
- snd_soc_update_bits(codec, AQT1000_RX_BIAS_HPH_LOWPOWER,
- 0xF0, 0x80);
- snd_soc_update_bits(codec, AQT1000_HPH_PA_CTL1,
- 0x0E, 0x06);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_NEW_INT_PA_MISC2,
+ 0x20, 0x0);
+ snd_soc_component_update_bits(component,
+ AQT1000_RX_BIAS_HPH_LOWPOWER,
+ 0xF0, 0x80);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_PA_CTL1,
+ 0x0E, 0x06);
}
}
-static void aqt_clsh_buck_ctrl(struct snd_soc_codec *codec,
+static void aqt_clsh_buck_ctrl(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *clsh_d,
int mode,
bool enable)
@@ -417,9 +437,10 @@
/* enable/disable buck */
if ((enable && (++clsh_d->buck_users == 1)) ||
(!enable && (--clsh_d->buck_users == 0)))
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
- (1 << 7), (enable << 7));
- dev_dbg(codec->dev, "%s: buck_users %d, enable %d, mode: %s",
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_RX_SUPPLIES,
+ (1 << 7), (enable << 7));
+ dev_dbg(component->dev, "%s: buck_users %d, enable %d, mode: %s",
__func__, clsh_d->buck_users, enable, mode_to_str(mode));
/*
* 500us sleep is required after buck enable/disable
@@ -428,7 +449,7 @@
usleep_range(500, 500 + AQT_USLEEP_RANGE);
}
-static void aqt_clsh_flyback_ctrl(struct snd_soc_codec *codec,
+static void aqt_clsh_flyback_ctrl(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *clsh_d,
int mode,
bool enable)
@@ -436,12 +457,13 @@
/* enable/disable flyback */
if ((enable && (++clsh_d->flyback_users == 1)) ||
(!enable && (--clsh_d->flyback_users == 0))) {
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
- (1 << 6), (enable << 6));
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_RX_SUPPLIES,
+ (1 << 6), (enable << 6));
/* 100usec delay is needed as per HW requirement */
usleep_range(100, 110);
}
- dev_dbg(codec->dev, "%s: flyback_users %d, enable %d, mode: %s",
+ dev_dbg(component->dev, "%s: flyback_users %d, enable %d, mode: %s",
__func__, clsh_d->flyback_users, enable, mode_to_str(mode));
/*
* 500us sleep is required after flyback enable/disable
@@ -450,7 +472,7 @@
usleep_range(500, 500 + AQT_USLEEP_RANGE);
}
-static void aqt_clsh_set_hph_mode(struct snd_soc_codec *codec,
+static void aqt_clsh_set_hph_mode(struct snd_soc_component *component,
int mode)
{
u8 val = 0;
@@ -495,21 +517,22 @@
if (mode == CLS_H_LOHIFI || mode == CLS_AB)
val = 0x04;
- snd_soc_update_bits(codec, AQT1000_ANA_HPH, 0x0C, val);
+ snd_soc_component_update_bits(component, AQT1000_ANA_HPH, 0x0C, val);
}
-static void aqt_clsh_set_buck_regulator_mode(struct snd_soc_codec *codec,
- int mode)
+static void aqt_clsh_set_buck_regulator_mode(
+ struct snd_soc_component *component, int mode)
{
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
+ snd_soc_component_update_bits(component, AQT1000_ANA_RX_SUPPLIES,
0x02, 0x00);
}
-static void aqt_clsh_state_hph_st(struct snd_soc_codec *codec,
+static void aqt_clsh_state_hph_st(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (mode == CLS_AB || mode == CLS_AB_HIFI)
@@ -517,158 +540,163 @@
if (is_enable) {
if (req_state == AQT_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX1_RX_PATH_CFG0,
0x40, 0x40);
if (req_state == AQT_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX2_RX_PATH_CFG0,
0x40, 0x40);
} else {
if (req_state == AQT_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX1_RX_PATH_CFG0,
0x40, 0x00);
if (req_state == AQT_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX2_RX_PATH_CFG0,
0x40, 0x00);
}
}
-static void aqt_clsh_state_hph_r(struct snd_soc_codec *codec,
+static void aqt_clsh_state_hph_r(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (mode == CLS_H_NORMAL) {
- dev_err(codec->dev, "%s: Normal mode not applicable for hph_r\n",
+ dev_err(component->dev, "%s: Normal mode not applicable for hph_r\n",
__func__);
return;
}
if (is_enable) {
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- aqt_enable_clsh_block(codec, clsh_d, true);
+ aqt_enable_clsh_block(component, clsh_d, true);
/*
* These K1 values depend on the Headphone Impedance
* For now it is assumed to be 16 ohm
*/
- snd_soc_update_bits(codec, AQT1000_CDC_CLSH_K1_MSB,
- 0x0F, 0x00);
- snd_soc_update_bits(codec, AQT1000_CDC_CLSH_K1_LSB,
- 0xFF, 0xC0);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_CLSH_K1_MSB,
+ 0x0F, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_CLSH_K1_LSB,
+ 0xFF, 0xC0);
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX2_RX_PATH_CFG0,
0x40, 0x40);
}
- aqt_clsh_set_buck_regulator_mode(codec, mode);
- aqt_clsh_set_flyback_mode(codec, mode);
- aqt_clsh_gm3_boost_disable(codec, mode);
- aqt_clsh_flyback_dac_ctl(codec, VREF_N0P9V);
- aqt_clsh_mode_vref_ctl(codec, I2C);
- aqt_clsh_force_iq_ctl(codec, mode);
- aqt_clsh_rdac_hd2_ctl(codec, P82_0P77, req_state);
- aqt_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- aqt_clsh_flyback_dac_ctl(codec, VREF_N1P827V);
- aqt_clsh_set_buck_mode(codec, mode);
- aqt_clsh_buck_ctrl(codec, clsh_d, mode, true);
- aqt_clsh_mode_vref_ctl(codec, CONTROLLER);
- aqt_clsh_buck_current_bias_ctl(codec, true);
- aqt_clsh_set_hph_mode(codec, mode);
+ aqt_clsh_set_buck_regulator_mode(component, mode);
+ aqt_clsh_set_flyback_mode(component, mode);
+ aqt_clsh_gm3_boost_disable(component, mode);
+ aqt_clsh_flyback_dac_ctl(component, VREF_N0P9V);
+ aqt_clsh_mode_vref_ctl(component, I2C);
+ aqt_clsh_force_iq_ctl(component, mode);
+ aqt_clsh_rdac_hd2_ctl(component, P82_0P77, req_state);
+ aqt_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ aqt_clsh_flyback_dac_ctl(component, VREF_N1P827V);
+ aqt_clsh_set_buck_mode(component, mode);
+ aqt_clsh_buck_ctrl(component, clsh_d, mode, true);
+ aqt_clsh_mode_vref_ctl(component, CONTROLLER);
+ aqt_clsh_buck_current_bias_ctl(component, true);
+ aqt_clsh_set_hph_mode(component, mode);
} else {
- aqt_clsh_set_hph_mode(codec, CLS_H_NORMAL);
- aqt_clsh_buck_current_bias_ctl(codec, false);
+ aqt_clsh_set_hph_mode(component, CLS_H_NORMAL);
+ aqt_clsh_buck_current_bias_ctl(component, false);
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX2_RX_PATH_CFG0,
0x40, 0x00);
- aqt_enable_clsh_block(codec, clsh_d, false);
+ aqt_enable_clsh_block(component, clsh_d, false);
}
/* buck and flyback set to default mode and disable */
- aqt_clsh_buck_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- aqt_clsh_flyback_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- aqt_clsh_rdac_hd2_ctl(codec, P5_0P35, req_state);
- aqt_clsh_force_iq_ctl(codec, CLS_H_NORMAL);
- aqt_clsh_gm3_boost_disable(codec, CLS_H_NORMAL);
- aqt_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- aqt_clsh_set_buck_mode(codec, CLS_H_NORMAL);
- aqt_clsh_set_buck_regulator_mode(codec, CLS_H_NORMAL);
+ aqt_clsh_buck_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ aqt_clsh_flyback_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ aqt_clsh_rdac_hd2_ctl(component, P5_0P35, req_state);
+ aqt_clsh_force_iq_ctl(component, CLS_H_NORMAL);
+ aqt_clsh_gm3_boost_disable(component, CLS_H_NORMAL);
+ aqt_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ aqt_clsh_set_buck_mode(component, CLS_H_NORMAL);
+ aqt_clsh_set_buck_regulator_mode(component, CLS_H_NORMAL);
}
}
-static void aqt_clsh_state_hph_l(struct snd_soc_codec *codec,
+static void aqt_clsh_state_hph_l(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
- is_enable ? "enable" : "disable");
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode), is_enable ? "enable" : "disable");
if (mode == CLS_H_NORMAL) {
- dev_err(codec->dev, "%s: Normal mode not applicable for hph_l\n",
+ dev_err(component->dev, "%s: Normal mode not applicable for hph_l\n",
__func__);
return;
}
if (is_enable) {
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- aqt_enable_clsh_block(codec, clsh_d, true);
+ aqt_enable_clsh_block(component, clsh_d, true);
/*
* These K1 values depend on the Headphone Impedance
* For now it is assumed to be 16 ohm
*/
- snd_soc_update_bits(codec, AQT1000_CDC_CLSH_K1_MSB,
- 0x0F, 0x00);
- snd_soc_update_bits(codec, AQT1000_CDC_CLSH_K1_LSB,
- 0xFF, 0xC0);
- snd_soc_update_bits(codec,
- AQT1000_CDC_RX1_RX_PATH_CFG0,
- 0x40, 0x40);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_CLSH_K1_MSB,
+ 0x0F, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_CLSH_K1_LSB,
+ 0xFF, 0xC0);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX1_RX_PATH_CFG0,
+ 0x40, 0x40);
}
- aqt_clsh_set_buck_regulator_mode(codec, mode);
- aqt_clsh_set_flyback_mode(codec, mode);
- aqt_clsh_gm3_boost_disable(codec, mode);
- aqt_clsh_flyback_dac_ctl(codec, VREF_N0P9V);
- aqt_clsh_mode_vref_ctl(codec, I2C);
- aqt_clsh_force_iq_ctl(codec, mode);
- aqt_clsh_rdac_hd2_ctl(codec, P82_0P77, req_state);
- aqt_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- aqt_clsh_flyback_dac_ctl(codec, VREF_N1P827V);
- aqt_clsh_set_buck_mode(codec, mode);
- aqt_clsh_buck_ctrl(codec, clsh_d, mode, true);
- aqt_clsh_mode_vref_ctl(codec, CONTROLLER);
- aqt_clsh_buck_current_bias_ctl(codec, true);
- aqt_clsh_set_hph_mode(codec, mode);
+ aqt_clsh_set_buck_regulator_mode(component, mode);
+ aqt_clsh_set_flyback_mode(component, mode);
+ aqt_clsh_gm3_boost_disable(component, mode);
+ aqt_clsh_flyback_dac_ctl(component, VREF_N0P9V);
+ aqt_clsh_mode_vref_ctl(component, I2C);
+ aqt_clsh_force_iq_ctl(component, mode);
+ aqt_clsh_rdac_hd2_ctl(component, P82_0P77, req_state);
+ aqt_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ aqt_clsh_flyback_dac_ctl(component, VREF_N1P827V);
+ aqt_clsh_set_buck_mode(component, mode);
+ aqt_clsh_buck_ctrl(component, clsh_d, mode, true);
+ aqt_clsh_mode_vref_ctl(component, CONTROLLER);
+ aqt_clsh_buck_current_bias_ctl(component, true);
+ aqt_clsh_set_hph_mode(component, mode);
} else {
- aqt_clsh_set_hph_mode(codec, CLS_H_NORMAL);
- aqt_clsh_buck_current_bias_ctl(codec, false);
+ aqt_clsh_set_hph_mode(component, CLS_H_NORMAL);
+ aqt_clsh_buck_current_bias_ctl(component, false);
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX1_RX_PATH_CFG0,
0x40, 0x00);
- aqt_enable_clsh_block(codec, clsh_d, false);
+ aqt_enable_clsh_block(component, clsh_d, false);
}
/* set buck and flyback to Default Mode */
- aqt_clsh_buck_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- aqt_clsh_flyback_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- aqt_clsh_rdac_hd2_ctl(codec, P5_0P35, req_state);
- aqt_clsh_force_iq_ctl(codec, CLS_H_NORMAL);
- aqt_clsh_gm3_boost_disable(codec, CLS_H_NORMAL);
- aqt_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- aqt_clsh_set_buck_mode(codec, CLS_H_NORMAL);
- aqt_clsh_set_buck_regulator_mode(codec, CLS_H_NORMAL);
+ aqt_clsh_buck_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ aqt_clsh_flyback_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ aqt_clsh_rdac_hd2_ctl(component, P5_0P35, req_state);
+ aqt_clsh_force_iq_ctl(component, CLS_H_NORMAL);
+ aqt_clsh_gm3_boost_disable(component, CLS_H_NORMAL);
+ aqt_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ aqt_clsh_set_buck_mode(component, CLS_H_NORMAL);
+ aqt_clsh_set_buck_regulator_mode(component, CLS_H_NORMAL);
}
}
-static void aqt_clsh_state_err(struct snd_soc_codec *codec,
+static void aqt_clsh_state_err(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s Wrong request for class H state machine requested to %s %s",
__func__, is_enable ? "enable" : "disable",
state_to_str[req_state]);
@@ -695,14 +723,14 @@
/*
* Function: aqt_clsh_fsm
- * Params: codec, cdc_clsh_d, req_state, req_type, clsh_event
+ * Params: component, cdc_clsh_d, req_state, req_type, clsh_event
* Description:
* This function handles PRE DAC and POST DAC conditions of different devices
* and updates class H configuration of different combination of devices
* based on validity of their states. cdc_clsh_d will contain current
* class h state information
*/
-void aqt_clsh_fsm(struct snd_soc_codec *codec,
+void aqt_clsh_fsm(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *cdc_clsh_d,
u8 clsh_event, u8 req_state,
int int_mode)
@@ -715,22 +743,22 @@
new_state = old_state | req_state;
if (!aqt_clsh_is_state_valid(new_state)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H not a valid new state: %s\n",
__func__, state_to_str[new_state]);
return;
}
if (new_state == old_state) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H already in requested state: %s\n",
__func__, state_to_str[new_state]);
return;
}
cdc_clsh_d->state = new_state;
aqt_clsh_set_int_mode(cdc_clsh_d, req_state, int_mode);
- (*clsh_state_fp[new_state]) (codec, cdc_clsh_d, req_state,
+ (*clsh_state_fp[new_state]) (component, cdc_clsh_d, req_state,
CLSH_REQ_ENABLE, int_mode);
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: ClassH state transition from %s to %s\n",
__func__, state_to_str[old_state],
state_to_str[cdc_clsh_d->state]);
@@ -740,23 +768,23 @@
new_state = old_state & (~req_state);
if (new_state < NUM_CLSH_STATES) {
if (!aqt_clsh_is_state_valid(old_state)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s:Invalid old state:%s\n",
__func__, state_to_str[old_state]);
return;
}
if (new_state == old_state) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H already in requested state: %s\n",
__func__,state_to_str[new_state]);
return;
}
- (*clsh_state_fp[old_state]) (codec, cdc_clsh_d,
+ (*clsh_state_fp[old_state]) (component, cdc_clsh_d,
req_state, CLSH_REQ_DISABLE,
int_mode);
cdc_clsh_d->state = new_state;
aqt_clsh_set_int_mode(cdc_clsh_d, req_state, CLS_NONE);
- dev_dbg(codec->dev, "%s: ClassH state transition from %s to %s\n",
+ dev_dbg(component->dev, "%s: ClassH state transition from %s to %s\n",
__func__, state_to_str[old_state],
state_to_str[cdc_clsh_d->state]);
}
diff --git a/asoc/codecs/aqt1000/aqt1000-clsh.h b/asoc/codecs/aqt1000/aqt1000-clsh.h
index 4a829b0..7079450 100644
--- a/asoc/codecs/aqt1000/aqt1000-clsh.h
+++ b/asoc/codecs/aqt1000/aqt1000-clsh.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _AQT1000_CLSH_H
@@ -102,14 +94,14 @@
u8 val;
};
-extern void aqt_clsh_fsm(struct snd_soc_codec *codec,
+extern void aqt_clsh_fsm(struct snd_soc_component *component,
struct aqt_clsh_cdc_data *cdc_clsh_d,
u8 clsh_event, u8 req_state,
int int_mode);
extern void aqt_clsh_init(struct aqt_clsh_cdc_data *clsh);
extern int aqt_clsh_get_clsh_state(struct aqt_clsh_cdc_data *clsh);
-extern void aqt_clsh_imped_config(struct snd_soc_codec *codec, int imped,
- bool reset);
+extern void aqt_clsh_imped_config(struct snd_soc_component *component,
+ int imped, bool reset);
#endif /* _AQT1000_CLSH_H */
diff --git a/asoc/codecs/aqt1000/aqt1000-core.c b/asoc/codecs/aqt1000/aqt1000-core.c
index e6313c1..e643b6a 100644
--- a/asoc/codecs/aqt1000/aqt1000-core.c
+++ b/asoc/codecs/aqt1000/aqt1000-core.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/asoc/codecs/aqt1000/aqt1000-internal.h b/asoc/codecs/aqt1000/aqt1000-internal.h
index 19b4b57..abfae1b 100644
--- a/asoc/codecs/aqt1000/aqt1000-internal.h
+++ b/asoc/codecs/aqt1000/aqt1000-internal.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _AQT1000_INTERNAL_H
diff --git a/asoc/codecs/aqt1000/aqt1000-irq.c b/asoc/codecs/aqt1000/aqt1000-irq.c
index 321b490..5f71573 100644
--- a/asoc/codecs/aqt1000/aqt1000-irq.c
+++ b/asoc/codecs/aqt1000/aqt1000-irq.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
@@ -162,6 +154,7 @@
};
static struct lock_class_key aqt_irq_lock_class;
+static struct lock_class_key aqt_irq_lock_requested_class;
static int aqt_irq_map(struct irq_domain *irqd, unsigned int virq,
irq_hw_number_t hw)
@@ -170,7 +163,8 @@
irq_set_chip_data(virq, data);
irq_set_chip_and_handler(virq, &aqt_irq_chip, handle_simple_irq);
- irq_set_lockdep_class(virq, &aqt_irq_lock_class);
+ irq_set_lockdep_class(virq, &aqt_irq_lock_class,
+ &aqt_irq_lock_requested_class);
irq_set_nested_thread(virq, 1);
irq_set_noprobe(virq);
diff --git a/asoc/codecs/aqt1000/aqt1000-irq.h b/asoc/codecs/aqt1000/aqt1000-irq.h
index 60be49c..cd1a95f 100644
--- a/asoc/codecs/aqt1000/aqt1000-irq.h
+++ b/asoc/codecs/aqt1000/aqt1000-irq.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __AQT1000_IRQ_H_
diff --git a/asoc/codecs/aqt1000/aqt1000-mbhc.c b/asoc/codecs/aqt1000/aqt1000-mbhc.c
index 24f14a4..4146c6b 100644
--- a/asoc/codecs/aqt1000/aqt1000-mbhc.c
+++ b/asoc/codecs/aqt1000/aqt1000-mbhc.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -161,19 +153,19 @@
u16 btn7;
};
-static int aqt_mbhc_request_irq(struct snd_soc_codec *codec,
+static int aqt_mbhc_request_irq(struct snd_soc_component *component,
int irq, irq_handler_t handler,
const char *name, void *data)
{
- struct aqt1000 *aqt = dev_get_drvdata(codec->dev);
+ struct aqt1000 *aqt = dev_get_drvdata(component->dev);
return aqt_request_irq(aqt, irq, name, handler, data);
}
-static void aqt_mbhc_irq_control(struct snd_soc_codec *codec,
+static void aqt_mbhc_irq_control(struct snd_soc_component *component,
int irq, bool enable)
{
- struct aqt1000 *aqt = dev_get_drvdata(codec->dev);
+ struct aqt1000 *aqt = dev_get_drvdata(component->dev);
if (enable)
aqt_enable_irq(aqt, irq);
@@ -181,44 +173,49 @@
aqt_disable_irq(aqt, irq);
}
-static int aqt_mbhc_free_irq(struct snd_soc_codec *codec,
+static int aqt_mbhc_free_irq(struct snd_soc_component *component,
int irq, void *data)
{
- struct aqt1000 *aqt = dev_get_drvdata(codec->dev);
+ struct aqt1000 *aqt = dev_get_drvdata(component->dev);
aqt_free_irq(aqt, irq, data);
return 0;
}
-static void aqt_mbhc_clk_setup(struct snd_soc_codec *codec,
+static void aqt_mbhc_clk_setup(struct snd_soc_component *component,
bool enable)
{
if (enable)
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_CTL_1,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ AQT1000_MBHC_NEW_CTL_1,
+ 0x80, 0x80);
else
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_CTL_1,
- 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_MBHC_NEW_CTL_1,
+ 0x80, 0x00);
}
-static int aqt_mbhc_btn_to_num(struct snd_soc_codec *codec)
+static int aqt_mbhc_btn_to_num(struct snd_soc_component *component)
{
- return snd_soc_read(codec, AQT1000_ANA_MBHC_RESULT_3) & 0x7;
+ return snd_soc_component_read32(component,
+ AQT1000_ANA_MBHC_RESULT_3) & 0x7;
}
-static void aqt_mbhc_mbhc_bias_control(struct snd_soc_codec *codec,
+static void aqt_mbhc_mbhc_bias_control(struct snd_soc_component *component,
bool enable)
{
if (enable)
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_ELECT,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_MBHC_ELECT,
+ 0x01, 0x01);
else
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_ELECT,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_MBHC_ELECT,
+ 0x01, 0x00);
}
-static void aqt_mbhc_program_btn_thr(struct snd_soc_codec *codec,
+static void aqt_mbhc_program_btn_thr(struct snd_soc_component *component,
s16 *btn_low, s16 *btn_high,
int num_btn, bool is_micbias)
{
@@ -226,24 +223,25 @@
int vth;
if (num_btn > WCD_MBHC_DEF_BUTTONS) {
- dev_err(codec->dev, "%s: invalid number of buttons: %d\n",
+ dev_err(component->dev, "%s: invalid number of buttons: %d\n",
__func__, num_btn);
return;
}
for (i = 0; i < num_btn; i++) {
vth = ((btn_high[i] * 2) / 25) & 0x3F;
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_BTN0 + i,
- 0xFC, vth << 2);
- dev_dbg(codec->dev, "%s: btn_high[%d]: %d, vth: %d\n",
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_MBHC_BTN0 + i,
+ 0xFC, vth << 2);
+ dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n",
__func__, i, btn_high[i], vth);
}
}
static bool aqt_mbhc_lock_sleep(struct wcd_mbhc *mbhc, bool lock)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct aqt1000 *aqt = dev_get_drvdata(codec->dev);
+ struct snd_soc_component *component = mbhc->component;
+ struct aqt1000 *aqt = dev_get_drvdata(component->dev);
bool ret = 0;
dev_dbg(aqt->dev, "%s: lock: %d\n", __func__, lock);
@@ -272,7 +270,8 @@
u8 val;
if (micb_num == MIC_BIAS_1) {
- val = ((snd_soc_read(mbhc->codec, AQT1000_ANA_MICB1) & 0xC0)
+ val = ((snd_soc_component_read32(
+ mbhc->component, AQT1000_ANA_MICB1) & 0xC0)
>> 6);
if (val == 0x01)
return true;
@@ -280,12 +279,13 @@
return false;
}
-static bool aqt_mbhc_hph_pa_on_status(struct snd_soc_codec *codec)
+static bool aqt_mbhc_hph_pa_on_status(struct snd_soc_component *component)
{
- return (snd_soc_read(codec, AQT1000_ANA_HPH) & 0xC0) ? true : false;
+ return (snd_soc_component_read32(component, AQT1000_ANA_HPH) & 0xC0) ?
+ true : false;
}
-static void aqt_mbhc_hph_l_pull_up_control(struct snd_soc_codec *codec,
+static void aqt_mbhc_hph_l_pull_up_control(struct snd_soc_component *component,
int pull_up_cur)
{
/* Default pull up current to 2uA */
@@ -293,14 +293,15 @@
pull_up_cur == HS_PULLUP_I_DEFAULT)
pull_up_cur = HS_PULLUP_I_2P0_UA;
- dev_dbg(codec->dev, "%s: HS pull up current:%d\n",
+ dev_dbg(component->dev, "%s: HS pull up current:%d\n",
__func__, pull_up_cur);
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_INT_MECH_DET_CURRENT,
- 0x1F, pull_up_cur);
+ snd_soc_component_update_bits(component,
+ AQT1000_MBHC_NEW_INT_MECH_DET_CURRENT,
+ 0x1F, pull_up_cur);
}
-static int aqt_mbhc_request_micbias(struct snd_soc_codec *codec,
+static int aqt_mbhc_request_micbias(struct snd_soc_component *component,
int micb_num, int req)
{
int ret = 0;
@@ -310,33 +311,37 @@
* is vote to enable mclk
*/
if (req == MICB_ENABLE)
- aqt_cdc_mclk_enable(codec, true);
+ aqt_cdc_mclk_enable(component, true);
- ret = aqt_micbias_control(codec, micb_num, req, false);
+ ret = aqt_micbias_control(component, micb_num, req, false);
/*
* Release vote for mclk while requesting for
* micbias disable
*/
if (req == MICB_DISABLE)
- aqt_cdc_mclk_enable(codec, false);
+ aqt_cdc_mclk_enable(component, false);
return ret;
}
-static void aqt_mbhc_micb_ramp_control(struct snd_soc_codec *codec,
+static void aqt_mbhc_micb_ramp_control(struct snd_soc_component *component,
bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, AQT1000_ANA_MICB1_RAMP,
- 0x1C, 0x0C);
- snd_soc_update_bits(codec, AQT1000_ANA_MICB1_RAMP,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_MICB1_RAMP,
+ 0x1C, 0x0C);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_MICB1_RAMP,
+ 0x80, 0x80);
} else {
- snd_soc_update_bits(codec, AQT1000_ANA_MICB1_RAMP,
- 0x80, 0x00);
- snd_soc_update_bits(codec, AQT1000_ANA_MICB1_RAMP,
- 0x1C, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_MICB1_RAMP,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_MICB1_RAMP,
+ 0x1C, 0x00);
}
}
@@ -345,26 +350,27 @@
{
struct aqt1000_mbhc *aqt_mbhc;
struct firmware_cal *hwdep_cal;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
aqt_mbhc = container_of(mbhc, struct aqt1000_mbhc, wcd_mbhc);
- if (!codec) {
+ if (!component) {
pr_err("%s: NULL codec pointer\n", __func__);
return NULL;
}
hwdep_cal = wcdcal_get_fw_cal(aqt_mbhc->fw_data, type);
if (!hwdep_cal)
- dev_err(codec->dev, "%s: cal not sent by %d\n",
+ dev_err(component->dev, "%s: cal not sent by %d\n",
__func__, type);
return hwdep_cal;
}
-static int aqt_mbhc_micb_ctrl_threshold_mic(struct snd_soc_codec *codec,
- int micb_num, bool req_en)
+static int aqt_mbhc_micb_ctrl_threshold_mic(
+ struct snd_soc_component *component,
+ int micb_num, bool req_en)
{
- struct aqt1000_pdata *pdata = dev_get_platdata(codec->dev);
+ struct aqt1000_pdata *pdata = dev_get_platdata(component->dev);
int rc, micb_mv;
if (micb_num != MIC_BIAS_1)
@@ -380,7 +386,7 @@
micb_mv = req_en ? WCD_MBHC_THR_HS_MICB_MV : pdata->micbias.micb1_mv;
- rc = aqt_mbhc_micb_adjust_voltage(codec, micb_mv, MIC_BIAS_1);
+ rc = aqt_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_1);
return rc;
}
@@ -441,25 +447,26 @@
}
}
-static void aqt_mbhc_zdet_ramp(struct snd_soc_codec *codec,
+static void aqt_mbhc_zdet_ramp(struct snd_soc_component *component,
struct aqt_mbhc_zdet_param *zdet_param,
int32_t *zl, int32_t *zr, s16 *d1_a)
{
- struct aqt1000 *aqt = dev_get_drvdata(codec->dev);
+ struct aqt1000 *aqt = dev_get_drvdata(component->dev);
int32_t zdet = 0;
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_ZDET_ANA_CTL, 0x70,
- zdet_param->ldo_ctl << 4);
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_BTN5, 0xFC,
- zdet_param->btn5);
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_BTN6, 0xFC,
- zdet_param->btn6);
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_BTN7, 0xFC,
- zdet_param->btn7);
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_ZDET_ANA_CTL, 0x0F,
- zdet_param->noff);
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_ZDET_RAMP_CTL, 0x0F,
- zdet_param->nshift);
+ snd_soc_component_update_bits(component,
+ AQT1000_MBHC_NEW_ZDET_ANA_CTL, 0x70,
+ zdet_param->ldo_ctl << 4);
+ snd_soc_component_update_bits(component, AQT1000_ANA_MBHC_BTN5,
+ 0xFC, zdet_param->btn5);
+ snd_soc_component_update_bits(component, AQT1000_ANA_MBHC_BTN6,
+ 0xFC, zdet_param->btn6);
+ snd_soc_component_update_bits(component, AQT1000_ANA_MBHC_BTN7,
+ 0xFC, zdet_param->btn7);
+ snd_soc_component_update_bits(component, AQT1000_MBHC_NEW_ZDET_ANA_CTL,
+ 0x0F, zdet_param->noff);
+ snd_soc_component_update_bits(component, AQT1000_MBHC_NEW_ZDET_RAMP_CTL,
+ 0x0F, zdet_param->nshift);
if (!zl)
goto z_right;
@@ -489,17 +496,17 @@
*zr = zdet;
}
-static inline void aqt_wcd_mbhc_qfuse_cal(struct snd_soc_codec *codec,
+static inline void aqt_wcd_mbhc_qfuse_cal(struct snd_soc_component *component,
int32_t *z_val, int flag_l_r)
{
s16 q1;
int q1_cal;
if (*z_val < (AQT_ZDET_VAL_400/1000))
- q1 = snd_soc_read(codec,
+ q1 = snd_soc_component_read32(component,
AQT1000_CHIP_CFG0_EFUSE_VAL_OUT1 + (2 * flag_l_r));
else
- q1 = snd_soc_read(codec,
+ q1 = snd_soc_component_read32(component,
AQT1000_CHIP_CFG0_EFUSE_VAL_OUT2 + (2 * flag_l_r));
if (q1 & 0x80)
q1_cal = (10000 - ((q1 & 0x7F) * 25));
@@ -512,8 +519,8 @@
static void aqt_wcd_mbhc_calc_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
uint32_t *zr)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct aqt1000 *aqt = dev_get_drvdata(codec->dev);
+ struct snd_soc_component *component = mbhc->component;
+ struct aqt1000 *aqt = dev_get_drvdata(component->dev);
s16 reg0, reg1, reg2, reg3, reg4;
int32_t z1L, z1R, z1Ls;
int zMono, z_diff1, z_diff2;
@@ -535,13 +542,15 @@
WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
- reg0 = snd_soc_read(codec, AQT1000_ANA_MBHC_BTN5);
- reg1 = snd_soc_read(codec, AQT1000_ANA_MBHC_BTN6);
- reg2 = snd_soc_read(codec, AQT1000_ANA_MBHC_BTN7);
- reg3 = snd_soc_read(codec, AQT1000_MBHC_CTL_CLK);
- reg4 = snd_soc_read(codec, AQT1000_MBHC_NEW_ZDET_ANA_CTL);
+ reg0 = snd_soc_component_read32(component, AQT1000_ANA_MBHC_BTN5);
+ reg1 = snd_soc_component_read32(component, AQT1000_ANA_MBHC_BTN6);
+ reg2 = snd_soc_component_read32(component, AQT1000_ANA_MBHC_BTN7);
+ reg3 = snd_soc_component_read32(component, AQT1000_MBHC_CTL_CLK);
+ reg4 = snd_soc_component_read32(component,
+ AQT1000_MBHC_NEW_ZDET_ANA_CTL);
- if (snd_soc_read(codec, AQT1000_ANA_MBHC_ELECT) & 0x80) {
+ if (snd_soc_component_read32(component,
+ AQT1000_ANA_MBHC_ELECT) & 0x80) {
is_fsm_disable = true;
regmap_update_bits(aqt->regmap,
AQT1000_ANA_MBHC_ELECT, 0x80, 0x00);
@@ -559,7 +568,7 @@
/* First get impedance on Left */
d1 = d1_a[1];
zdet_param_ptr = &zdet_param[1];
- aqt_mbhc_zdet_ramp(codec, zdet_param_ptr, &z1L, NULL, d1);
+ aqt_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1);
if (!AQT_MBHC_IS_SECOND_RAMP_REQUIRED(z1L))
goto left_ch_impedance;
@@ -575,7 +584,7 @@
zdet_param_ptr = &zdet_param[3];
d1 = d1_a[3];
}
- aqt_mbhc_zdet_ramp(codec, zdet_param_ptr, &z1L, NULL, d1);
+ aqt_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1);
left_ch_impedance:
if ((z1L == AQT_ZDET_FLOATING_IMPEDANCE) ||
@@ -585,13 +594,13 @@
d1 = d1_a[1];
} else {
*zl = z1L/1000;
- aqt_wcd_mbhc_qfuse_cal(codec, zl, 0);
+ aqt_wcd_mbhc_qfuse_cal(component, zl, 0);
}
- dev_dbg(codec->dev, "%s: impedance on HPH_L = %d(ohms)\n",
+ dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n",
__func__, *zl);
/* Start of right impedance ramp and calculation */
- aqt_mbhc_zdet_ramp(codec, zdet_param_ptr, NULL, &z1R, d1);
+ aqt_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1);
if (AQT_MBHC_IS_SECOND_RAMP_REQUIRED(z1R)) {
if (((z1R > AQT_ZDET_VAL_1200) &&
(zdet_param_ptr->noff == 0x6)) ||
@@ -609,7 +618,7 @@
zdet_param_ptr = &zdet_param[3];
d1 = d1_a[3];
}
- aqt_mbhc_zdet_ramp(codec, zdet_param_ptr, NULL, &z1R, d1);
+ aqt_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1);
}
right_ch_impedance:
if ((z1R == AQT_ZDET_FLOATING_IMPEDANCE) ||
@@ -617,15 +626,15 @@
*zr = AQT_ZDET_FLOATING_IMPEDANCE;
} else {
*zr = z1R/1000;
- aqt_wcd_mbhc_qfuse_cal(codec, zr, 1);
+ aqt_wcd_mbhc_qfuse_cal(component, zr, 1);
}
- dev_dbg(codec->dev, "%s: impedance on HPH_R = %d(ohms)\n",
+ dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n",
__func__, *zr);
/* Mono/stereo detection */
if ((*zl == AQT_ZDET_FLOATING_IMPEDANCE) &&
(*zr == AQT_ZDET_FLOATING_IMPEDANCE)) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: plug type is invalid or extension cable\n",
__func__);
goto zdet_complete;
@@ -634,40 +643,44 @@
(*zr == AQT_ZDET_FLOATING_IMPEDANCE) ||
((*zl < WCD_MONO_HS_MIN_THR) && (*zr > WCD_MONO_HS_MIN_THR)) ||
((*zl > WCD_MONO_HS_MIN_THR) && (*zr < WCD_MONO_HS_MIN_THR))) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: Mono plug type with one ch floating or shorted to GND\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_MONO;
goto zdet_complete;
}
- snd_soc_update_bits(codec, AQT1000_HPH_R_ATEST, 0x02, 0x02);
- snd_soc_update_bits(codec, AQT1000_HPH_PA_CTL2, 0x40, 0x01);
+ snd_soc_component_update_bits(component, AQT1000_HPH_R_ATEST,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, AQT1000_HPH_PA_CTL2,
+ 0x40, 0x01);
if (*zl < (AQT_ZDET_VAL_32/1000))
- aqt_mbhc_zdet_ramp(codec, &zdet_param[0], &z1Ls, NULL, d1);
+ aqt_mbhc_zdet_ramp(component, &zdet_param[0], &z1Ls, NULL, d1);
else
- aqt_mbhc_zdet_ramp(codec, &zdet_param[1], &z1Ls, NULL, d1);
- snd_soc_update_bits(codec, AQT1000_HPH_PA_CTL2, 0x40, 0x00);
- snd_soc_update_bits(codec, AQT1000_HPH_R_ATEST, 0x02, 0x00);
+ aqt_mbhc_zdet_ramp(component, &zdet_param[1], &z1Ls, NULL, d1);
+ snd_soc_component_update_bits(component, AQT1000_HPH_PA_CTL2,
+ 0x40, 0x00);
+ snd_soc_component_update_bits(component, AQT1000_HPH_R_ATEST,
+ 0x02, 0x00);
z1Ls /= 1000;
- aqt_wcd_mbhc_qfuse_cal(codec, &z1Ls, 0);
+ aqt_wcd_mbhc_qfuse_cal(component, &z1Ls, 0);
/* Parallel of left Z and 9 ohm pull down resistor */
zMono = ((*zl) * 9) / ((*zl) + 9);
z_diff1 = (z1Ls > zMono) ? (z1Ls - zMono) : (zMono - z1Ls);
z_diff2 = ((*zl) > z1Ls) ? ((*zl) - z1Ls) : (z1Ls - (*zl));
if ((z_diff1 * (*zl + z1Ls)) > (z_diff2 * (z1Ls + zMono))) {
- dev_dbg(codec->dev, "%s: stereo plug type detected\n",
+ dev_dbg(component->dev, "%s: stereo plug type detected\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_STEREO;
} else {
- dev_dbg(codec->dev, "%s: MONO plug type detected\n",
+ dev_dbg(component->dev, "%s: MONO plug type detected\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_MONO;
}
zdet_complete:
- snd_soc_write(codec, AQT1000_ANA_MBHC_BTN5, reg0);
- snd_soc_write(codec, AQT1000_ANA_MBHC_BTN6, reg1);
- snd_soc_write(codec, AQT1000_ANA_MBHC_BTN7, reg2);
+ snd_soc_component_write(component, AQT1000_ANA_MBHC_BTN5, reg0);
+ snd_soc_component_write(component, AQT1000_ANA_MBHC_BTN6, reg1);
+ snd_soc_component_write(component, AQT1000_ANA_MBHC_BTN7, reg2);
/* Turn on 100k pull down on HPHL */
regmap_update_bits(aqt->regmap,
AQT1000_ANA_MBHC_MECH, 0x01, 0x01);
@@ -677,77 +690,83 @@
regmap_update_bits(aqt->regmap,
AQT1000_ANA_MBHC_MECH, 0x80, 0x80);
- snd_soc_write(codec, AQT1000_MBHC_NEW_ZDET_ANA_CTL, reg4);
- snd_soc_write(codec, AQT1000_MBHC_CTL_CLK, reg3);
+ snd_soc_component_write(component, AQT1000_MBHC_NEW_ZDET_ANA_CTL,
+ reg4);
+ snd_soc_component_write(component, AQT1000_MBHC_CTL_CLK, reg3);
if (is_fsm_disable)
regmap_update_bits(aqt->regmap,
AQT1000_ANA_MBHC_ELECT, 0x80, 0x80);
}
-static void aqt_mbhc_gnd_det_ctrl(struct snd_soc_codec *codec, bool enable)
+static void aqt_mbhc_gnd_det_ctrl(struct snd_soc_component *component,
+ bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, AQT1000_ANA_MBHC_MECH,
0x02, 0x02);
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, AQT1000_ANA_MBHC_MECH,
0x40, 0x40);
} else {
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, AQT1000_ANA_MBHC_MECH,
0x40, 0x00);
- snd_soc_update_bits(codec, AQT1000_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, AQT1000_ANA_MBHC_MECH,
0x02, 0x00);
}
}
-static void aqt_mbhc_hph_pull_down_ctrl(struct snd_soc_codec *codec,
+static void aqt_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component,
bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, AQT1000_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, AQT1000_HPH_PA_CTL2,
0x40, 0x40);
- snd_soc_update_bits(codec, AQT1000_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, AQT1000_HPH_PA_CTL2,
0x10, 0x10);
} else {
- snd_soc_update_bits(codec, AQT1000_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, AQT1000_HPH_PA_CTL2,
0x40, 0x00);
- snd_soc_update_bits(codec, AQT1000_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, AQT1000_HPH_PA_CTL2,
0x10, 0x00);
}
}
static void aqt_mbhc_moisture_config(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
if ((mbhc->moist_rref == R_OFF) ||
(mbhc->mbhc_cfg->enable_usbc_analog)) {
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_CTL_2,
- 0x0C, R_OFF << 2);
+ snd_soc_component_update_bits(component,
+ AQT1000_MBHC_NEW_CTL_2,
+ 0x0C, R_OFF << 2);
return;
}
/* Do not enable moisture detection if jack type is NC */
if (!mbhc->hphl_swh) {
- dev_dbg(codec->dev, "%s: disable moisture detection for NC\n",
+ dev_dbg(component->dev, "%s: disable moisture detection for NC\n",
__func__);
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_CTL_2,
- 0x0C, R_OFF << 2);
+ snd_soc_component_update_bits(component,
+ AQT1000_MBHC_NEW_CTL_2,
+ 0x0C, R_OFF << 2);
return;
}
- snd_soc_update_bits(codec, AQT1000_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, AQT1000_MBHC_NEW_CTL_2,
0x0C, mbhc->moist_rref << 2);
}
-static void aqt_update_anc_state(struct snd_soc_codec *codec, bool enable,
- int anc_num)
+static void aqt_update_anc_state(struct snd_soc_component *component,
+ bool enable, int anc_num)
{
if (enable)
- snd_soc_update_bits(codec, AQT1000_CDC_RX1_RX_PATH_CFG0 +
- (20 * anc_num), 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX1_RX_PATH_CFG0 + (20 * anc_num),
+ 0x10, 0x10);
else
- snd_soc_update_bits(codec, AQT1000_CDC_RX1_RX_PATH_CFG0 +
- (20 * anc_num), 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX1_RX_PATH_CFG0 + (20 * anc_num),
+ 0x10, 0x00);
}
static bool aqt_is_anc_on(struct wcd_mbhc *mbhc)
@@ -756,9 +775,11 @@
u16 ancl, ancr;
ancl =
- (snd_soc_read(mbhc->codec, AQT1000_CDC_RX1_RX_PATH_CFG0)) & 0x10;
+ (snd_soc_component_read32(mbhc->component,
+ AQT1000_CDC_RX1_RX_PATH_CFG0)) & 0x10;
ancr =
- (snd_soc_read(mbhc->codec, AQT1000_CDC_RX2_RX_PATH_CFG0)) & 0x10;
+ (snd_soc_component_read32(mbhc->component,
+ AQT1000_CDC_RX2_RX_PATH_CFG0)) & 0x10;
anc_on = !!(ancl | ancr);
@@ -793,20 +814,23 @@
static int aqt_get_hph_type(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
struct aqt1000_mbhc *aqt_mbhc = aqt->mbhc;
struct wcd_mbhc *mbhc;
if (!aqt_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
mbhc = &aqt_mbhc->wcd_mbhc;
ucontrol->value.integer.value[0] = (u32) mbhc->hph_type;
- dev_dbg(codec->dev, "%s: hph_type = %u\n", __func__, mbhc->hph_type);
+ dev_dbg(component->dev, "%s: hph_type = %u\n", __func__,
+ mbhc->hph_type);
return 0;
}
@@ -817,19 +841,22 @@
uint32_t zl, zr;
bool hphr;
struct soc_multi_mixer_control *mc;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
struct aqt1000_mbhc *aqt_mbhc = aqt->mbhc;
if (!aqt_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
mc = (struct soc_multi_mixer_control *)(kcontrol->private_value);
hphr = mc->shift;
wcd_mbhc_get_impedance(&aqt_mbhc->wcd_mbhc, &zl, &zr);
- dev_dbg(codec->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr);
+ dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__,
+ zl, zr);
ucontrol->value.integer.value[0] = hphr ? zr : zl;
return 0;
@@ -872,22 +899,22 @@
/*
* aqt_mbhc_hs_detect: starts mbhc insertion/removal functionality
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @mbhc_cfg: handle to mbhc configuration structure
* return 0 if mbhc_start is success or error code in case of failure
*/
-int aqt_mbhc_hs_detect(struct snd_soc_codec *codec,
+int aqt_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg)
{
struct aqt1000 *aqt;
struct aqt1000_mbhc *aqt_mbhc;
- if (!codec) {
+ if (!component) {
pr_err("%s: codec is NULL\n", __func__);
return -EINVAL;
}
- aqt = snd_soc_codec_get_drvdata(codec);
+ aqt = snd_soc_component_get_drvdata(component);
if (!aqt) {
pr_err("%s: aqt is NULL\n", __func__);
return -EINVAL;
@@ -895,7 +922,8 @@
aqt_mbhc = aqt->mbhc;
if (!aqt_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
@@ -905,19 +933,19 @@
/*
* aqt_mbhc_hs_detect_exit: stop mbhc insertion/removal functionality
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*/
-void aqt_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
+void aqt_mbhc_hs_detect_exit(struct snd_soc_component *component)
{
struct aqt1000 *aqt;
struct aqt1000_mbhc *aqt_mbhc;
- if (!codec) {
+ if (!component) {
pr_err("%s: codec is NULL\n", __func__);
return;
}
- aqt = snd_soc_codec_get_drvdata(codec);
+ aqt = snd_soc_component_get_drvdata(component);
if (!aqt) {
pr_err("%s: aqt is NULL\n", __func__);
return;
@@ -925,7 +953,8 @@
aqt_mbhc = aqt->mbhc;
if (!aqt_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return;
}
wcd_mbhc_stop(&aqt_mbhc->wcd_mbhc);
@@ -935,17 +964,17 @@
/*
* aqt_mbhc_post_ssr_init: initialize mbhc for aqt post subsystem restart
* @mbhc: poniter to aqt_mbhc structure
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*
* return 0 if mbhc_init is success or error code in case of failure
*/
int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
int ret;
struct wcd_mbhc *wcd_mbhc;
- if (!mbhc || !codec)
+ if (!mbhc || !component)
return -EINVAL;
wcd_mbhc = &mbhc->wcd_mbhc;
@@ -955,10 +984,10 @@
}
wcd_mbhc_deinit(wcd_mbhc);
- ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb, &intr_ids,
+ ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb, &intr_ids,
wcd_mbhc_registers, AQT_ZDET_SUPPORTED);
if (ret) {
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
goto done;
}
@@ -971,29 +1000,30 @@
/*
* aqt_mbhc_init: initialize mbhc for aqt
* @mbhc: poniter to aqt_mbhc struct pointer to store the configs
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @fw_data: handle to firmware data
*
* return 0 if mbhc_init is success or error code in case of failure
*/
-int aqt_mbhc_init(struct aqt1000_mbhc **mbhc, struct snd_soc_codec *codec,
- struct fw_info *fw_data)
+int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
+ struct snd_soc_component *component,
+ struct fw_info *fw_data)
{
struct aqt1000_mbhc *aqt_mbhc;
struct wcd_mbhc *wcd_mbhc;
int ret;
- if (!codec) {
+ if (!component) {
pr_err("%s: codec is NULL\n", __func__);
return -EINVAL;
}
- aqt_mbhc = devm_kzalloc(codec->dev, sizeof(struct aqt1000_mbhc),
+ aqt_mbhc = devm_kzalloc(component->dev, sizeof(struct aqt1000_mbhc),
GFP_KERNEL);
if (!aqt_mbhc)
return -ENOMEM;
- aqt_mbhc->aqt = dev_get_drvdata(codec->dev);
+ aqt_mbhc->aqt = dev_get_drvdata(component->dev);
aqt_mbhc->fw_data = fw_data;
BLOCKING_INIT_NOTIFIER_HEAD(&aqt_mbhc->notifier);
wcd_mbhc = &aqt_mbhc->wcd_mbhc;
@@ -1007,43 +1037,43 @@
/* Setting default mbhc detection logic to ADC */
wcd_mbhc->mbhc_detection_logic = WCD_DETECTION_ADC;
- ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb,
+ ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb,
&intr_ids, wcd_mbhc_registers,
AQT_ZDET_SUPPORTED);
if (ret) {
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
goto err;
}
(*mbhc) = aqt_mbhc;
- snd_soc_add_codec_controls(codec, impedance_detect_controls,
+ snd_soc_add_component_controls(component, impedance_detect_controls,
ARRAY_SIZE(impedance_detect_controls));
- snd_soc_add_codec_controls(codec, hph_type_detect_controls,
+ snd_soc_add_component_controls(component, hph_type_detect_controls,
ARRAY_SIZE(hph_type_detect_controls));
return 0;
err:
- devm_kfree(codec->dev, aqt_mbhc);
+ devm_kfree(component->dev, aqt_mbhc);
return ret;
}
EXPORT_SYMBOL(aqt_mbhc_init);
/*
* aqt_mbhc_deinit: deinitialize mbhc for aqt
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*/
-void aqt_mbhc_deinit(struct snd_soc_codec *codec)
+void aqt_mbhc_deinit(struct snd_soc_component *component)
{
struct aqt1000 *aqt;
struct aqt1000_mbhc *aqt_mbhc;
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
return;
}
- aqt = snd_soc_codec_get_drvdata(codec);
+ aqt = snd_soc_component_get_drvdata(component);
if (!aqt) {
pr_err("%s: aqt is NULL\n", __func__);
return;
@@ -1052,7 +1082,7 @@
aqt_mbhc = aqt->mbhc;
if (aqt_mbhc) {
wcd_mbhc_deinit(&aqt_mbhc->wcd_mbhc);
- devm_kfree(codec->dev, aqt_mbhc);
+ devm_kfree(component->dev, aqt_mbhc);
}
}
EXPORT_SYMBOL(aqt_mbhc_deinit);
diff --git a/asoc/codecs/aqt1000/aqt1000-mbhc.h b/asoc/codecs/aqt1000/aqt1000-mbhc.h
index bdf0f5a..aea788c 100644
--- a/asoc/codecs/aqt1000/aqt1000-mbhc.h
+++ b/asoc/codecs/aqt1000/aqt1000-mbhc.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __AQT1000_MBHC_H__
#define __AQT1000_MBHC_H__
@@ -23,36 +15,36 @@
#if IS_ENABLED(CONFIG_SND_SOC_AQT1000)
extern int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
struct fw_info *fw_data);
-extern void aqt_mbhc_hs_detect_exit(struct snd_soc_codec *codec);
-extern int aqt_mbhc_hs_detect(struct snd_soc_codec *codec,
+extern void aqt_mbhc_hs_detect_exit(struct snd_soc_component *component);
+extern int aqt_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg);
-extern void aqt_mbhc_deinit(struct snd_soc_codec *codec);
+extern void aqt_mbhc_deinit(struct snd_soc_component *component);
extern int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
extern int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
uint32_t *zl, uint32_t *zr);
#else
static inline int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
struct fw_info *fw_data)
{
return 0;
}
-static inline void aqt_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
+static inline void aqt_mbhc_hs_detect_exit(struct snd_soc_component *component)
{
}
-static inline int aqt_mbhc_hs_detect(struct snd_soc_codec *codec,
+static inline int aqt_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg)
{
return 0;
}
-static inline void aqt_mbhc_deinit(struct snd_soc_codec *codec)
+static inline void aqt_mbhc_deinit(struct snd_soc_component *component)
{
}
static inline int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return 0;
}
diff --git a/asoc/codecs/aqt1000/aqt1000-reg-defaults.h b/asoc/codecs/aqt1000/aqt1000-reg-defaults.h
index 5a5da25..edcfe07 100644
--- a/asoc/codecs/aqt1000/aqt1000-reg-defaults.h
+++ b/asoc/codecs/aqt1000/aqt1000-reg-defaults.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _AQT1000_REG_DEFAULTS_H
diff --git a/asoc/codecs/aqt1000/aqt1000-registers.h b/asoc/codecs/aqt1000/aqt1000-registers.h
index 9033466..e2b6770 100644
--- a/asoc/codecs/aqt1000/aqt1000-registers.h
+++ b/asoc/codecs/aqt1000/aqt1000-registers.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _AQT1000_REGISTERS_H
diff --git a/asoc/codecs/aqt1000/aqt1000-regmap.c b/asoc/codecs/aqt1000/aqt1000-regmap.c
index e38c327..67bcd26 100644
--- a/asoc/codecs/aqt1000/aqt1000-regmap.c
+++ b/asoc/codecs/aqt1000/aqt1000-regmap.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/regmap.h>
diff --git a/asoc/codecs/aqt1000/aqt1000-routing.h b/asoc/codecs/aqt1000/aqt1000-routing.h
index 7ae3276..6a3d895 100644
--- a/asoc/codecs/aqt1000/aqt1000-routing.h
+++ b/asoc/codecs/aqt1000/aqt1000-routing.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef AQT1000_ROUTING_H
#define AQT1000_ROUTING_H
diff --git a/asoc/codecs/aqt1000/aqt1000-utils.c b/asoc/codecs/aqt1000/aqt1000-utils.c
index f1c16de..a788b5d 100644
--- a/asoc/codecs/aqt1000/aqt1000-utils.c
+++ b/asoc/codecs/aqt1000/aqt1000-utils.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/asoc/codecs/aqt1000/aqt1000-utils.h b/asoc/codecs/aqt1000/aqt1000-utils.h
index 9f68cf1..c2c7aeb 100644
--- a/asoc/codecs/aqt1000/aqt1000-utils.h
+++ b/asoc/codecs/aqt1000/aqt1000-utils.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD9XXX_UTILS_H__
diff --git a/asoc/codecs/aqt1000/aqt1000.c b/asoc/codecs/aqt1000/aqt1000.c
index 8463d82..ef0c265 100644
--- a/asoc/codecs/aqt1000/aqt1000.c
+++ b/asoc/codecs/aqt1000/aqt1000.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
#include <linux/module.h>
@@ -41,6 +33,8 @@
#include "../wcdcal-hwdep.h"
#include "aqt1000-internal.h"
+#define DRV_NAME "aqt_codec"
+
#define AQT1000_TX_UNMUTE_DELAY_MS 40
#define TX_HPF_CUT_OFF_FREQ_MASK 0x60
#define CF_MIN_3DB_4HZ 0x0
@@ -60,7 +54,7 @@
module_param(tx_unmute_delay, int, 0664);
MODULE_PARM_DESC(tx_unmute_delay, "delay to unmute the tx path");
-static void aqt_codec_set_tx_hold(struct snd_soc_codec *, u16, bool);
+static void aqt_codec_set_tx_hold(struct snd_soc_component *, u16, bool);
/* Cutoff frequency for high pass filter */
static const char * const cf_text[] = {
@@ -99,8 +93,9 @@
static int aqt_get_anc_slot(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = aqt->anc_slot;
return 0;
@@ -109,8 +104,9 @@
static int aqt_put_anc_slot(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
aqt->anc_slot = ucontrol->value.integer.value[0];
return 0;
@@ -119,8 +115,9 @@
static int aqt_get_anc_func(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = (aqt->anc_func == true ? 1 : 0);
return 0;
@@ -129,13 +126,15 @@
static int aqt_put_anc_func(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
mutex_lock(&aqt->codec_mutex);
aqt->anc_func = (!ucontrol->value.integer.value[0] ? false : true);
- dev_dbg(codec->dev, "%s: anc_func %x", __func__, aqt->anc_func);
+ dev_dbg(component->dev, "%s: anc_func %x", __func__, aqt->anc_func);
if (aqt->anc_func == true) {
snd_soc_dapm_enable_pin(dapm, "ANC HPHL PA");
@@ -169,8 +168,9 @@
static int aqt_rx_hph_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = aqt->hph_mode;
return 0;
@@ -179,16 +179,17 @@
static int aqt_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
u32 mode_val;
mode_val = ucontrol->value.enumerated.item[0];
- dev_dbg(codec->dev, "%s: mode: %d\n", __func__, mode_val);
+ dev_dbg(component->dev, "%s: mode: %d\n", __func__, mode_val);
if (mode_val == 0) {
- dev_warn(codec->dev, "%s:Invalid HPH Mode, default to Cls-H LOHiFi\n",
+ dev_warn(component->dev, "%s:Invalid HPH Mode, default to Cls-H LOHiFi\n",
__func__);
mode_val = CLS_H_LOHIFI;
}
@@ -208,15 +209,16 @@
static int aqt_iir_enable_audio_mixer_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int band_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
- ucontrol->value.integer.value[0] = (snd_soc_read(codec,
+ ucontrol->value.integer.value[0] = (snd_soc_component_read32(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_CTL) &
(1 << band_idx)) != 0;
- dev_dbg(codec->dev, "%s: IIR0 band #%d enable %d\n", __func__,
+ dev_dbg(component->dev, "%s: IIR0 band #%d enable %d\n", __func__,
band_idx, (uint32_t)ucontrol->value.integer.value[0]);
return 0;
@@ -225,60 +227,64 @@
static int aqt_iir_enable_audio_mixer_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int band_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
bool iir_band_en_status;
int value = ucontrol->value.integer.value[0];
/* Mask first 5 bits, 6-8 are reserved */
- snd_soc_update_bits(codec, AQT1000_CDC_SIDETONE_IIR0_IIR_CTL,
- (1 << band_idx), (value << band_idx));
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_SIDETONE_IIR0_IIR_CTL,
+ (1 << band_idx), (value << band_idx));
- iir_band_en_status = ((snd_soc_read(codec,
+ iir_band_en_status = ((snd_soc_component_read32(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_CTL) &
(1 << band_idx)) != 0);
- dev_dbg(codec->dev, "%s: IIR0 band #%d enable %d\n", __func__,
+ dev_dbg(component->dev, "%s: IIR0 band #%d enable %d\n", __func__,
band_idx, iir_band_en_status);
return 0;
}
-static uint32_t aqt_get_iir_band_coeff(struct snd_soc_codec *codec,
+static uint32_t aqt_get_iir_band_coeff(struct snd_soc_component *component,
int band_idx, int coeff_idx)
{
uint32_t value = 0;
/* Address does not automatically update if reading */
- snd_soc_write(codec,
+ snd_soc_component_write(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL,
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t)) & 0x7F);
- value |= snd_soc_read(codec, AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL);
+ value |= snd_soc_component_read32(component,
+ AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL);
- snd_soc_write(codec, AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL,
+ snd_soc_component_write(component,
+ AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL,
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 1) & 0x7F);
- value |= (snd_soc_read(codec,
- AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL) << 8);
+ value |= (snd_soc_component_read32(component,
+ AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL) << 8);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL,
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 2) & 0x7F);
- value |= (snd_soc_read(codec,
- AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL) << 16);
+ value |= (snd_soc_component_read32(component,
+ AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL) << 16);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL,
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 3) & 0x7F);
/* Mask bits top 2 bits since they are reserved */
- value |= ((snd_soc_read(codec,
+ value |= ((snd_soc_component_read32(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL)
& 0x3F) << 24);
@@ -288,22 +294,23 @@
static int aqt_iir_band_audio_mixer_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int band_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
ucontrol->value.integer.value[0] =
- aqt_get_iir_band_coeff(codec, band_idx, 0);
+ aqt_get_iir_band_coeff(component, band_idx, 0);
ucontrol->value.integer.value[1] =
- aqt_get_iir_band_coeff(codec, band_idx, 1);
+ aqt_get_iir_band_coeff(component, band_idx, 1);
ucontrol->value.integer.value[2] =
- aqt_get_iir_band_coeff(codec, band_idx, 2);
+ aqt_get_iir_band_coeff(component, band_idx, 2);
ucontrol->value.integer.value[3] =
- aqt_get_iir_band_coeff(codec, band_idx, 3);
+ aqt_get_iir_band_coeff(component, band_idx, 3);
ucontrol->value.integer.value[4] =
- aqt_get_iir_band_coeff(codec, band_idx, 4);
+ aqt_get_iir_band_coeff(component, band_idx, 4);
- dev_dbg(codec->dev, "%s: IIR band #%d b0 = 0x%x\n"
+ dev_dbg(component->dev, "%s: IIR band #%d b0 = 0x%x\n"
"%s: IIR band #%d b1 = 0x%x\n"
"%s: IIR band #%d b2 = 0x%x\n"
"%s: IIR band #%d a1 = 0x%x\n"
@@ -322,23 +329,23 @@
return 0;
}
-static void aqt_set_iir_band_coeff(struct snd_soc_codec *codec,
+static void aqt_set_iir_band_coeff(struct snd_soc_component *component,
int band_idx, uint32_t value)
{
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL),
(value & 0xFF));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL),
(value >> 8) & 0xFF);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL),
(value >> 16) & 0xFF);
/* Mask top 2 bits, 7-8 are reserved */
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL),
(value >> 24) & 0x3F);
}
@@ -346,7 +353,8 @@
static int aqt_iir_band_audio_mixer_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int band_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
int coeff_idx;
@@ -355,31 +363,31 @@
* Mask top bit it is reserved
* Updates addr automatically for each B2 write
*/
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(AQT1000_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL),
(band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F);
for (coeff_idx = 0; coeff_idx < AQT1000_CDC_SIDETONE_IIR_COEFF_MAX;
coeff_idx++) {
- aqt_set_iir_band_coeff(codec, band_idx,
+ aqt_set_iir_band_coeff(component, band_idx,
ucontrol->value.integer.value[coeff_idx]);
}
- dev_dbg(codec->dev, "%s: IIR band #%d b0 = 0x%x\n"
+ dev_dbg(component->dev, "%s: IIR band #%d b0 = 0x%x\n"
"%s: IIR band #%d b1 = 0x%x\n"
"%s: IIR band #%d b2 = 0x%x\n"
"%s: IIR band #%d a1 = 0x%x\n"
"%s: IIR band #%d a2 = 0x%x\n",
__func__, band_idx,
- aqt_get_iir_band_coeff(codec, band_idx, 0),
+ aqt_get_iir_band_coeff(component, band_idx, 0),
__func__, band_idx,
- aqt_get_iir_band_coeff(codec, band_idx, 1),
+ aqt_get_iir_band_coeff(component, band_idx, 1),
__func__, band_idx,
- aqt_get_iir_band_coeff(codec, band_idx, 2),
+ aqt_get_iir_band_coeff(component, band_idx, 2),
__func__, band_idx,
- aqt_get_iir_band_coeff(codec, band_idx, 3),
+ aqt_get_iir_band_coeff(component, band_idx, 3),
__func__, band_idx,
- aqt_get_iir_band_coeff(codec, band_idx, 4));
+ aqt_get_iir_band_coeff(component, band_idx, 4));
return 0;
}
@@ -388,10 +396,11 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = aqt->comp_enabled[comp];
return 0;
@@ -400,13 +409,14 @@
static int aqt_compander_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
int value = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: Compander %d enable current %d, new %d\n",
+ dev_dbg(component->dev, "%s: Compander %d enable current %d, new %d\n",
__func__, comp + 1, aqt->comp_enabled[comp], value);
aqt->comp_enabled[comp] = value;
@@ -414,12 +424,14 @@
switch (comp) {
case COMPANDER_1:
/* Set Gain Source Select based on compander enable/disable */
- snd_soc_update_bits(codec, AQT1000_HPH_L_EN, 0x20,
- (value ? 0x00:0x20));
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_L_EN, 0x20,
+ (value ? 0x00 : 0x20));
break;
case COMPANDER_2:
- snd_soc_update_bits(codec, AQT1000_HPH_R_EN, 0x20,
- (value ? 0x00:0x20));
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_R_EN, 0x20,
+ (value ? 0x00 : 0x20));
break;
default:
/*
@@ -427,7 +439,7 @@
* it does not cause any audio failure, so do not
* return error in this case, but just print a log
*/
- dev_warn(codec->dev, "%s: unknown compander: %d\n",
+ dev_warn(component->dev, "%s: unknown compander: %d\n",
__func__, comp);
};
return 0;
@@ -436,8 +448,9 @@
static int aqt_hph_asrc_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int index = -EINVAL;
if (!strcmp(kcontrol->id.name, "AQT ASRC0 Output Mode"))
@@ -455,8 +468,9 @@
static int aqt_hph_asrc_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int val = 0;
int index = -EINVAL;
@@ -481,8 +495,9 @@
static int aqt_hph_idle_detect_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int val = 0;
if (aqt)
@@ -496,8 +511,9 @@
static int aqt_hph_idle_detect_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
if (aqt)
aqt->idle_det_cfg.hph_idle_detect_en =
@@ -515,7 +531,8 @@
static int aqt_amic_pwr_lvl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u16 amic_reg = 0;
if (!strcmp(kcontrol->id.name, "AQT AMIC_1_2 PWR MODE"))
@@ -525,7 +542,7 @@
if (amic_reg)
ucontrol->value.integer.value[0] =
- (snd_soc_read(codec, amic_reg) &
+ (snd_soc_component_read32(component, amic_reg) &
AQT1000_AMIC_PWR_LVL_MASK) >>
AQT1000_AMIC_PWR_LVL_SHIFT;
return 0;
@@ -534,13 +551,14 @@
static int aqt_amic_pwr_lvl_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u32 mode_val;
u16 amic_reg = 0;
mode_val = ucontrol->value.enumerated.item[0];
- dev_dbg(codec->dev, "%s: mode: %d\n", __func__, mode_val);
+ dev_dbg(component->dev, "%s: mode: %d\n", __func__, mode_val);
if (!strcmp(kcontrol->id.name, "AQT AMIC_1_2 PWR MODE"))
amic_reg = AQT1000_ANA_AMIC1;
@@ -548,8 +566,9 @@
amic_reg = AQT1000_ANA_AMIC3;
if (amic_reg)
- snd_soc_update_bits(codec, amic_reg, AQT1000_AMIC_PWR_LVL_MASK,
- mode_val << AQT1000_AMIC_PWR_LVL_SHIFT);
+ snd_soc_component_update_bits(component, amic_reg,
+ AQT1000_AMIC_PWR_LVL_MASK,
+ mode_val << AQT1000_AMIC_PWR_LVL_SHIFT);
return 0;
}
@@ -659,41 +678,44 @@
static int aqt_codec_enable_rx_bias(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
aqt->rx_bias_count++;
if (aqt->rx_bias_count == 1) {
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_RX_SUPPLIES,
+ 0x01, 0x01);
}
break;
case SND_SOC_DAPM_POST_PMD:
aqt->rx_bias_count--;
if (!aqt->rx_bias_count)
- snd_soc_update_bits(codec, AQT1000_ANA_RX_SUPPLIES,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_RX_SUPPLIES,
+ 0x01, 0x00);
break;
};
- dev_dbg(codec->dev, "%s: Current RX BIAS user count: %d\n", __func__,
- aqt->rx_bias_count);
+ dev_dbg(component->dev, "%s: Current RX BIAS user count: %d\n",
+ __func__, aqt->rx_bias_count);
return 0;
}
/*
* aqt_mbhc_micb_adjust_voltage: adjust specific micbias voltage
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @req_volt: micbias voltage to be set
* @micb_num: micbias to be set, e.g. micbias1 or micbias2
*
* return 0 if adjustment is success or error code in case of failure
*/
-int aqt_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
+int aqt_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int req_volt, int micb_num)
{
struct aqt1000 *aqt;
@@ -701,8 +723,8 @@
int micb_reg, micb_val, micb_en;
int ret = 0;
- if (!codec) {
- pr_err("%s: Invalid codec pointer\n", __func__);
+ if (!component) {
+ pr_err("%s: Invalid component pointer\n", __func__);
return -EINVAL;
}
@@ -711,7 +733,7 @@
else
micb_reg = AQT1000_ANA_MICB1;
- aqt = snd_soc_codec_get_drvdata(codec);
+ aqt = snd_soc_component_get_drvdata(component);
mutex_lock(&aqt->micb_lock);
/*
@@ -722,7 +744,7 @@
* momentarily, change the micbias value and then re-enable
* micbias.
*/
- micb_val = snd_soc_read(codec, micb_reg);
+ micb_val = snd_soc_component_read32(component, micb_reg);
micb_en = (micb_val & 0xC0) >> 6;
cur_vout_ctl = micb_val & 0x3F;
@@ -736,17 +758,17 @@
goto exit;
}
- dev_dbg(codec->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n",
+ dev_dbg(component->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n",
__func__, micb_num, AQT_VOUT_CTL_TO_MICB(cur_vout_ctl),
req_volt, micb_en);
if (micb_en == 0x1)
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg, 0xC0, 0x80);
- snd_soc_update_bits(codec, micb_reg, 0x3F, req_vout_ctl);
+ snd_soc_component_update_bits(component, micb_reg, 0x3F, req_vout_ctl);
if (micb_en == 0x1) {
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
+ snd_soc_component_update_bits(component, micb_reg, 0xC0, 0x40);
/*
* Add 2ms delay as per HW requirement after enabling
* micbias
@@ -762,17 +784,17 @@
/*
* aqt_micbias_control: enable/disable micbias
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @micb_num: micbias to be enabled/disabled, e.g. micbias1 or micbias2
* @req: control requested, enable/disable or pullup enable/disable
* @is_dapm: triggered by dapm or not
*
* return 0 if control is success or error code in case of failure
*/
-int aqt_micbias_control(struct snd_soc_codec *codec,
+int aqt_micbias_control(struct snd_soc_component *component,
int micb_num, int req, bool is_dapm)
{
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
u16 micb_reg;
int pre_off_event = 0, post_off_event = 0;
int post_on_event = 0, post_dapm_off = 0;
@@ -789,7 +811,7 @@
post_dapm_off = AQT_EVENT_POST_DAPM_MICBIAS_1_OFF;
break;
default:
- dev_err(codec->dev, "%s: Invalid micbias number: %d\n",
+ dev_err(component->dev, "%s: Invalid micbias number: %d\n",
__func__, micb_num);
return -EINVAL;
}
@@ -800,19 +822,22 @@
aqt->pullup_ref++;
if ((aqt->pullup_ref == 1) &&
(aqt->micb_ref == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x80);
break;
case MICB_PULLUP_DISABLE:
if (aqt->pullup_ref > 0)
aqt->pullup_ref--;
if ((aqt->pullup_ref == 0) &&
(aqt->micb_ref == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x00);
break;
case MICB_ENABLE:
aqt->micb_ref++;
if (aqt->micb_ref == 1) {
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x40);
if (post_on_event && aqt->mbhc)
blocking_notifier_call_chain(
&aqt->mbhc->notifier,
@@ -828,7 +853,8 @@
aqt->micb_ref--;
if ((aqt->micb_ref == 0) &&
(aqt->pullup_ref > 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x80);
else if ((aqt->micb_ref == 0) &&
(aqt->pullup_ref == 0)) {
if (pre_off_event && aqt->mbhc)
@@ -836,7 +862,8 @@
&aqt->mbhc->notifier,
pre_off_event,
&aqt->mbhc->wcd_mbhc);
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x00);
if (post_off_event && aqt->mbhc)
blocking_notifier_call_chain(
&aqt->mbhc->notifier,
@@ -848,14 +875,14 @@
post_dapm_off, &aqt->mbhc->wcd_mbhc);
break;
default:
- dev_err(codec->dev, "%s: Invalid micbias request: %d\n",
+ dev_err(component->dev, "%s: Invalid micbias request: %d\n",
__func__, req);
ret = -EINVAL;
break;
};
if (!ret)
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: micb_num:%d, micb_ref: %d, pullup_ref: %d\n",
__func__, micb_num, aqt->micb_ref, aqt->pullup_ref);
@@ -868,10 +895,11 @@
static int __aqt_codec_enable_micbias(struct snd_soc_dapm_widget *w,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int micb_num;
- dev_dbg(codec->dev, "%s: wname: %s, event: %d\n",
+ dev_dbg(component->dev, "%s: wname: %s, event: %d\n",
__func__, w->name, event);
if (strnstr(w->name, "AQT MIC BIAS1", sizeof("AQT MIC BIAS1")))
@@ -886,14 +914,14 @@
* so use ref count to handle micbias pullup
* and enable requests
*/
- aqt_micbias_control(codec, micb_num, MICB_ENABLE, true);
+ aqt_micbias_control(component, micb_num, MICB_ENABLE, true);
break;
case SND_SOC_DAPM_POST_PMU:
/* wait for cnp time */
usleep_range(1000, 1100);
break;
case SND_SOC_DAPM_POST_PMD:
- aqt_micbias_control(codec, micb_num, MICB_DISABLE, true);
+ aqt_micbias_control(component, micb_num, MICB_DISABLE, true);
break;
};
@@ -906,28 +934,30 @@
return __aqt_codec_enable_micbias(w, event);
}
-static int aqt_codec_enable_i2s_block(struct snd_soc_codec *codec)
+static int aqt_codec_enable_i2s_block(struct snd_soc_component *component)
{
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
mutex_lock(&aqt->i2s_lock);
if (++aqt->i2s_users == 1)
- snd_soc_update_bits(codec, AQT1000_I2S_I2S_0_CTL, 0x01, 0x01);
+ snd_soc_component_update_bits(component, AQT1000_I2S_I2S_0_CTL,
+ 0x01, 0x01);
mutex_unlock(&aqt->i2s_lock);
return 0;
}
-static int aqt_codec_disable_i2s_block(struct snd_soc_codec *codec)
+static int aqt_codec_disable_i2s_block(struct snd_soc_component *component)
{
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
mutex_lock(&aqt->i2s_lock);
if (--aqt->i2s_users == 0)
- snd_soc_update_bits(codec, AQT1000_I2S_I2S_0_CTL, 0x01, 0x00);
+ snd_soc_component_update_bits(component, AQT1000_I2S_I2S_0_CTL,
+ 0x01, 0x00);
if (aqt->i2s_users < 0)
- dev_warn(codec->dev, "%s: i2s_users count (%d) < 0\n",
+ dev_warn(component->dev, "%s: i2s_users count (%d) < 0\n",
__func__, aqt->i2s_users);
mutex_unlock(&aqt->i2s_lock);
@@ -938,17 +968,18 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- aqt_codec_enable_i2s_block(codec);
+ aqt_codec_enable_i2s_block(component);
break;
case SND_SOC_DAPM_POST_PMD:
- aqt_codec_disable_i2s_block(codec);
+ aqt_codec_disable_i2s_block(component);
break;
}
- dev_dbg(codec->dev, "%s: event: %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event: %d\n", __func__, event);
return 0;
}
@@ -957,17 +988,18 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- aqt_codec_enable_i2s_block(codec);
+ aqt_codec_enable_i2s_block(component);
break;
case SND_SOC_DAPM_POST_PMD:
- aqt_codec_disable_i2s_block(codec);
+ aqt_codec_disable_i2s_block(component);
break;
}
- dev_dbg(codec->dev, "%s: event: %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event: %d\n", __func__, event);
return 0;
}
@@ -988,7 +1020,8 @@
AQT_DAPM_ENUM(tx_adc2, AQT1000_CDC_TX_INP_MUX_ADC_MUX2_CFG1, 0,
tx_adc_mux_text);
-static int aqt_find_amic_input(struct snd_soc_codec *codec, int adc_mux_n)
+static int aqt_find_amic_input(struct snd_soc_component *component,
+ int adc_mux_n)
{
u8 mask;
u16 adc_mux_in_reg = 0, amic_mux_sel_reg = 0;
@@ -1004,14 +1037,17 @@
amic_mux_sel_reg = AQT1000_CDC_TX_INP_MUX_ADC_MUX0_CFG0 +
2 * adc_mux_n;
}
- is_amic = (((snd_soc_read(codec, adc_mux_in_reg) & mask)) == 0);
+ is_amic = (
+ ((snd_soc_component_read32(component, adc_mux_in_reg)
+ & mask)) == 0);
if (!is_amic)
return 0;
- return snd_soc_read(codec, amic_mux_sel_reg) & 0x07;
+ return snd_soc_component_read32(component, amic_mux_sel_reg) & 0x07;
}
-static u16 aqt_codec_get_amic_pwlvl_reg(struct snd_soc_codec *codec, int amic)
+static u16 aqt_codec_get_amic_pwlvl_reg(
+ struct snd_soc_component *component, int amic)
{
u16 pwr_level_reg = 0;
@@ -1024,7 +1060,7 @@
pwr_level_reg = AQT1000_ANA_AMIC3;
break;
default:
- dev_dbg(codec->dev, "%s: invalid amic: %d\n",
+ dev_dbg(component->dev, "%s: invalid amic: %d\n",
__func__, amic);
break;
}
@@ -1037,7 +1073,7 @@
struct delayed_work *hpf_delayed_work;
struct hpf_work *hpf_work;
struct aqt1000 *aqt;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u16 dec_cfg_reg, amic_reg, go_bit_reg;
u8 hpf_cut_off_freq;
int amic_n;
@@ -1045,26 +1081,27 @@
hpf_delayed_work = to_delayed_work(work);
hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork);
aqt = hpf_work->aqt;
- codec = aqt->codec;
+ component = aqt->component;
hpf_cut_off_freq = hpf_work->hpf_cut_off_freq;
dec_cfg_reg = AQT1000_CDC_TX0_TX_PATH_CFG0 + 16 * hpf_work->decimator;
go_bit_reg = dec_cfg_reg + 7;
- dev_dbg(codec->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
+ dev_dbg(component->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
__func__, hpf_work->decimator, hpf_cut_off_freq);
- amic_n = aqt_find_amic_input(codec, hpf_work->decimator);
+ amic_n = aqt_find_amic_input(component, hpf_work->decimator);
if (amic_n) {
amic_reg = AQT1000_ANA_AMIC1 + amic_n - 1;
- aqt_codec_set_tx_hold(codec, amic_reg, false);
+ aqt_codec_set_tx_hold(component, amic_reg, false);
}
- snd_soc_update_bits(codec, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, go_bit_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ snd_soc_component_update_bits(component, go_bit_reg, 0x02, 0x02);
/* Minimum 1 clk cycle delay is required as per HW spec */
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, go_bit_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(component, go_bit_reg, 0x02, 0x00);
}
static void aqt_tx_mute_update_callback(struct work_struct *work)
@@ -1072,26 +1109,27 @@
struct tx_mute_work *tx_mute_dwork;
struct aqt1000 *aqt;
struct delayed_work *delayed_work;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u16 tx_vol_ctl_reg, hpf_gate_reg;
delayed_work = to_delayed_work(work);
tx_mute_dwork = container_of(delayed_work, struct tx_mute_work, dwork);
aqt = tx_mute_dwork->aqt;
- codec = aqt->codec;
+ component = aqt->component;
tx_vol_ctl_reg = AQT1000_CDC_TX0_TX_PATH_CTL +
16 * tx_mute_dwork->decimator;
hpf_gate_reg = AQT1000_CDC_TX0_TX_PATH_SEC2 +
16 * tx_mute_dwork->decimator;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x10, 0x00);
}
static int aqt_codec_enable_dec(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
char *widget_name = NULL;
char *dec = NULL;
unsigned int decimator = 0;
@@ -1101,14 +1139,14 @@
int ret = 0;
u8 hpf_cut_off_freq;
- dev_dbg(codec->dev, "%s: event: %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event: %d\n", __func__, event);
widget_name = kstrndup(w->name, 15, GFP_KERNEL);
if (!widget_name)
return -ENOMEM;
dec = strpbrk(widget_name, "012");
if (!dec) {
- dev_err(codec->dev, "%s: decimator index not found\n",
+ dev_err(component->dev, "%s: decimator index not found\n",
__func__);
ret = -EINVAL;
goto out;
@@ -1116,12 +1154,12 @@
ret = kstrtouint(dec, 10, &decimator);
if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
+ dev_err(component->dev, "%s: Invalid decimator = %s\n",
__func__, widget_name);
ret = -EINVAL;
goto out;
}
- dev_dbg(codec->dev, "%s(): widget = %s decimator = %u\n", __func__,
+ dev_dbg(component->dev, "%s(): widget = %s decimator = %u\n", __func__,
w->name, decimator);
tx_vol_ctl_reg = AQT1000_CDC_TX0_TX_PATH_CTL + 16 * decimator;
@@ -1129,56 +1167,64 @@
dec_cfg_reg = AQT1000_CDC_TX0_TX_PATH_CFG0 + 16 * decimator;
tx_gain_ctl_reg = AQT1000_CDC_TX0_TX_VOL_CTL + 16 * decimator;
- amic_n = aqt_find_amic_input(codec, decimator);
+ amic_n = aqt_find_amic_input(component, decimator);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (amic_n)
- pwr_level_reg = aqt_codec_get_amic_pwlvl_reg(codec,
+ pwr_level_reg = aqt_codec_get_amic_pwlvl_reg(component,
amic_n);
if (pwr_level_reg) {
- switch ((snd_soc_read(codec, pwr_level_reg) &
- AQT1000_AMIC_PWR_LVL_MASK) >>
- AQT1000_AMIC_PWR_LVL_SHIFT) {
+ switch ((snd_soc_component_read32(
+ component, pwr_level_reg) &
+ AQT1000_AMIC_PWR_LVL_MASK) >>
+ AQT1000_AMIC_PWR_LVL_SHIFT) {
case AQT1000_AMIC_PWR_LEVEL_LP:
- snd_soc_update_bits(codec, dec_cfg_reg,
- AQT1000_DEC_PWR_LVL_MASK,
- AQT1000_DEC_PWR_LVL_LP);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ AQT1000_DEC_PWR_LVL_MASK,
+ AQT1000_DEC_PWR_LVL_LP);
break;
case AQT1000_AMIC_PWR_LEVEL_HP:
- snd_soc_update_bits(codec, dec_cfg_reg,
- AQT1000_DEC_PWR_LVL_MASK,
- AQT1000_DEC_PWR_LVL_HP);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ AQT1000_DEC_PWR_LVL_MASK,
+ AQT1000_DEC_PWR_LVL_HP);
break;
case AQT1000_AMIC_PWR_LEVEL_DEFAULT:
default:
- snd_soc_update_bits(codec, dec_cfg_reg,
- AQT1000_DEC_PWR_LVL_MASK,
- AQT1000_DEC_PWR_LVL_DF);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ AQT1000_DEC_PWR_LVL_MASK,
+ AQT1000_DEC_PWR_LVL_DF);
break;
}
}
/* Enable TX PGA Mute */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMU:
- hpf_cut_off_freq = (snd_soc_read(codec, dec_cfg_reg) &
- TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
+ hpf_cut_off_freq = (snd_soc_component_read32(
+ component, dec_cfg_reg) &
+ TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
aqt->tx_hpf_work[decimator].hpf_cut_off_freq =
hpf_cut_off_freq;
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
+ snd_soc_component_update_bits(component, dec_cfg_reg,
TX_HPF_CUT_OFF_FREQ_MASK,
CF_MIN_3DB_150HZ << 5);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, hpf_gate_reg,
+ 0x02, 0x02);
/*
* Minimum 1 clk cycle delay is required as per
* HW spec.
*/
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(component, hpf_gate_reg,
+ 0x02, 0x00);
}
/* schedule work queue to Remove Mute */
schedule_delayed_work(&aqt->tx_mute_dwork[decimator].dwork,
@@ -1189,36 +1235,42 @@
&aqt->tx_hpf_work[decimator].dwork,
msecs_to_jiffies(300));
/* apply gain after decimator is enabled */
- snd_soc_write(codec, tx_gain_ctl_reg,
- snd_soc_read(codec, tx_gain_ctl_reg));
+ snd_soc_component_write(component, tx_gain_ctl_reg,
+ snd_soc_component_read32(
+ component, tx_gain_ctl_reg));
break;
case SND_SOC_DAPM_PRE_PMD:
hpf_cut_off_freq =
aqt->tx_hpf_work[decimator].hpf_cut_off_freq;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x10);
if (cancel_delayed_work_sync(
&aqt->tx_hpf_work[decimator].dwork)) {
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
- TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, hpf_gate_reg,
- 0x02, 0x02);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ snd_soc_component_update_bits(
+ component, hpf_gate_reg,
+ 0x02, 0x02);
/*
* Minimum 1 clk cycle delay is required as per
* HW spec.
*/
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg,
- 0x02, 0x00);
+ snd_soc_component_update_bits(
+ component, hpf_gate_reg,
+ 0x02, 0x00);
}
}
cancel_delayed_work_sync(
&aqt->tx_mute_dwork[decimator].dwork);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
- snd_soc_update_bits(codec, dec_cfg_reg,
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x00);
+ snd_soc_component_update_bits(component, dec_cfg_reg,
AQT1000_DEC_PWR_LVL_MASK,
AQT1000_DEC_PWR_LVL_DF);
break;
@@ -1248,11 +1300,12 @@
static int aqt_codec_enable_adc(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- aqt_codec_set_tx_hold(codec, w->reg, true);
+ aqt_codec_set_tx_hold(component, w->reg, true);
break;
default:
break;
@@ -1267,15 +1320,15 @@
static const struct snd_kcontrol_new anc_hphr_pa_switch =
SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-static int aqt_config_compander(struct snd_soc_codec *codec, int interp_n,
- int event)
+static int aqt_config_compander(struct snd_soc_component *component,
+ int interp_n, int event)
{
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int comp;
u16 comp_ctl0_reg, rx_path_cfg0_reg;
comp = interp_n;
- dev_dbg(codec->dev, "%s: event %d compander %d, enabled %d\n",
+ dev_dbg(component->dev, "%s: event %d compander %d, enabled %d\n",
__func__, event, comp, aqt->comp_enabled[comp]);
if (!aqt->comp_enabled[comp])
@@ -1286,29 +1339,39 @@
if (SND_SOC_DAPM_EVENT_ON(event)) {
/* Enable Compander Clock */
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(
+ component, comp_ctl0_reg, 0x01, 0x01);
+ snd_soc_component_update_bits(
+ component, comp_ctl0_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(
+ component, comp_ctl0_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(
+ component, rx_path_cfg0_reg, 0x02, 0x02);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x04);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x00);
+ snd_soc_component_update_bits(
+ component, rx_path_cfg0_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(
+ component, comp_ctl0_reg, 0x04, 0x04);
+ snd_soc_component_update_bits(
+ component, comp_ctl0_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(
+ component, comp_ctl0_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(
+ component, comp_ctl0_reg, 0x01, 0x00);
+ snd_soc_component_update_bits(
+ component, comp_ctl0_reg, 0x04, 0x00);
}
return 0;
}
-static void aqt_codec_idle_detect_control(struct snd_soc_codec *codec,
+static void aqt_codec_idle_detect_control(struct snd_soc_component *component,
int interp, int event)
{
int reg = 0, mask, val;
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
if (!aqt->idle_det_cfg.hph_idle_detect_en)
return;
@@ -1325,19 +1388,20 @@
}
if (reg && SND_SOC_DAPM_EVENT_ON(event))
- snd_soc_update_bits(codec, reg, mask, val);
+ snd_soc_component_update_bits(component, reg, mask, val);
if (reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, reg, mask, 0x00);
+ snd_soc_component_update_bits(component, reg, mask, 0x00);
aqt->idle_det_cfg.hph_idle_thr = 0;
- snd_soc_write(codec, AQT1000_CDC_RX_IDLE_DET_CFG3, 0x0);
+ snd_soc_component_write(component,
+ AQT1000_CDC_RX_IDLE_DET_CFG3, 0x0);
}
}
-static void aqt_codec_hphdelay_lutbypass(struct snd_soc_codec *codec,
+static void aqt_codec_hphdelay_lutbypass(struct snd_soc_component *component,
u16 interp_idx, int event)
{
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
u8 hph_dly_mask;
u16 hph_lut_bypass_reg = 0;
u16 hph_comp_ctrl7 = 0;
@@ -1359,48 +1423,55 @@
}
if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, AQT1000_CDC_CLSH_TEST0,
- hph_dly_mask, 0x0);
- snd_soc_update_bits(codec, hph_lut_bypass_reg, 0x80, 0x80);
+ snd_soc_component_update_bits(component, AQT1000_CDC_CLSH_TEST0,
+ hph_dly_mask, 0x0);
+ snd_soc_component_update_bits(component, hph_lut_bypass_reg,
+ 0x80, 0x80);
if (aqt->hph_mode == CLS_H_ULP)
- snd_soc_update_bits(codec, hph_comp_ctrl7, 0x20, 0x20);
+ snd_soc_component_update_bits(component, hph_comp_ctrl7,
+ 0x20, 0x20);
}
if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, AQT1000_CDC_CLSH_TEST0,
- hph_dly_mask, hph_dly_mask);
- snd_soc_update_bits(codec, hph_lut_bypass_reg, 0x80, 0x00);
- snd_soc_update_bits(codec, hph_comp_ctrl7, 0x20, 0x0);
+ snd_soc_component_update_bits(component, AQT1000_CDC_CLSH_TEST0,
+ hph_dly_mask, hph_dly_mask);
+ snd_soc_component_update_bits(component, hph_lut_bypass_reg,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component, hph_comp_ctrl7,
+ 0x20, 0x0);
}
}
-static int aqt_codec_enable_interp_clk(struct snd_soc_codec *codec,
+static int aqt_codec_enable_interp_clk(struct snd_soc_component *component,
int event, int interp_idx)
{
struct aqt1000 *aqt;
u16 main_reg, dsm_reg;
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
- aqt = snd_soc_codec_get_drvdata(codec);
+ aqt = snd_soc_component_get_drvdata(component);
main_reg = AQT1000_CDC_RX1_RX_PATH_CTL + (interp_idx * 20);
dsm_reg = AQT1000_CDC_RX1_RX_PATH_DSMDEM_CTL + (interp_idx * 20);
if (SND_SOC_DAPM_EVENT_ON(event)) {
if (aqt->main_clk_users[interp_idx] == 0) {
/* Main path PGA mute enable */
- snd_soc_update_bits(codec, main_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x10, 0x10);
/* Clk enable */
- snd_soc_update_bits(codec, dsm_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, main_reg, 0x20, 0x20);
- aqt_codec_idle_detect_control(codec, interp_idx,
+ snd_soc_component_update_bits(component, dsm_reg,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x20, 0x20);
+ aqt_codec_idle_detect_control(component, interp_idx,
event);
- aqt_codec_hphdelay_lutbypass(codec, interp_idx,
+ aqt_codec_hphdelay_lutbypass(component, interp_idx,
event);
- aqt_config_compander(codec, interp_idx, event);
+ aqt_config_compander(component, interp_idx, event);
}
aqt->main_clk_users[interp_idx]++;
}
@@ -1409,23 +1480,28 @@
aqt->main_clk_users[interp_idx]--;
if (aqt->main_clk_users[interp_idx] <= 0) {
aqt->main_clk_users[interp_idx] = 0;
- aqt_config_compander(codec, interp_idx, event);
- aqt_codec_hphdelay_lutbypass(codec, interp_idx,
+ aqt_config_compander(component, interp_idx, event);
+ aqt_codec_hphdelay_lutbypass(component, interp_idx,
event);
- aqt_codec_idle_detect_control(codec, interp_idx,
+ aqt_codec_idle_detect_control(component, interp_idx,
event);
/* Clk Disable */
- snd_soc_update_bits(codec, main_reg, 0x20, 0x00);
- snd_soc_update_bits(codec, dsm_reg, 0x01, 0x00);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x20, 0x00);
+ snd_soc_component_update_bits(component, dsm_reg,
+ 0x01, 0x00);
/* Reset enable and disable */
- snd_soc_update_bits(codec, main_reg, 0x40, 0x40);
- snd_soc_update_bits(codec, main_reg, 0x40, 0x00);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x40, 0x40);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x40, 0x00);
/* Reset rate to 48K*/
- snd_soc_update_bits(codec, main_reg, 0x0F, 0x04);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x0F, 0x04);
}
}
- dev_dbg(codec->dev, "%s event %d main_clk_users %d\n",
+ dev_dbg(component->dev, "%s event %d main_clk_users %d\n",
__func__, event, aqt->main_clk_users[interp_idx]);
return aqt->main_clk_users[interp_idx];
@@ -1434,9 +1510,10 @@
static int aqt_anc_out_switch_cb(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- aqt_codec_enable_interp_clk(codec, event, w->shift);
+ aqt_codec_enable_interp_clk(component, event, w->shift);
return 0;
}
@@ -1481,14 +1558,14 @@
AQT_DAPM_ENUM(rx_int2_2, AQT1000_CDC_RX_INP_MUX_RX_INT2_CFG1, 0,
rx_int2_2_mux_text);
-static int aqt_codec_set_idle_detect_thr(struct snd_soc_codec *codec,
+static int aqt_codec_set_idle_detect_thr(struct snd_soc_component *component,
int interp, int path_type)
{
int port_id[4] = { 0, 0, 0, 0 };
int *port_ptr, num_ports;
int bit_width = 0;
int mux_reg = 0, mux_reg_val = 0;
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int idle_thr;
if ((interp != INTERP_HPHL) && (interp != INTERP_HPHR))
@@ -1513,12 +1590,13 @@
else
mux_reg = AQT1000_CDC_RX_INP_MUX_RX_INT2_CFG0;
}
- mux_reg_val = snd_soc_read(codec, mux_reg);
+ mux_reg_val = snd_soc_component_read32(component, mux_reg);
/* Read bit width from I2S reg if mux is set to I2S0_L or I2S0_R */
if (mux_reg_val == 0x02 || mux_reg_val == 0x03)
- bit_width = ((snd_soc_read(codec, AQT1000_I2S_I2S_0_CTL) &
- 0x40) >> 6);
+ bit_width = ((snd_soc_component_read32(
+ component, AQT1000_I2S_I2S_0_CTL) &
+ 0x40) >> 6);
switch (bit_width) {
case 1: /* 16 bit */
@@ -1530,12 +1608,13 @@
break;
}
- dev_dbg(codec->dev, "%s: (new) idle_thr: %d, (cur) idle_thr: %d\n",
+ dev_dbg(component->dev, "%s: (new) idle_thr: %d, (cur) idle_thr: %d\n",
__func__, idle_thr, aqt->idle_det_cfg.hph_idle_thr);
if ((aqt->idle_det_cfg.hph_idle_thr == 0) ||
(idle_thr < aqt->idle_det_cfg.hph_idle_thr)) {
- snd_soc_write(codec, AQT1000_CDC_RX_IDLE_DET_CFG3, idle_thr);
+ snd_soc_component_write(component, AQT1000_CDC_RX_IDLE_DET_CFG3,
+ idle_thr);
aqt->idle_det_cfg.hph_idle_thr = idle_thr;
}
@@ -1546,14 +1625,15 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 gain_reg = 0;
int val = 0;
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s %d %s\n", __func__, event, w->name);
if (w->shift >= AQT1000_NUM_INTERPOLATORS) {
- dev_err(codec->dev, "%s: Invalid Interpolator value %d for name %s\n",
+ dev_err(component->dev, "%s: Invalid Interpolator value %d for name %s\n",
__func__, w->shift, w->name);
return -EINVAL;
};
@@ -1563,17 +1643,17 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- aqt_codec_enable_interp_clk(codec, event, w->shift);
+ aqt_codec_enable_interp_clk(component, event, w->shift);
break;
case SND_SOC_DAPM_POST_PMU:
- aqt_codec_set_idle_detect_thr(codec, w->shift,
+ aqt_codec_set_idle_detect_thr(component, w->shift,
INTERP_MAIN_PATH);
/* apply gain after int clk is enabled */
- val = snd_soc_read(codec, gain_reg);
- snd_soc_write(codec, gain_reg, val);
+ val = snd_soc_component_read32(component, gain_reg);
+ snd_soc_component_write(component, gain_reg, val);
break;
case SND_SOC_DAPM_POST_PMD:
- aqt_codec_enable_interp_clk(codec, event, w->shift);
+ aqt_codec_enable_interp_clk(component, event, w->shift);
break;
};
@@ -1584,12 +1664,13 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 gain_reg = 0;
u16 mix_reg = 0;
if (w->shift >= AQT1000_NUM_INTERPOLATORS) {
- dev_err(codec->dev, "%s: Invalid Interpolator value %d for name %s\n",
+ dev_err(component->dev, "%s: Invalid Interpolator value %d for name %s\n",
__func__, w->shift, w->name);
return -EINVAL;
};
@@ -1600,25 +1681,26 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- aqt_codec_enable_interp_clk(codec, event, w->shift);
+ aqt_codec_enable_interp_clk(component, event, w->shift);
/* Clk enable */
- snd_soc_update_bits(codec, mix_reg, 0x20, 0x20);
+ snd_soc_component_update_bits(component, mix_reg, 0x20, 0x20);
break;
case SND_SOC_DAPM_POST_PMU:
- aqt_codec_set_idle_detect_thr(codec, w->shift,
+ aqt_codec_set_idle_detect_thr(component, w->shift,
INTERP_MIX_PATH);
break;
case SND_SOC_DAPM_POST_PMD:
/* Clk Disable */
- snd_soc_update_bits(codec, mix_reg, 0x20, 0x00);
- aqt_codec_enable_interp_clk(codec, event, w->shift);
+ snd_soc_component_update_bits(component, mix_reg, 0x20, 0x00);
+ aqt_codec_enable_interp_clk(component, event, w->shift);
/* Reset enable and disable */
- snd_soc_update_bits(codec, mix_reg, 0x40, 0x40);
- snd_soc_update_bits(codec, mix_reg, 0x40, 0x00);
+ snd_soc_component_update_bits(component, mix_reg, 0x40, 0x40);
+ snd_soc_component_update_bits(component, mix_reg, 0x40, 0x00);
break;
};
- dev_dbg(codec->dev, "%s event %d name %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s event %d name %s\n", __func__,
+ event, w->name);
return 0;
}
@@ -1701,8 +1783,9 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int asrc = 0, ret = 0;
u8 cfg;
u16 cfg_reg = 0;
@@ -1713,9 +1796,10 @@
u16 paired_reg = 0;
u8 main_sr, mix_sr, asrc_mode = 0;
- cfg = snd_soc_read(codec, AQT1000_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0);
+ cfg = snd_soc_component_read32(component,
+ AQT1000_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0);
if (!(cfg & 0xFF)) {
- dev_err(codec->dev, "%s: ASRC%u input not selected\n",
+ dev_err(component->dev, "%s: ASRC%u input not selected\n",
__func__, w->shift);
return -EINVAL;
}
@@ -1740,7 +1824,7 @@
}
break;
default:
- dev_err(codec->dev, "%s: Invalid asrc:%u\n", __func__,
+ dev_err(component->dev, "%s: Invalid asrc:%u\n", __func__,
w->shift);
ret = -EINVAL;
break;
@@ -1752,26 +1836,30 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- if ((snd_soc_read(codec, clk_reg) & 0x02) ||
- (snd_soc_read(codec, paired_reg) & 0x02)) {
- snd_soc_update_bits(codec, clk_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, paired_reg, 0x02, 0x00);
+ if ((snd_soc_component_read32(component, clk_reg) & 0x02) ||
+ (snd_soc_component_read32(component, paired_reg) & 0x02)) {
+ snd_soc_component_update_bits(component, clk_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, paired_reg,
+ 0x02, 0x00);
}
- snd_soc_update_bits(codec, cfg_reg, 0x80, 0x80);
- snd_soc_update_bits(codec, clk_reg, 0x01, 0x01);
- main_sr = snd_soc_read(codec, ctl_reg) & 0x0F;
+ snd_soc_component_update_bits(component, cfg_reg, 0x80, 0x80);
+ snd_soc_component_update_bits(component, clk_reg, 0x01, 0x01);
+ main_sr = snd_soc_component_read32(component, ctl_reg) & 0x0F;
mix_ctl_reg = ctl_reg + 5;
- mix_sr = snd_soc_read(codec, mix_ctl_reg) & 0x0F;
+ mix_sr = snd_soc_component_read32(
+ component, mix_ctl_reg) & 0x0F;
asrc_mode = aqt_get_asrc_mode(aqt, asrc,
main_sr, mix_sr);
- dev_dbg(codec->dev, "%s: main_sr:%d mix_sr:%d asrc_mode %d\n",
+ dev_dbg(component->dev, "%s: main_sr:%d mix_sr:%d asrc_mode %d\n",
__func__, main_sr, mix_sr, asrc_mode);
- snd_soc_update_bits(codec, asrc_ctl, 0x07, asrc_mode);
+ snd_soc_component_update_bits(
+ component, asrc_ctl, 0x07, asrc_mode);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, asrc_ctl, 0x07, 0x00);
- snd_soc_update_bits(codec, cfg_reg, 0x80, 0x00);
- snd_soc_update_bits(codec, clk_reg, 0x03, 0x02);
+ snd_soc_component_update_bits(component, asrc_ctl, 0x07, 0x00);
+ snd_soc_component_update_bits(component, cfg_reg, 0x80, 0x00);
+ snd_soc_component_update_bits(component, clk_reg, 0x03, 0x02);
break;
};
@@ -1782,8 +1870,9 @@
static int aqt_codec_enable_anc(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
const char *filename;
const struct firmware *fw;
int i;
@@ -1809,28 +1898,28 @@
if (hwdep_cal) {
data = hwdep_cal->data;
cal_size = hwdep_cal->size;
- dev_dbg(codec->dev, "%s: using hwdep calibration, cal_size %zd",
+ dev_dbg(component->dev, "%s: using hwdep calibration, cal_size %zd",
__func__, cal_size);
} else {
filename = "AQT1000/AQT1000_anc.bin";
- ret = request_firmware(&fw, filename, codec->dev);
+ ret = request_firmware(&fw, filename, component->dev);
if (ret < 0) {
- dev_err(codec->dev, "%s: Failed to acquire ANC data: %d\n",
+ dev_err(component->dev, "%s: Failed to acquire ANC data: %d\n",
__func__, ret);
return ret;
}
if (!fw) {
- dev_err(codec->dev, "%s: Failed to get anc fw\n",
+ dev_err(component->dev, "%s: Failed to get anc fw\n",
__func__);
return -ENODEV;
}
data = fw->data;
cal_size = fw->size;
- dev_dbg(codec->dev, "%s: using request_firmware calibration\n",
+ dev_dbg(component->dev, "%s: using request_firmware calibration\n",
__func__);
}
if (cal_size < sizeof(struct aqt1000_anc_header)) {
- dev_err(codec->dev, "%s: Invalid cal_size %zd\n",
+ dev_err(component->dev, "%s: Invalid cal_size %zd\n",
__func__, cal_size);
ret = -EINVAL;
goto err;
@@ -1843,14 +1932,14 @@
num_anc_slots = anc_head->num_anc_slots;
if (aqt->anc_slot >= num_anc_slots) {
- dev_err(codec->dev, "%s: Invalid ANC slot selected\n",
+ dev_err(component->dev, "%s: Invalid ANC slot selected\n",
__func__);
ret = -EINVAL;
goto err;
}
for (i = 0; i < num_anc_slots; i++) {
if (anc_size_remaining < AQT1000_PACKED_REG_SIZE) {
- dev_err(codec->dev, "%s: Invalid register format\n",
+ dev_err(component->dev, "%s: Invalid register format\n",
__func__);
ret = -EINVAL;
goto err;
@@ -1861,7 +1950,7 @@
if ((anc_writes_size * AQT1000_PACKED_REG_SIZE) >
anc_size_remaining) {
- dev_err(codec->dev, "%s: Invalid register format\n",
+ dev_err(component->dev, "%s: Invalid register format\n",
__func__);
ret = -EINVAL;
goto err;
@@ -1875,7 +1964,7 @@
anc_ptr += anc_writes_size;
}
if (i == num_anc_slots) {
- dev_err(codec->dev, "%s: Selected ANC slot not present\n",
+ dev_err(component->dev, "%s: Selected ANC slot not present\n",
__func__);
ret = -EINVAL;
goto err;
@@ -1885,36 +1974,36 @@
anc_cal_size = anc_writes_size;
/* Rate converter clk enable and set bypass mode */
if (!strcmp(w->name, "AQT RX INT1 DAC")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC0_RC_COMMON_CTL,
0x05, 0x05);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC0_FIFO_COMMON_CTL,
0x66, 0x66);
anc_writes_size = anc_cal_size / 2;
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC0_CLK_RESET_CTL, 0x39, 0x39);
} else if (!strcmp(w->name, "AQT RX INT2 DAC")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC1_RC_COMMON_CTL,
0x05, 0x05);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC1_FIFO_COMMON_CTL,
0x66, 0x66);
i = anc_cal_size / 2;
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC1_CLK_RESET_CTL, 0x39, 0x39);
}
for (; i < anc_writes_size; i++) {
AQT1000_CODEC_UNPACK_ENTRY(anc_ptr[i], reg, mask, val);
- snd_soc_write(codec, reg, (val & mask));
+ snd_soc_component_write(component, reg, (val & mask));
}
if (!strcmp(w->name, "AQT RX INT1 DAC"))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC0_CLK_RESET_CTL, 0x08, 0x08);
else if (!strcmp(w->name, "AQT RX INT2 DAC"))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC1_CLK_RESET_CTL, 0x08, 0x08);
if (!hwdep_cal)
@@ -1923,53 +2012,58 @@
case SND_SOC_DAPM_POST_PMU:
/* Remove ANC Rx from reset */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC0_CLK_RESET_CTL,
0x08, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_ANC1_CLK_RESET_CTL,
0x08, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, AQT1000_CDC_ANC0_RC_COMMON_CTL,
- 0x05, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC0_RC_COMMON_CTL,
+ 0x05, 0x00);
if (!strcmp(w->name, "AQT ANC HPHL PA")) {
- snd_soc_update_bits(codec, AQT1000_CDC_ANC0_MODE_1_CTL,
- 0x30, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC0_MODE_1_CTL,
+ 0x30, 0x00);
/* 50 msec sleep is needed to avoid click and pop as
* per HW requirement
*/
msleep(50);
- snd_soc_update_bits(codec, AQT1000_CDC_ANC0_MODE_1_CTL,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- AQT1000_CDC_ANC0_CLK_RESET_CTL,
- 0x38, 0x38);
- snd_soc_update_bits(codec,
- AQT1000_CDC_ANC0_CLK_RESET_CTL,
- 0x07, 0x00);
- snd_soc_update_bits(codec,
- AQT1000_CDC_ANC0_CLK_RESET_CTL,
- 0x38, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC0_MODE_1_CTL,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC0_CLK_RESET_CTL,
+ 0x38, 0x38);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC0_CLK_RESET_CTL,
+ 0x07, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC0_CLK_RESET_CTL,
+ 0x38, 0x00);
} else if (!strcmp(w->name, "AQT ANC HPHR PA")) {
- snd_soc_update_bits(codec, AQT1000_CDC_ANC1_MODE_1_CTL,
- 0x30, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC1_MODE_1_CTL,
+ 0x30, 0x00);
/* 50 msec sleep is needed to avoid click and pop as
* per HW requirement
*/
msleep(50);
- snd_soc_update_bits(codec, AQT1000_CDC_ANC1_MODE_1_CTL,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- AQT1000_CDC_ANC1_CLK_RESET_CTL,
- 0x38, 0x38);
- snd_soc_update_bits(codec,
- AQT1000_CDC_ANC1_CLK_RESET_CTL,
- 0x07, 0x00);
- snd_soc_update_bits(codec,
- AQT1000_CDC_ANC1_CLK_RESET_CTL,
- 0x38, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC1_MODE_1_CTL,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC1_CLK_RESET_CTL,
+ 0x38, 0x38);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC1_CLK_RESET_CTL,
+ 0x07, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_ANC1_CLK_RESET_CTL,
+ 0x38, 0x00);
}
break;
}
@@ -1981,25 +2075,25 @@
return ret;
}
-static void aqt_codec_override(struct snd_soc_codec *codec, int mode,
+static void aqt_codec_override(struct snd_soc_component *component, int mode,
int event)
{
if (mode == CLS_AB || mode == CLS_AB_HIFI) {
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_ANA_RX_SUPPLIES, 0x02, 0x02);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_ANA_RX_SUPPLIES, 0x02, 0x00);
break;
}
}
}
-static void aqt_codec_set_tx_hold(struct snd_soc_codec *codec,
+static void aqt_codec_set_tx_hold(struct snd_soc_component *component,
u16 amic_reg, bool set)
{
u8 mask = 0x20;
@@ -2014,13 +2108,15 @@
switch (amic_reg) {
case AQT1000_ANA_AMIC1:
case AQT1000_ANA_AMIC2:
- snd_soc_update_bits(codec, AQT1000_ANA_AMIC2, mask, val);
+ snd_soc_component_update_bits(component, AQT1000_ANA_AMIC2,
+ mask, val);
break;
case AQT1000_ANA_AMIC3:
- snd_soc_update_bits(codec, AQT1000_ANA_AMIC3_HPF, mask, val);
+ snd_soc_component_update_bits(component, AQT1000_ANA_AMIC3_HPF,
+ mask, val);
break;
default:
- dev_dbg(codec->dev, "%s: invalid amic: %d\n",
+ dev_dbg(component->dev, "%s: invalid amic: %d\n",
__func__, amic_reg);
break;
}
@@ -2029,11 +2125,11 @@
static void aqt_codec_clear_anc_tx_hold(struct aqt1000 *aqt)
{
if (test_and_clear_bit(ANC_MIC_AMIC1, &aqt->status_mask))
- aqt_codec_set_tx_hold(aqt->codec, AQT1000_ANA_AMIC1, false);
+ aqt_codec_set_tx_hold(aqt->component, AQT1000_ANA_AMIC1, false);
if (test_and_clear_bit(ANC_MIC_AMIC2, &aqt->status_mask))
- aqt_codec_set_tx_hold(aqt->codec, AQT1000_ANA_AMIC2, false);
+ aqt_codec_set_tx_hold(aqt->component, AQT1000_ANA_AMIC2, false);
if (test_and_clear_bit(ANC_MIC_AMIC3, &aqt->status_mask))
- aqt_codec_set_tx_hold(aqt->codec, AQT1000_ANA_AMIC3, false);
+ aqt_codec_set_tx_hold(aqt->component, AQT1000_ANA_AMIC3, false);
}
static const char * const rx_int_dem_inp_mux_text[] = {
@@ -2045,7 +2141,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val;
unsigned short look_ahead_dly_reg = AQT1000_CDC_RX1_RX_PATH_CFG0;
@@ -2054,7 +2151,7 @@
if (val >= e->items)
return -EINVAL;
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: wname: %s, val: 0x%x\n", __func__,
widget->name, val);
if (e->reg == AQT1000_CDC_RX1_RX_PATH_SEC0)
@@ -2063,7 +2160,7 @@
look_ahead_dly_reg = AQT1000_CDC_RX2_RX_PATH_CFG0;
/* Set Look Ahead Delay */
- snd_soc_update_bits(codec, look_ahead_dly_reg,
+ snd_soc_component_update_bits(component, look_ahead_dly_reg,
0x08, (val ? 0x08 : 0x00));
/* Set DEM INP Select */
return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
@@ -2080,16 +2177,17 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int hph_mode = aqt->hph_mode;
u8 dem_inp;
int ret = 0;
uint32_t impedl = 0;
uint32_t impedr = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d hph_mode: %d\n", __func__,
- w->name, event, hph_mode);
+ dev_dbg(component->dev, "%s wname: %s event: %d hph_mode: %d\n",
+ __func__, w->name, event, hph_mode);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
@@ -2099,35 +2197,37 @@
msleep(40);
}
/* Read DEM INP Select */
- dem_inp = snd_soc_read(codec, AQT1000_CDC_RX1_RX_PATH_SEC0) &
- 0x03;
+ dem_inp = snd_soc_component_read32(
+ component, AQT1000_CDC_RX1_RX_PATH_SEC0) &
+ 0x03;
if (((hph_mode == CLS_H_HIFI) || (hph_mode == CLS_H_LOHIFI) ||
(hph_mode == CLS_H_LP)) && (dem_inp != 0x01)) {
- dev_err(codec->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
+ dev_err(component->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
__func__, hph_mode);
return -EINVAL;
}
/* Disable AutoChop timer during power up */
- snd_soc_update_bits(codec, AQT1000_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x00);
- aqt_clsh_fsm(codec, &aqt->clsh_d,
+ aqt_clsh_fsm(component, &aqt->clsh_d,
AQT_CLSH_EVENT_PRE_DAC,
AQT_CLSH_STATE_HPHL,
hph_mode);
if (aqt->anc_func)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX1_RX_PATH_CFG0,
0x10, 0x10);
ret = aqt_mbhc_get_impedance(aqt->mbhc,
&impedl, &impedr);
if (!ret) {
- aqt_clsh_imped_config(codec, impedl, false);
+ aqt_clsh_imped_config(component, impedl, false);
set_bit(CLSH_Z_CONFIG, &aqt->status_mask);
} else {
- dev_dbg(codec->dev, "%s: Failed to get mbhc impedance %d\n",
+ dev_dbg(component->dev, "%s: Failed to get mbhc impedance %d\n",
__func__, ret);
ret = 0;
}
@@ -2135,12 +2235,12 @@
case SND_SOC_DAPM_POST_PMD:
/* 1000us required as per HW requirement */
usleep_range(1000, 1100);
- aqt_clsh_fsm(codec, &aqt->clsh_d,
+ aqt_clsh_fsm(component, &aqt->clsh_d,
AQT_CLSH_EVENT_POST_PA,
AQT_CLSH_STATE_HPHL,
hph_mode);
if (test_bit(CLSH_Z_CONFIG, &aqt->status_mask)) {
- aqt_clsh_imped_config(codec, impedl, true);
+ aqt_clsh_imped_config(component, impedl, true);
clear_bit(CLSH_Z_CONFIG, &aqt->status_mask);
}
break;
@@ -2155,14 +2255,15 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int hph_mode = aqt->hph_mode;
u8 dem_inp;
int ret = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d hph_mode: %d\n", __func__,
- w->name, event, hph_mode);
+ dev_dbg(component->dev, "%s wname: %s event: %d hph_mode: %d\n",
+ __func__, w->name, event, hph_mode);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
@@ -2172,30 +2273,32 @@
msleep(40);
}
/* Read DEM INP Select */
- dem_inp = snd_soc_read(codec, AQT1000_CDC_RX2_RX_PATH_SEC0) &
- 0x03;
+ dem_inp = snd_soc_component_read32(
+ component, AQT1000_CDC_RX2_RX_PATH_SEC0) &
+ 0x03;
if (((hph_mode == CLS_H_HIFI) || (hph_mode == CLS_H_LOHIFI) ||
(hph_mode == CLS_H_LP)) && (dem_inp != 0x01)) {
- dev_err(codec->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
+ dev_err(component->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
__func__, hph_mode);
return -EINVAL;
}
/* Disable AutoChop timer during power up */
- snd_soc_update_bits(codec, AQT1000_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x00);
- aqt_clsh_fsm(codec, &aqt->clsh_d,
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x00);
+ aqt_clsh_fsm(component, &aqt->clsh_d,
AQT_CLSH_EVENT_PRE_DAC,
AQT_CLSH_STATE_HPHR,
hph_mode);
if (aqt->anc_func)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX2_RX_PATH_CFG0,
0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMD:
/* 1000us required as per HW requirement */
usleep_range(1000, 1100);
- aqt_clsh_fsm(codec, &aqt->clsh_d,
+ aqt_clsh_fsm(component, &aqt->clsh_d,
AQT_CLSH_EVENT_POST_PA,
AQT_CLSH_STATE_HPHR,
hph_mode);
@@ -2211,23 +2314,26 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if ((!(strcmp(w->name, "AQT ANC HPHR PA"))) &&
(test_bit(HPH_PA_DELAY, &aqt->status_mask)))
- snd_soc_update_bits(codec, AQT1000_ANA_HPH, 0xC0, 0xC0);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_HPH, 0xC0, 0xC0);
set_bit(HPH_PA_DELAY, &aqt->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if ((!(strcmp(w->name, "AQT ANC HPHR PA")))) {
- if ((snd_soc_read(codec, AQT1000_ANA_HPH) & 0xC0)
+ if ((snd_soc_component_read32(
+ component, AQT1000_ANA_HPH) & 0xC0)
!= 0xC0)
/*
* If PA_EN is not set (potentially in ANC case)
@@ -2250,64 +2356,76 @@
}
if (aqt->anc_func) {
/* Clear Tx FE HOLD if both PAs are enabled */
- if ((snd_soc_read(aqt->codec, AQT1000_ANA_HPH) &
+ if ((snd_soc_component_read32(
+ aqt->component, AQT1000_ANA_HPH) &
0xC0) == 0xC0)
aqt_codec_clear_anc_tx_hold(aqt);
}
- snd_soc_update_bits(codec, AQT1000_HPH_R_TEST, 0x01, 0x01);
+ snd_soc_component_update_bits(
+ component, AQT1000_HPH_R_TEST, 0x01, 0x01);
/* Remove mute */
- snd_soc_update_bits(codec, AQT1000_CDC_RX2_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(
+ component, AQT1000_CDC_RX2_RX_PATH_CTL,
+ 0x10, 0x00);
/* Enable GM3 boost */
- snd_soc_update_bits(codec, AQT1000_HPH_CNP_WG_CTL,
- 0x80, 0x80);
+ snd_soc_component_update_bits(
+ component, AQT1000_HPH_CNP_WG_CTL,
+ 0x80, 0x80);
/* Enable AutoChop timer at the end of power up */
- snd_soc_update_bits(codec, AQT1000_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x02);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, AQT1000_CDC_RX2_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(
+ component, AQT1000_CDC_RX2_RX_PATH_MIX_CTL)) &
+ 0x10)
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX2_RX_PATH_MIX_CTL,
0x10, 0x00);
if (!(strcmp(w->name, "AQT ANC HPHR PA"))) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s:Do everything needed for left channel\n",
__func__);
/* Do everything needed for left channel */
- snd_soc_update_bits(codec, AQT1000_HPH_L_TEST,
- 0x01, 0x01);
+ snd_soc_component_update_bits(
+ component, AQT1000_HPH_L_TEST,
+ 0x01, 0x01);
/* Remove mute */
- snd_soc_update_bits(codec, AQT1000_CDC_RX1_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX1_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec,
+ if ((snd_soc_component_read32(component,
AQT1000_CDC_RX1_RX_PATH_MIX_CTL)) &
0x10)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX1_RX_PATH_MIX_CTL,
0x10, 0x00);
/* Remove ANC Rx from reset */
ret = aqt_codec_enable_anc(w, kcontrol, event);
}
- aqt_codec_override(codec, aqt->hph_mode, event);
+ aqt_codec_override(component, aqt->hph_mode, event);
break;
case SND_SOC_DAPM_PRE_PMD:
blocking_notifier_call_chain(&aqt->mbhc->notifier,
AQT_EVENT_PRE_HPHR_PA_OFF,
&aqt->mbhc->wcd_mbhc);
- snd_soc_update_bits(codec, AQT1000_HPH_R_TEST, 0x01, 0x00);
- snd_soc_update_bits(codec, AQT1000_CDC_RX2_RX_PATH_CTL,
- 0x10, 0x10);
- snd_soc_update_bits(codec, AQT1000_CDC_RX2_RX_PATH_MIX_CTL,
- 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_R_TEST, 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX2_RX_PATH_CTL,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX2_RX_PATH_MIX_CTL,
+ 0x10, 0x10);
if (!(strcmp(w->name, "AQT ANC HPHR PA")))
- snd_soc_update_bits(codec, AQT1000_ANA_HPH, 0x40, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_HPH, 0x40, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
/*
@@ -2318,13 +2436,13 @@
usleep_range(20000, 20100);
else
usleep_range(5000, 5100);
- aqt_codec_override(codec, aqt->hph_mode, event);
+ aqt_codec_override(component, aqt->hph_mode, event);
blocking_notifier_call_chain(&aqt->mbhc->notifier,
AQT_EVENT_POST_HPHR_PA_OFF,
&aqt->mbhc->wcd_mbhc);
if (!(strcmp(w->name, "AQT ANC HPHR PA"))) {
ret = aqt_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX2_RX_PATH_CFG0,
0x10, 0x00);
}
@@ -2338,23 +2456,26 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if ((!(strcmp(w->name, "AQT ANC HPHL PA"))) &&
(test_bit(HPH_PA_DELAY, &aqt->status_mask)))
- snd_soc_update_bits(codec, AQT1000_ANA_HPH,
- 0xC0, 0xC0);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_HPH,
+ 0xC0, 0xC0);
set_bit(HPH_PA_DELAY, &aqt->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if (!(strcmp(w->name, "AQT ANC HPHL PA"))) {
- if ((snd_soc_read(codec, AQT1000_ANA_HPH) & 0xC0)
+ if ((snd_soc_component_read32(
+ component, AQT1000_ANA_HPH) & 0xC0)
!= 0xC0)
/*
* If PA_EN is not set (potentially in ANC
@@ -2377,64 +2498,73 @@
}
if (aqt->anc_func) {
/* Clear Tx FE HOLD if both PAs are enabled */
- if ((snd_soc_read(aqt->codec, AQT1000_ANA_HPH) &
+ if ((snd_soc_component_read32(
+ aqt->component, AQT1000_ANA_HPH) &
0xC0) == 0xC0)
aqt_codec_clear_anc_tx_hold(aqt);
}
- snd_soc_update_bits(codec, AQT1000_HPH_L_TEST, 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_L_TEST, 0x01, 0x01);
/* Remove Mute on primary path */
- snd_soc_update_bits(codec, AQT1000_CDC_RX1_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX1_RX_PATH_CTL,
+ 0x10, 0x00);
/* Enable GM3 boost */
- snd_soc_update_bits(codec, AQT1000_HPH_CNP_WG_CTL,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_CNP_WG_CTL,
+ 0x80, 0x80);
/* Enable AutoChop timer at the end of power up */
- snd_soc_update_bits(codec, AQT1000_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x02);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, AQT1000_CDC_RX1_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(component,
+ AQT1000_CDC_RX1_RX_PATH_MIX_CTL)) &
+ 0x10)
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX1_RX_PATH_MIX_CTL,
0x10, 0x00);
if (!(strcmp(w->name, "AQT ANC HPHL PA"))) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s:Do everything needed for right channel\n",
__func__);
/* Do everything needed for right channel */
- snd_soc_update_bits(codec, AQT1000_HPH_R_TEST,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_R_TEST,
+ 0x01, 0x01);
/* Remove mute */
- snd_soc_update_bits(codec, AQT1000_CDC_RX2_RX_PATH_CTL,
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX2_RX_PATH_CTL,
0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec,
+ if ((snd_soc_component_read32(component,
AQT1000_CDC_RX2_RX_PATH_MIX_CTL)) &
0x10)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX2_RX_PATH_MIX_CTL,
0x10, 0x00);
/* Remove ANC Rx from reset */
ret = aqt_codec_enable_anc(w, kcontrol, event);
}
- aqt_codec_override(codec, aqt->hph_mode, event);
+ aqt_codec_override(component, aqt->hph_mode, event);
break;
case SND_SOC_DAPM_PRE_PMD:
blocking_notifier_call_chain(&aqt->mbhc->notifier,
AQT_EVENT_PRE_HPHL_PA_OFF,
&aqt->mbhc->wcd_mbhc);
- snd_soc_update_bits(codec, AQT1000_HPH_L_TEST, 0x01, 0x00);
- snd_soc_update_bits(codec, AQT1000_CDC_RX1_RX_PATH_CTL,
- 0x10, 0x10);
- snd_soc_update_bits(codec, AQT1000_CDC_RX1_RX_PATH_MIX_CTL,
- 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ AQT1000_HPH_L_TEST, 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX1_RX_PATH_CTL, 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX1_RX_PATH_MIX_CTL, 0x10, 0x10);
if (!(strcmp(w->name, "AQT ANC HPHL PA")))
- snd_soc_update_bits(codec, AQT1000_ANA_HPH,
- 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_ANA_HPH, 0x80, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
/*
@@ -2445,13 +2575,13 @@
usleep_range(20000, 20100);
else
usleep_range(5000, 5100);
- aqt_codec_override(codec, aqt->hph_mode, event);
+ aqt_codec_override(component, aqt->hph_mode, event);
blocking_notifier_call_chain(&aqt->mbhc->notifier,
AQT_EVENT_POST_HPHL_PA_OFF,
&aqt->mbhc->wcd_mbhc);
if (!(strcmp(w->name, "AQT ANC HPHL PA"))) {
ret = aqt_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_RX1_RX_PATH_CFG0, 0x10, 0x00);
}
break;
@@ -2463,29 +2593,30 @@
static int aqt_codec_set_iir_gain(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s: event = %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event = %d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU: /* fall through */
case SND_SOC_DAPM_PRE_PMD:
if (strnstr(w->name, "AQT IIR0", sizeof("AQT IIR0"))) {
- snd_soc_write(codec,
+ snd_soc_component_write(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
AQT1000_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL));
}
break;
@@ -2496,20 +2627,22 @@
static int aqt_enable_native_supply(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (++aqt->native_clk_users == 1) {
- snd_soc_update_bits(codec, AQT1000_CLK_SYS_PLL_ENABLES,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ AQT1000_CLK_SYS_PLL_ENABLES,
+ 0x01, 0x01);
/* 100usec is needed as per HW requirement */
usleep_range(100, 120);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x02, 0x02);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
0x10, 0x10);
}
@@ -2517,19 +2650,20 @@
case SND_SOC_DAPM_PRE_PMD:
if (aqt->native_clk_users &&
(--aqt->native_clk_users == 0)) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
0x10, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x02, 0x00);
- snd_soc_update_bits(codec, AQT1000_CLK_SYS_PLL_ENABLES,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ AQT1000_CLK_SYS_PLL_ENABLES,
+ 0x01, 0x00);
}
break;
}
- dev_dbg(codec->dev, "%s: native_clk_users: %d, event: %d\n",
+ dev_dbg(component->dev, "%s: native_clk_users: %d, event: %d\n",
__func__, aqt->native_clk_users, event);
return 0;
@@ -2545,17 +2679,18 @@
static int aqt_mclk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
- dev_dbg(codec->dev, "%s: event = %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event = %d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- ret = aqt_cdc_mclk_enable(codec, true);
+ ret = aqt_cdc_mclk_enable(component, true);
break;
case SND_SOC_DAPM_POST_PMD:
- ret = aqt_cdc_mclk_enable(codec, false);
+ ret = aqt_cdc_mclk_enable(component, false);
break;
}
@@ -2774,7 +2909,7 @@
static int aqt_set_decimator_rate(struct snd_soc_dai *dai,
u32 sample_rate)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
u8 tx_fs_rate = 0;
u8 tx_mux_sel = 0, tx0_mux_sel = 0, tx1_mux_sel = 0;
u16 tx_path_ctl_reg = 0;
@@ -2799,27 +2934,30 @@
tx_fs_rate = 6;
break;
default:
- dev_err(codec->dev, "%s: Invalid TX sample rate: %d\n",
+ dev_err(component->dev, "%s: Invalid TX sample rate: %d\n",
__func__, sample_rate);
return -EINVAL;
};
/* Find which decimator path is enabled */
- tx_mux_sel = snd_soc_read(codec, AQT1000_CDC_IF_ROUTER_TX_MUX_CFG0);
+ tx_mux_sel = snd_soc_component_read32(component,
+ AQT1000_CDC_IF_ROUTER_TX_MUX_CFG0);
tx0_mux_sel = (tx_mux_sel & 0x03);
tx1_mux_sel = (tx_mux_sel & 0xC0);
if (tx0_mux_sel) {
tx_path_ctl_reg = AQT1000_CDC_TX0_TX_PATH_CTL +
((tx0_mux_sel - 1) * 16);
- snd_soc_update_bits(codec, tx_path_ctl_reg, 0x0F, tx_fs_rate);
+ snd_soc_component_update_bits(component, tx_path_ctl_reg,
+ 0x0F, tx_fs_rate);
}
if (tx1_mux_sel) {
tx_path_ctl_reg = AQT1000_CDC_TX0_TX_PATH_CTL +
((tx1_mux_sel - 1) * 16);
- snd_soc_update_bits(codec, tx_path_ctl_reg, 0x0F, tx_fs_rate);
+ snd_soc_component_update_bits(component, tx_path_ctl_reg,
+ 0x0F, tx_fs_rate);
}
return 0;
@@ -2828,7 +2966,7 @@
static int aqt_set_interpolator_rate(struct snd_soc_dai *dai,
u32 sample_rate)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
int rate_val = 0;
int i;
@@ -2839,23 +2977,25 @@
}
}
if ((i == ARRAY_SIZE(sr_val_tbl)) || (rate_val < 0)) {
- dev_err(codec->dev, "%s: Unsupported sample rate: %d\n",
+ dev_err(component->dev, "%s: Unsupported sample rate: %d\n",
__func__, sample_rate);
return -EINVAL;
}
/* TODO - Set the rate only to enabled path */
/* Set Primary interpolator rate */
- snd_soc_update_bits(codec, AQT1000_CDC_RX1_RX_PATH_CTL,
+ snd_soc_component_update_bits(component, AQT1000_CDC_RX1_RX_PATH_CTL,
0x0F, (u8)rate_val);
- snd_soc_update_bits(codec, AQT1000_CDC_RX2_RX_PATH_CTL,
+ snd_soc_component_update_bits(component, AQT1000_CDC_RX2_RX_PATH_CTL,
0x0F, (u8)rate_val);
/* Set mixing path interpolator rate */
- snd_soc_update_bits(codec, AQT1000_CDC_RX1_RX_PATH_MIX_CTL,
- 0x0F, (u8)rate_val);
- snd_soc_update_bits(codec, AQT1000_CDC_RX2_RX_PATH_MIX_CTL,
- 0x0F, (u8)rate_val);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX1_RX_PATH_MIX_CTL,
+ 0x0F, (u8)rate_val);
+ snd_soc_component_update_bits(component,
+ AQT1000_CDC_RX2_RX_PATH_MIX_CTL,
+ 0x0F, (u8)rate_val);
return 0;
}
@@ -2872,7 +3012,7 @@
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(dai->codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(dai->component);
int ret = 0;
dev_dbg(aqt->dev, "%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n",
@@ -2973,7 +3113,7 @@
static int aqt_enable_mclk(struct aqt1000 *aqt)
{
- struct snd_soc_codec *codec = aqt->codec;
+ struct snd_soc_component *component = aqt->component;
/* Enable mclk requires master bias to be enabled first */
if (aqt->master_bias_users <= 0) {
@@ -2985,14 +3125,14 @@
if (++aqt->mclk_users == 1) {
/* Set clock div 2 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CLK_SYS_MCLK1_PRG, 0x0C, 0x04);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CLK_SYS_MCLK1_PRG, 0x10, 0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
0x01, 0x01);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x01, 0x01);
/*
@@ -3009,7 +3149,7 @@
static int aqt_disable_mclk(struct aqt1000 *aqt)
{
- struct snd_soc_codec *codec = aqt->codec;
+ struct snd_soc_component *component = aqt->component;
if (aqt->mclk_users <= 0) {
dev_err(aqt->dev, "%s: No mclk users, cannot disable mclk\n",
@@ -3018,37 +3158,41 @@
}
if (--aqt->mclk_users == 0) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x01, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
0x01, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
AQT1000_CLK_SYS_MCLK1_PRG, 0x10, 0x00);
}
- dev_dbg(codec->dev, "%s: mclk_users: %d\n", __func__, aqt->mclk_users);
+ dev_dbg(component->dev, "%s: mclk_users: %d\n", __func__,
+ aqt->mclk_users);
return 0;
}
static int aqt_enable_master_bias(struct aqt1000 *aqt)
{
- struct snd_soc_codec *codec = aqt->codec;
+ struct snd_soc_component *component = aqt->component;
mutex_lock(&aqt->master_bias_lock);
aqt->master_bias_users++;
if (aqt->master_bias_users == 1) {
- snd_soc_update_bits(codec, AQT1000_ANA_BIAS, 0x80, 0x80);
- snd_soc_update_bits(codec, AQT1000_ANA_BIAS, 0x40, 0x40);
+ snd_soc_component_update_bits(component, AQT1000_ANA_BIAS,
+ 0x80, 0x80);
+ snd_soc_component_update_bits(component, AQT1000_ANA_BIAS,
+ 0x40, 0x40);
/*
* 1ms delay is required after pre-charge is enabled
* as per HW requirement
*/
usleep_range(1000, 1100);
- snd_soc_update_bits(codec, AQT1000_ANA_BIAS, 0x40, 0x00);
+ snd_soc_component_update_bits(component, AQT1000_ANA_BIAS,
+ 0x40, 0x00);
}
mutex_unlock(&aqt->master_bias_lock);
@@ -3058,7 +3202,7 @@
static int aqt_disable_master_bias(struct aqt1000 *aqt)
{
- struct snd_soc_codec *codec = aqt->codec;
+ struct snd_soc_component *component = aqt->component;
mutex_lock(&aqt->master_bias_lock);
if (aqt->master_bias_users <= 0) {
@@ -3068,7 +3212,8 @@
aqt->master_bias_users--;
if (aqt->master_bias_users == 0)
- snd_soc_update_bits(codec, AQT1000_ANA_BIAS, 0x80, 0x00);
+ snd_soc_component_update_bits(component, AQT1000_ANA_BIAS,
+ 0x80, 0x00);
mutex_unlock(&aqt->master_bias_lock);
return 0;
@@ -3134,14 +3279,14 @@
/**
* aqt_cdc_mclk_enable - Enable/disable codec mclk
*
- * @codec: codec instance
+ * @component: codec component instance
* @enable: Indicates clk enable or disable
*
* Returns 0 on Success and error on failure
*/
-int aqt_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable)
+int aqt_cdc_mclk_enable(struct snd_soc_component *component, bool enable)
{
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
return __aqt_cdc_mclk_enable(aqt, enable);
}
@@ -3168,11 +3313,11 @@
static int aqt_set_micbias(struct aqt1000 *aqt,
struct aqt1000_pdata *pdata)
{
- struct snd_soc_codec *codec = aqt->codec;
+ struct snd_soc_component *component = aqt->component;
int vout_ctl_1;
if (!pdata) {
- dev_err(codec->dev, "%s: NULL pdata\n", __func__);
+ dev_err(component->dev, "%s: NULL pdata\n", __func__);
return -ENODEV;
}
@@ -3181,7 +3326,8 @@
if (vout_ctl_1 < 0)
return -EINVAL;
- snd_soc_update_bits(codec, AQT1000_ANA_MICB1, 0x3F, vout_ctl_1);
+ snd_soc_component_update_bits(component, AQT1000_ANA_MICB1,
+ 0x3F, vout_ctl_1);
return 0;
}
@@ -3207,7 +3353,7 @@
/*
* aqt_codec_info_create_codec_entry - creates aqt1000 module
* @codec_root: The parent directory
- * @codec: Codec instance
+ * @component: Codec component instance
*
* Creates aqt1000 module and version entry under the given
* parent directory.
@@ -3215,25 +3361,25 @@
* Return: 0 on success or negative error code on failure.
*/
int aqt_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct snd_info_entry *version_entry;
struct aqt1000 *aqt;
struct snd_soc_card *card;
- if (!codec_root || !codec)
+ if (!codec_root || !component)
return -EINVAL;
- aqt = snd_soc_codec_get_drvdata(codec);
+ aqt = snd_soc_component_get_drvdata(component);
if (!aqt) {
- dev_dbg(codec->dev, "%s: aqt is NULL\n", __func__);
+ dev_dbg(component->dev, "%s: aqt is NULL\n", __func__);
return -EINVAL;
}
- card = codec->component.card;
+ card = component->card;
aqt->entry = snd_info_create_subdir(codec_root->module,
"aqt1000", codec_root);
if (!aqt->entry) {
- dev_dbg(codec->dev, "%s: failed to create aqt1000 entry\n",
+ dev_dbg(component->dev, "%s: failed to create aqt1000 entry\n",
__func__);
return -ENOMEM;
}
@@ -3242,7 +3388,7 @@
"version",
aqt->entry);
if (!version_entry) {
- dev_dbg(codec->dev, "%s: failed to create aqt1000 version entry\n",
+ dev_dbg(component->dev, "%s: failed to create aqt1000 version entry\n",
__func__);
return -ENOMEM;
}
@@ -3279,11 +3425,11 @@
static void aqt_codec_init_reg(struct aqt1000 *priv)
{
- struct snd_soc_codec *codec = priv->codec;
+ struct snd_soc_component *component = priv->component;
u32 i;
for (i = 0; i < ARRAY_SIZE(aqt_codec_reg_init); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
aqt_codec_reg_init[i].reg,
aqt_codec_reg_init[i].mask,
aqt_codec_reg_init[i].val);
@@ -3291,26 +3437,29 @@
static void aqt_codec_update_reg(struct aqt1000 *priv)
{
- struct snd_soc_codec *codec = priv->codec;
+ struct snd_soc_component *component = priv->component;
u32 i;
for (i = 0; i < ARRAY_SIZE(aqt_codec_reg_update); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
aqt_codec_reg_update[i].reg,
aqt_codec_reg_update[i].mask,
aqt_codec_reg_update[i].val);
}
-static int aqt_soc_codec_probe(struct snd_soc_codec *codec)
+static int aqt_soc_codec_probe(struct snd_soc_component *component)
{
struct aqt1000 *aqt;
struct aqt1000_pdata *pdata;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
int i, ret = 0;
- dev_dbg(codec->dev, "%s()\n", __func__);
- aqt = snd_soc_codec_get_drvdata(codec);
+ dev_dbg(component->dev, "%s()\n", __func__);
+ aqt = snd_soc_component_get_drvdata(component);
+
+ snd_soc_component_init_regmap(component, aqt->regmap);
mutex_init(&aqt->codec_mutex);
mutex_init(&aqt->i2s_lock);
@@ -3319,7 +3468,7 @@
/* Default HPH Mode to Class-H Low HiFi */
aqt->hph_mode = CLS_H_LOHIFI;
- aqt->fw_data = devm_kzalloc(codec->dev, sizeof(*(aqt->fw_data)),
+ aqt->fw_data = devm_kzalloc(component->dev, sizeof(*(aqt->fw_data)),
GFP_KERNEL);
if (!aqt->fw_data)
goto err;
@@ -3336,39 +3485,40 @@
}
ret = wcd_cal_create_hwdep(aqt->fw_data,
- AQT1000_CODEC_HWDEP_NODE, codec);
+ AQT1000_CODEC_HWDEP_NODE, component);
if (ret < 0) {
- dev_err(codec->dev, "%s hwdep failed %d\n", __func__, ret);
+ dev_err(component->dev, "%s hwdep failed %d\n", __func__, ret);
goto err_hwdep;
}
/* Initialize MBHC module */
- ret = aqt_mbhc_init(&aqt->mbhc, codec, aqt->fw_data);
+ ret = aqt_mbhc_init(&aqt->mbhc, component, aqt->fw_data);
if (ret) {
pr_err("%s: mbhc initialization failed\n", __func__);
goto err_hwdep;
}
- aqt->codec = codec;
+ aqt->component = component;
for (i = 0; i < COMPANDER_MAX; i++)
aqt->comp_enabled[i] = 0;
- aqt_cdc_mclk_enable(codec, true);
+ aqt_cdc_mclk_enable(component, true);
aqt_codec_init_reg(aqt);
- aqt_cdc_mclk_enable(codec, false);
+ aqt_cdc_mclk_enable(component, false);
/* Add 100usec delay as per HW requirement */
usleep_range(100, 110);
aqt_codec_update_reg(aqt);
- pdata = dev_get_platdata(codec->dev);
+ pdata = dev_get_platdata(component->dev);
/* If 1.8v is supplied externally, then disable internal 1.8v supply */
for (i = 0; i < pdata->num_supplies; i++) {
if (!strcmp(pdata->regulator->name, "aqt_vdd1p8")) {
- snd_soc_update_bits(codec, AQT1000_BUCK_5V_EN_CTL,
- 0x03, 0x00);
- dev_dbg(codec->dev, "%s: Disabled internal supply\n",
+ snd_soc_component_update_bits(component,
+ AQT1000_BUCK_5V_EN_CTL,
+ 0x03, 0x00);
+ dev_dbg(component->dev, "%s: Disabled internal supply\n",
__func__);
break;
}
@@ -3413,7 +3563,7 @@
err_hwdep:
clk_put(aqt->ext_clk);
err_clk:
- devm_kfree(codec->dev, aqt->fw_data);
+ devm_kfree(component->dev, aqt->fw_data);
aqt->fw_data = NULL;
err:
mutex_destroy(&aqt->i2s_lock);
@@ -3421,39 +3571,30 @@
return ret;
}
-static int aqt_soc_codec_remove(struct snd_soc_codec *codec)
+static void aqt_soc_codec_remove(struct snd_soc_component *component)
{
- struct aqt1000 *aqt = snd_soc_codec_get_drvdata(codec);
+ struct aqt1000 *aqt = snd_soc_component_get_drvdata(component);
/* Deinitialize MBHC module */
- aqt_mbhc_deinit(codec);
+ aqt_mbhc_deinit(component);
aqt->mbhc = NULL;
mutex_destroy(&aqt->i2s_lock);
mutex_destroy(&aqt->codec_mutex);
clk_put(aqt->ext_clk);
- return 0;
+ return;
}
-static struct regmap *aqt_get_regmap(struct device *dev)
-{
- struct aqt1000 *control = dev_get_drvdata(dev);
-
- return control->regmap;
-}
-
-struct snd_soc_codec_driver snd_cdc_dev_aqt = {
+static const struct snd_soc_component_driver snd_cdc_dev_aqt = {
+ .name = DRV_NAME,
.probe = aqt_soc_codec_probe,
.remove = aqt_soc_codec_remove,
- .get_regmap = aqt_get_regmap,
- .component_driver = {
- .controls = aqt_snd_controls,
- .num_controls = ARRAY_SIZE(aqt_snd_controls),
- .dapm_widgets = aqt_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(aqt_dapm_widgets),
- .dapm_routes = aqt_audio_map,
- .num_dapm_routes = ARRAY_SIZE(aqt_audio_map),
- },
+ .controls = aqt_snd_controls,
+ .num_controls = ARRAY_SIZE(aqt_snd_controls),
+ .dapm_widgets = aqt_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(aqt_dapm_widgets),
+ .dapm_routes = aqt_audio_map,
+ .num_dapm_routes = ARRAY_SIZE(aqt_audio_map),
};
/*
@@ -3464,7 +3605,7 @@
*/
int aqt_register_codec(struct device *dev)
{
- return snd_soc_register_codec(dev, &snd_cdc_dev_aqt, aqt_dai,
+ return snd_soc_register_component(dev, &snd_cdc_dev_aqt, aqt_dai,
ARRAY_SIZE(aqt_dai));
}
EXPORT_SYMBOL(aqt_register_codec);
diff --git a/asoc/codecs/aqt1000/aqt1000.h b/asoc/codecs/aqt1000/aqt1000.h
index 7b870db..6148213 100644
--- a/asoc/codecs/aqt1000/aqt1000.h
+++ b/asoc/codecs/aqt1000/aqt1000.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef AQT1000_H
@@ -153,7 +145,7 @@
u32 mclk_rate;
struct regmap *regmap;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
bool dev_up;
bool prev_pg_valid;
u8 prev_pg;
diff --git a/asoc/codecs/aqt1000/pdata.h b/asoc/codecs/aqt1000/pdata.h
index 2c29848..89fcb3c 100644
--- a/asoc/codecs/aqt1000/pdata.h
+++ b/asoc/codecs/aqt1000/pdata.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _AQT1000_PDATA_H_
diff --git a/asoc/codecs/audio-ext-clk-up.c b/asoc/codecs/audio-ext-clk-up.c
index ba72fd8..74ab9e2 100644
--- a/asoc/codecs/audio-ext-clk-up.c
+++ b/asoc/codecs/audio-ext-clk-up.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
@@ -18,6 +10,7 @@
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include "../../../drivers/clk/qcom/common.h"
+#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <dt-bindings/clock/qcom,audio-ext-clk.h>
#include <dsp/q6afe-v2.h>
diff --git a/asoc/codecs/audio-ext-clk-up.h b/asoc/codecs/audio-ext-clk-up.h
index 8a0232e..6551897 100644
--- a/asoc/codecs/audio-ext-clk-up.h
+++ b/asoc/codecs/audio-ext-clk-up.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __AUDIO_EXT_CLK_UP_H_
diff --git a/asoc/codecs/audio-ext-clk.c b/asoc/codecs/audio-ext-clk.c
index 72f16f5..c06c9c5 100644
--- a/asoc/codecs/audio-ext-clk.c
+++ b/asoc/codecs/audio-ext-clk.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/asoc/codecs/bolero/bolero-cdc-registers.h b/asoc/codecs/bolero/bolero-cdc-registers.h
index d413ff9..5f88c85 100644
--- a/asoc/codecs/bolero/bolero-cdc-registers.h
+++ b/asoc/codecs/bolero/bolero-cdc-registers.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _BOLERO_CDC_REGISTERS_H
diff --git a/asoc/codecs/bolero/bolero-cdc-regmap.c b/asoc/codecs/bolero/bolero-cdc-regmap.c
index ecc1324..8f55ff2 100644
--- a/asoc/codecs/bolero/bolero-cdc-regmap.c
+++ b/asoc/codecs/bolero/bolero-cdc-regmap.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/regmap.h>
diff --git a/asoc/codecs/bolero/bolero-cdc-tables.c b/asoc/codecs/bolero/bolero-cdc-tables.c
index 2407ac7..e92508f 100644
--- a/asoc/codecs/bolero/bolero-cdc-tables.c
+++ b/asoc/codecs/bolero/bolero-cdc-tables.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/types.h>
diff --git a/asoc/codecs/bolero/bolero-cdc-utils.c b/asoc/codecs/bolero/bolero-cdc-utils.c
index b7f4142..6acf69e 100644
--- a/asoc/codecs/bolero/bolero-cdc-utils.c
+++ b/asoc/codecs/bolero/bolero-cdc-utils.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/asoc/codecs/bolero/bolero-cdc.c b/asoc/codecs/bolero/bolero-cdc.c
index 68a7ff5..2d63c43 100644
--- a/asoc/codecs/bolero/bolero-cdc.c
+++ b/asoc/codecs/bolero/bolero-cdc.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/of_platform.h>
@@ -24,13 +16,15 @@
#include "bolero-cdc.h"
#include "internal.h"
+#define DRV_NAME "bolero_codec"
+
#define BOLERO_VERSION_1_0 0x0001
#define BOLERO_VERSION_1_1 0x0002
#define BOLERO_VERSION_1_2 0x0003
#define BOLERO_VERSION_ENTRY_SIZE 32
#define BOLERO_CDC_STRING_LEN 80
-static struct snd_soc_codec_driver bolero;
+static const struct snd_soc_component_driver bolero;
/* pm runtime auto suspend timer in msecs */
#define BOLERO_AUTO_SUSPEND_DELAY 100 /* delay in msec */
@@ -153,17 +147,20 @@
switch (event) {
case WCD_BOLERO_EVT_RX_MUTE:
if (priv->macro_params[RX_MACRO].event_handler)
- priv->macro_params[RX_MACRO].event_handler(priv->codec,
+ priv->macro_params[RX_MACRO].event_handler(
+ priv->component,
BOLERO_MACRO_EVT_RX_MUTE, data);
break;
case WCD_BOLERO_EVT_IMPED_TRUE:
if (priv->macro_params[RX_MACRO].event_handler)
- priv->macro_params[RX_MACRO].event_handler(priv->codec,
+ priv->macro_params[RX_MACRO].event_handler(
+ priv->component,
BOLERO_MACRO_EVT_IMPED_TRUE, data);
break;
case WCD_BOLERO_EVT_IMPED_FALSE:
if (priv->macro_params[RX_MACRO].event_handler)
- priv->macro_params[RX_MACRO].event_handler(priv->codec,
+ priv->macro_params[RX_MACRO].event_handler(
+ priv->component,
BOLERO_MACRO_EVT_IMPED_FALSE, data);
break;
default:
@@ -375,7 +372,7 @@
bolero_mclk_mux_tbl[VA_MACRO][MCLK_MUX0] = VA_MACRO;
priv->current_mclk_mux_macro[VA_MACRO] = VA_MACRO;
}
- ret = snd_soc_register_codec(dev->parent, &bolero,
+ ret = snd_soc_register_component(dev->parent, &bolero,
priv->bolero_dais, priv->num_dais);
if (ret < 0) {
dev_err(dev, "%s: register codec failed\n", __func__);
@@ -426,7 +423,7 @@
/* UNREGISTER CODEC HERE */
if (priv->num_macros - 1 == priv->num_macros_registered)
- snd_soc_unregister_codec(dev->parent);
+ snd_soc_unregister_component(dev->parent);
}
EXPORT_SYMBOL(bolero_unregister_macro);
@@ -576,7 +573,8 @@
}
if (priv->macro_params[VA_MACRO].event_handler)
- priv->macro_params[VA_MACRO].event_handler(priv->codec,
+ priv->macro_params[VA_MACRO].event_handler(
+ priv->component,
BOLERO_MACRO_EVT_WAIT_VA_CLK_RESET, 0x0);
regcache_cache_only(priv->regmap, false);
@@ -584,7 +582,8 @@
for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) {
if (!priv->macro_params[macro_idx].event_handler)
continue;
- priv->macro_params[macro_idx].event_handler(priv->codec,
+ priv->macro_params[macro_idx].event_handler(
+ priv->component,
BOLERO_MACRO_EVT_SSR_UP, 0x0);
}
mutex_lock(&priv->clk_lock);
@@ -609,7 +608,8 @@
for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) {
if (!priv->macro_params[macro_idx].event_handler)
continue;
- priv->macro_params[macro_idx].event_handler(priv->codec,
+ priv->macro_params[macro_idx].event_handler(
+ priv->component,
BOLERO_MACRO_EVT_SSR_DOWN, 0x0);
}
bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_SSR_DOWN);
@@ -627,7 +627,7 @@
/*
* bolero_info_create_codec_entry - creates bolero module
* @codec_root: The parent directory
- * @codec: Codec instance
+ * @component: Codec component instance
*
* Creates bolero module and version entry under the given
* parent directory.
@@ -635,26 +635,26 @@
* Return: 0 on success or negative error code on failure.
*/
int bolero_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct snd_info_entry *version_entry;
struct bolero_priv *priv;
struct snd_soc_card *card;
- if (!codec_root || !codec)
+ if (!codec_root || !component)
return -EINVAL;
- priv = snd_soc_codec_get_drvdata(codec);
+ priv = snd_soc_component_get_drvdata(component);
if (priv->entry) {
dev_dbg(priv->dev,
"%s:bolero module already created\n", __func__);
return 0;
}
- card = codec->component.card;
+ card = component->card;
priv->entry = snd_info_create_subdir(codec_root->module,
"bolero", codec_root);
if (!priv->entry) {
- dev_dbg(codec->dev, "%s: failed to create bolero entry\n",
+ dev_dbg(component->dev, "%s: failed to create bolero entry\n",
__func__);
return -ENOMEM;
}
@@ -662,7 +662,7 @@
"version",
priv->entry);
if (!version_entry) {
- dev_err(codec->dev, "%s: failed to create bolero version entry\n",
+ dev_err(component->dev, "%s: failed to create bolero version entry\n",
__func__);
return -ENOMEM;
}
@@ -685,52 +685,56 @@
/**
* bolero_register_wake_irq - Register wake irq of Tx macro
*
- * @codec: codec ptr.
+ * @component: codec component ptr.
* @ipc_wakeup: bool to identify ipc_wakeup to be used or HW interrupt line.
*
* Return: 0 on success or negative error code on failure.
*/
-int bolero_register_wake_irq(struct snd_soc_codec *codec, u32 ipc_wakeup)
+int bolero_register_wake_irq(struct snd_soc_component *component,
+ u32 ipc_wakeup)
{
struct bolero_priv *priv = NULL;
- if (!codec)
+ if (!component)
return -EINVAL;
- priv = snd_soc_codec_get_drvdata(codec);
+ priv = snd_soc_component_get_drvdata(component);
if (!priv)
return -EINVAL;
if (!bolero_is_valid_codec_dev(priv->dev)) {
- dev_err(codec->dev, "%s: invalid codec\n", __func__);
+ dev_err(component->dev, "%s: invalid codec\n", __func__);
return -EINVAL;
}
if (priv->macro_params[TX_MACRO].reg_wake_irq)
- priv->macro_params[TX_MACRO].reg_wake_irq(codec, ipc_wakeup);
+ priv->macro_params[TX_MACRO].reg_wake_irq(
+ component, ipc_wakeup);
return 0;
}
EXPORT_SYMBOL(bolero_register_wake_irq);
-static int bolero_soc_codec_probe(struct snd_soc_codec *codec)
+static int bolero_soc_codec_probe(struct snd_soc_component *component)
{
- struct bolero_priv *priv = dev_get_drvdata(codec->dev);
+ struct bolero_priv *priv = dev_get_drvdata(component->dev);
int macro_idx, ret = 0;
+ snd_soc_component_init_regmap(component, priv->regmap);
+
/* call init for supported macros */
for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) {
if (priv->macro_params[macro_idx].init) {
- ret = priv->macro_params[macro_idx].init(codec);
+ ret = priv->macro_params[macro_idx].init(component);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: init for macro %d failed\n",
__func__, macro_idx);
goto err;
}
}
}
- priv->codec = codec;
+ priv->component = component;
/*
* In order for the ADIE RTC to differentiate between targets
* version info is used.
@@ -749,42 +753,36 @@
if (!ret) {
snd_event_notify(priv->dev, SND_EVENT_UP);
} else {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Registration with SND event FWK failed ret = %d\n",
__func__, ret);
goto err;
}
- dev_dbg(codec->dev, "%s: bolero soc codec probe success\n", __func__);
+ dev_dbg(component->dev, "%s: bolero soc codec probe success\n",
+ __func__);
err:
return ret;
}
-static int bolero_soc_codec_remove(struct snd_soc_codec *codec)
+static void bolero_soc_codec_remove(struct snd_soc_component *component)
{
- struct bolero_priv *priv = dev_get_drvdata(codec->dev);
+ struct bolero_priv *priv = dev_get_drvdata(component->dev);
int macro_idx;
snd_event_client_deregister(priv->dev);
/* call exit for supported macros */
for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++)
if (priv->macro_params[macro_idx].exit)
- priv->macro_params[macro_idx].exit(codec);
+ priv->macro_params[macro_idx].exit(component);
- return 0;
+ return;
}
-static struct regmap *bolero_get_regmap(struct device *dev)
-{
- struct bolero_priv *priv = dev_get_drvdata(dev);
-
- return priv->regmap;
-}
-
-static struct snd_soc_codec_driver bolero = {
+static const struct snd_soc_component_driver bolero = {
+ .name = DRV_NAME,
.probe = bolero_soc_codec_probe,
.remove = bolero_soc_codec_remove,
- .get_regmap = bolero_get_regmap,
};
static void bolero_add_child_devices(struct work_struct *work)
diff --git a/asoc/codecs/bolero/bolero-cdc.h b/asoc/codecs/bolero/bolero-cdc.h
index a00c065..386fa62 100644
--- a/asoc/codecs/bolero/bolero-cdc.h
+++ b/asoc/codecs/bolero/bolero-cdc.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef BOLERO_CDC_H
@@ -50,15 +42,15 @@
};
struct macro_ops {
- int (*init)(struct snd_soc_codec *codec);
- int (*exit)(struct snd_soc_codec *codec);
+ int (*init)(struct snd_soc_component *component);
+ int (*exit)(struct snd_soc_component *component);
u16 num_dais;
struct device *dev;
struct snd_soc_dai_driver *dai_ptr;
int (*mclk_fn)(struct device *dev, bool enable);
- int (*event_handler)(struct snd_soc_codec *codec, u16 event,
+ int (*event_handler)(struct snd_soc_component *component, u16 event,
u32 data);
- int (*reg_wake_irq)(struct snd_soc_codec *codec, u32 data);
+ int (*reg_wake_irq)(struct snd_soc_component *component, u32 data);
char __iomem *io_base;
};
@@ -72,8 +64,8 @@
bool enable);
int bolero_info_create_codec_entry(
struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
-int bolero_register_wake_irq(struct snd_soc_codec *codec, u32 data);
+ struct snd_soc_component *component);
+int bolero_register_wake_irq(struct snd_soc_component *component, u32 data);
void bolero_clear_amic_tx_hold(struct device *dev, u16 adc_n);
int bolero_runtime_resume(struct device *dev);
int bolero_runtime_suspend(struct device *dev);
@@ -104,7 +96,7 @@
static int bolero_info_create_codec_entry(
struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return 0;
}
@@ -113,7 +105,7 @@
{
}
-static inline int bolero_register_wake_irq(struct snd_soc_codec *codec,
+static inline int bolero_register_wake_irq(struct snd_soc_component *component,
u32 data)
static inline int bolero_runtime_resume(struct device *dev)
{
diff --git a/asoc/codecs/bolero/internal.h b/asoc/codecs/bolero/internal.h
index 71750fb..be00482 100644
--- a/asoc/codecs/bolero/internal.h
+++ b/asoc/codecs/bolero/internal.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _BOLERO_INTERNAL_H
@@ -49,7 +41,7 @@
struct bolero_priv {
struct device *dev;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct regmap *regmap;
struct mutex io_lock;
struct mutex clk_lock;
diff --git a/asoc/codecs/bolero/rx-macro.c b/asoc/codecs/bolero/rx-macro.c
index 8aca6fd..75a3a0a 100644
--- a/asoc/codecs/bolero/rx-macro.c
+++ b/asoc/codecs/bolero/rx-macro.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -279,7 +271,7 @@
struct snd_ctl_elem_value *ucontrol);
static int rx_macro_mux_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
-static int rx_macro_enable_interp_clk(struct snd_soc_codec *codec,
+static int rx_macro_enable_interp_clk(struct snd_soc_component *component,
int event, int interp_idx);
/* Hold instance to soundwire platform device */
@@ -328,7 +320,7 @@
* @rx_swr_gpio_p: used by pinctrl API
* @rx_core_clk: MCLK for rx macro
* @rx_npl_clk: NPL clock for RX soundwire
- * @codec: codec handle
+ * @component: codec handle
*/
struct rx_macro_priv {
struct device *dev;
@@ -355,7 +347,7 @@
struct device_node *rx_swr_gpio_p;
struct clk *rx_core_clk;
struct clk *rx_npl_clk;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
unsigned long active_ch_mask[RX_MACRO_MAX_DAIS];
unsigned long active_ch_cnt[RX_MACRO_MAX_DAIS];
u16 bit_width[RX_MACRO_MAX_DAIS];
@@ -639,11 +631,11 @@
* This function updates HPHL and HPHR gain settings
* according to the impedance value.
*
- * @codec: codec pointer handle
+ * @component: codec pointer handle
* @imped: impedance value of HPHL/R
* @reset: bool variable to reset registers when teardown
*/
-static void rx_macro_wcd_clsh_imped_config(struct snd_soc_codec *codec,
+static void rx_macro_wcd_clsh_imped_config(struct snd_soc_component *component,
int imped, bool reset)
{
int i;
@@ -658,7 +650,7 @@
/* reset = 1, which means request is to reset the register values */
if (reset) {
for (i = 0; i < MAX_IMPED_PARAMS; i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
imped_table_ptr[index][i].reg,
imped_table_ptr[index][i].mask, 0);
return;
@@ -674,34 +666,34 @@
return;
}
for (i = 0; i < MAX_IMPED_PARAMS; i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
imped_table_ptr[index][i].reg,
imped_table_ptr[index][i].mask,
imped_table_ptr[index][i].val);
}
-static bool rx_macro_get_data(struct snd_soc_codec *codec,
+static bool rx_macro_get_data(struct snd_soc_component *component,
struct device **rx_dev,
struct rx_macro_priv **rx_priv,
const char *func_name)
{
- *rx_dev = bolero_get_device_ptr(codec->dev, RX_MACRO);
+ *rx_dev = bolero_get_device_ptr(component->dev, RX_MACRO);
if (!(*rx_dev)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: null device for macro!\n", func_name);
return false;
}
*rx_priv = dev_get_drvdata((*rx_dev));
if (!(*rx_priv)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: priv is null for macro!\n", func_name);
return false;
}
- if (!(*rx_priv)->codec) {
- dev_err(codec->dev,
+ if (!(*rx_priv)->component) {
+ dev_err(component->dev,
"%s: tx_priv codec is not initialized!\n", func_name);
return false;
}
@@ -714,7 +706,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val = 0;
unsigned short look_ahead_dly_reg =
@@ -724,7 +717,7 @@
if (val >= e->items)
return -EINVAL;
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: wname: %s, val: 0x%x\n", __func__,
widget->name, val);
if (e->reg == BOLERO_CDC_RX_RX0_RX_PATH_CFG1)
@@ -733,7 +726,7 @@
look_ahead_dly_reg = BOLERO_CDC_RX_RX1_RX_PATH_CFG0;
/* Set Look Ahead Delay */
- snd_soc_update_bits(codec, look_ahead_dly_reg,
+ snd_soc_component_update_bits(component, look_ahead_dly_reg,
0x08, (val ? 0x08 : 0x00));
/* Set DEM INP Select */
return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
@@ -749,11 +742,11 @@
u16 int_fs_reg = 0;
u8 int_mux_cfg0_val = 0, int_mux_cfg1_val = 0;
u8 inp0_sel = 0, inp1_sel = 0, inp2_sel = 0;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
for_each_set_bit(port, &rx_priv->active_ch_mask[dai->id],
@@ -776,8 +769,10 @@
for (j = 0; j < INTERP_MAX; j++) {
int_mux_cfg1 = int_mux_cfg0 + 4;
- int_mux_cfg0_val = snd_soc_read(codec, int_mux_cfg0);
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1);
+ int_mux_cfg0_val = snd_soc_component_read32(
+ component, int_mux_cfg0);
+ int_mux_cfg1_val = snd_soc_component_read32(
+ component, int_mux_cfg1);
inp0_sel = int_mux_cfg0_val & 0x07;
inp1_sel = (int_mux_cfg0_val >> 4) & 0x038;
inp2_sel = (int_mux_cfg1_val >> 4) & 0x038;
@@ -791,7 +786,8 @@
pr_debug("%s: set INT%u_1 sample rate to %u\n",
__func__, j, sample_rate);
/* sample_rate is in Hz */
- snd_soc_update_bits(codec, int_fs_reg,
+ snd_soc_component_update_bits(component,
+ int_fs_reg,
0x0F, rate_reg_val);
}
int_mux_cfg0 += 8;
@@ -809,11 +805,11 @@
u32 j = 0, port = 0;
u16 int_mux_cfg1 = 0, int_fs_reg = 0;
u8 int_mux_cfg1_val = 0;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
for_each_set_bit(port, &rx_priv->active_ch_mask[dai->id],
@@ -828,7 +824,8 @@
int_mux_cfg1 = BOLERO_CDC_RX_INP_MUX_RX_INT0_CFG1;
for (j = 0; j < INTERP_MAX; j++) {
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1) &
+ int_mux_cfg1_val = snd_soc_component_read32(
+ component, int_mux_cfg1) &
0x07;
if (int_mux_cfg1_val == int_2_inp) {
int_fs_reg = BOLERO_CDC_RX_RX0_RX_PATH_MIX_CTL +
@@ -837,7 +834,8 @@
__func__, dai->id, j);
pr_debug("%s: set INT%u_2 sample rate to %u\n",
__func__, j, sample_rate);
- snd_soc_update_bits(codec, int_fs_reg,
+ snd_soc_component_update_bits(
+ component, int_fs_reg,
0x0F, rate_reg_val);
}
int_mux_cfg1 += 8;
@@ -863,13 +861,13 @@
static int rx_macro_set_interpolator_rate(struct snd_soc_dai *dai,
u32 sample_rate)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
int rate_val = 0;
int i = 0, ret = 0;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
@@ -884,7 +882,7 @@
}
}
if ((i == ARRAY_SIZE(sr_val_tbl)) || (rate_val < 0)) {
- dev_err(codec->dev, "%s: Unsupported sample rate: %d\n",
+ dev_err(component->dev, "%s: Unsupported sample rate: %d\n",
__func__, sample_rate);
return -EINVAL;
}
@@ -903,15 +901,15 @@
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
int ret = 0;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n", __func__,
dai->name, dai->id, params_rate(params),
params_channels(params));
@@ -937,13 +935,13 @@
unsigned int *tx_num, unsigned int *tx_slot,
unsigned int *rx_num, unsigned int *rx_slot)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
unsigned int temp = 0, ch_mask = 0;
u16 i = 0;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
switch (dai->id) {
@@ -1039,13 +1037,14 @@
static int rx_macro_mclk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
int mclk_freq = MCLK_FREQ;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
dev_dbg(rx_dev, "%s: event = %d\n", __func__, event);
@@ -1119,14 +1118,14 @@
return 0;
}
-static int rx_macro_event_handler(struct snd_soc_codec *codec, u16 event,
- u32 data)
+static int rx_macro_event_handler(struct snd_soc_component *component,
+ u16 event, u32 data)
{
u16 reg = 0, reg_mix = 0, rx_idx = 0, mute = 0x0, val = 0;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
switch (event) {
@@ -1138,14 +1137,16 @@
RX_MACRO_RX_PATH_OFFSET);
reg_mix = BOLERO_CDC_RX_RX0_RX_PATH_MIX_CTL + (rx_idx *
RX_MACRO_RX_PATH_OFFSET);
- snd_soc_update_bits(codec, reg, 0x10, val);
- snd_soc_update_bits(codec, reg_mix, 0x10, val);
+ snd_soc_component_update_bits(component, reg,
+ 0x10, val);
+ snd_soc_component_update_bits(component, reg_mix,
+ 0x10, val);
break;
case BOLERO_MACRO_EVT_IMPED_TRUE:
- rx_macro_wcd_clsh_imped_config(codec, data, true);
+ rx_macro_wcd_clsh_imped_config(component, data, true);
break;
case BOLERO_MACRO_EVT_IMPED_FALSE:
- rx_macro_wcd_clsh_imped_config(codec, data, false);
+ rx_macro_wcd_clsh_imped_config(component, data, false);
break;
case BOLERO_MACRO_EVT_SSR_DOWN:
rx_priv->dev_up = false;
@@ -1184,7 +1185,7 @@
return -EINVAL;
}
-static int rx_macro_set_idle_detect_thr(struct snd_soc_codec *codec,
+static int rx_macro_set_idle_detect_thr(struct snd_soc_component *component,
struct rx_macro_priv *rx_priv,
int interp, int path_type)
{
@@ -1212,7 +1213,8 @@
if (path_type == INTERP_MIX_PATH) {
mux_reg = BOLERO_CDC_RX_INP_MUX_RX_INT0_CFG1 +
2 * interp;
- mux_reg_val = snd_soc_read(codec, mux_reg) & 0x0f;
+ mux_reg_val = snd_soc_component_read32(component, mux_reg) &
+ 0x0f;
if ((mux_reg_val >= INTn_2_INP_SEL_RX0) &&
(mux_reg_val <= INTn_2_INP_SEL_RX5)) {
@@ -1224,7 +1226,8 @@
if (path_type == INTERP_MAIN_PATH) {
mux_reg = BOLERO_CDC_RX_INP_MUX_RX_INT1_CFG0 +
2 * (interp - 1);
- mux_reg_val = snd_soc_read(codec, mux_reg) & 0x0f;
+ mux_reg_val = snd_soc_component_read32(component, mux_reg) &
+ 0x0f;
i = RX_MACRO_INTERP_MUX_NUM_INPUTS;
while (i) {
@@ -1234,14 +1237,15 @@
INTn_1_INP_SEL_RX0;
num_ports++;
}
- mux_reg_val = (snd_soc_read(codec, mux_reg) &
- 0xf0) >> 4;
+ mux_reg_val =
+ (snd_soc_component_read32(component, mux_reg) &
+ 0xf0) >> 4;
mux_reg += 1;
i--;
}
}
- dev_dbg(codec->dev, "%s: num_ports: %d, ports[%d %d %d %d]\n",
+ dev_dbg(component->dev, "%s: num_ports: %d, ports[%d %d %d %d]\n",
__func__, num_ports, port_id[0], port_id[1],
port_id[2], port_id[3]);
@@ -1251,7 +1255,7 @@
rx_priv);
if ((dai_id >= 0) && (dai_id < RX_MACRO_MAX_DAIS)) {
- dev_dbg(codec->dev, "%s: dai_id: %d bit_width: %d\n",
+ dev_dbg(component->dev, "%s: dai_id: %d bit_width: %d\n",
__func__, dai_id,
rx_priv->bit_width[dai_id]);
@@ -1274,12 +1278,13 @@
break;
}
- dev_dbg(codec->dev, "%s: (new) idle_thr: %d, (cur) idle_thr: %d\n",
+ dev_dbg(component->dev, "%s: (new) idle_thr: %d, (cur) idle_thr: %d\n",
__func__, idle_thr, rx_priv->idle_det_cfg.hph_idle_thr);
if ((rx_priv->idle_det_cfg.hph_idle_thr == 0) ||
(idle_thr < rx_priv->idle_det_cfg.hph_idle_thr)) {
- snd_soc_write(codec, BOLERO_CDC_RX_IDLE_DETECT_CFG3, idle_thr);
+ snd_soc_component_write(component,
+ BOLERO_CDC_RX_IDLE_DETECT_CFG3, idle_thr);
rx_priv->idle_det_cfg.hph_idle_thr = idle_thr;
}
@@ -1289,16 +1294,17 @@
static int rx_macro_enable_mix_path(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 gain_reg = 0, mix_reg = 0;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
if (w->shift >= INTERP_MAX) {
- dev_err(codec->dev, "%s: Invalid Interpolator value %d for name %s\n",
+ dev_err(component->dev, "%s: Invalid Interpolator value %d for name %s\n",
__func__, w->shift, w->name);
return -EINVAL;
}
@@ -1308,27 +1314,27 @@
mix_reg = BOLERO_CDC_RX_RX0_RX_PATH_MIX_CTL +
(w->shift * RX_MACRO_RX_PATH_OFFSET);
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s %d %s\n", __func__, event, w->name);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- rx_macro_set_idle_detect_thr(codec, rx_priv, w->shift,
+ rx_macro_set_idle_detect_thr(component, rx_priv, w->shift,
INTERP_MIX_PATH);
- rx_macro_enable_interp_clk(codec, event, w->shift);
+ rx_macro_enable_interp_clk(component, event, w->shift);
/* Clk enable */
- snd_soc_update_bits(codec, mix_reg, 0x20, 0x20);
+ snd_soc_component_update_bits(component, mix_reg, 0x20, 0x20);
break;
case SND_SOC_DAPM_POST_PMU:
- snd_soc_write(codec, gain_reg,
- snd_soc_read(codec, gain_reg));
+ snd_soc_component_write(component, gain_reg,
+ snd_soc_component_read32(component, gain_reg));
break;
case SND_SOC_DAPM_POST_PMD:
/* Clk Disable */
- snd_soc_update_bits(codec, mix_reg, 0x20, 0x00);
- rx_macro_enable_interp_clk(codec, event, w->shift);
+ snd_soc_component_update_bits(component, mix_reg, 0x20, 0x00);
+ rx_macro_enable_interp_clk(component, event, w->shift);
/* Reset enable and disable */
- snd_soc_update_bits(codec, mix_reg, 0x40, 0x40);
- snd_soc_update_bits(codec, mix_reg, 0x40, 0x00);
+ snd_soc_component_update_bits(component, mix_reg, 0x40, 0x40);
+ snd_soc_component_update_bits(component, mix_reg, 0x40, 0x00);
break;
}
@@ -1339,19 +1345,20 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 gain_reg = 0;
u16 reg = 0;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s %d %s\n", __func__, event, w->name);
if (w->shift >= INTERP_MAX) {
- dev_err(codec->dev, "%s: Invalid Interpolator value %d for name %s\n",
+ dev_err(component->dev, "%s: Invalid Interpolator value %d for name %s\n",
__func__, w->shift, w->name);
return -EINVAL;
}
@@ -1363,23 +1370,23 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- rx_macro_set_idle_detect_thr(codec, rx_priv, w->shift,
+ rx_macro_set_idle_detect_thr(component, rx_priv, w->shift,
INTERP_MAIN_PATH);
- rx_macro_enable_interp_clk(codec, event, w->shift);
+ rx_macro_enable_interp_clk(component, event, w->shift);
break;
case SND_SOC_DAPM_POST_PMU:
- snd_soc_write(codec, gain_reg,
- snd_soc_read(codec, gain_reg));
+ snd_soc_component_write(component, gain_reg,
+ snd_soc_component_read32(component, gain_reg));
break;
case SND_SOC_DAPM_POST_PMD:
- rx_macro_enable_interp_clk(codec, event, w->shift);
+ rx_macro_enable_interp_clk(component, event, w->shift);
break;
}
return 0;
}
-static int rx_macro_config_compander(struct snd_soc_codec *codec,
+static int rx_macro_config_compander(struct snd_soc_component *component,
struct rx_macro_priv *rx_priv,
int interp_n, int event)
{
@@ -1391,7 +1398,7 @@
return 0;
comp = interp_n;
- dev_dbg(codec->dev, "%s: event %d compander %d, enabled %d\n",
+ dev_dbg(component->dev, "%s: event %d compander %d, enabled %d\n",
__func__, event, comp + 1, rx_priv->comp_enabled[comp]);
if (!rx_priv->comp_enabled[comp])
@@ -1404,46 +1411,54 @@
if (SND_SOC_DAPM_EVENT_ON(event)) {
/* Enable Compander Clock */
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, rx_path_cfg0_reg,
+ 0x02, 0x02);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x04);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component, rx_path_cfg0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x04, 0x00);
}
return 0;
}
-static void rx_macro_enable_softclip_clk(struct snd_soc_codec *codec,
+static void rx_macro_enable_softclip_clk(struct snd_soc_component *component,
struct rx_macro_priv *rx_priv,
bool enable)
{
if (enable) {
if (rx_priv->softclip_clk_users == 0)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_SOFTCLIP_CRC,
0x01, 0x01);
rx_priv->softclip_clk_users++;
} else {
rx_priv->softclip_clk_users--;
if (rx_priv->softclip_clk_users == 0)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_SOFTCLIP_CRC,
0x01, 0x00);
}
}
-static int rx_macro_config_softclip(struct snd_soc_codec *codec,
+static int rx_macro_config_softclip(struct snd_soc_component *component,
struct rx_macro_priv *rx_priv,
int event)
{
- dev_dbg(codec->dev, "%s: event %d, enabled %d\n",
+ dev_dbg(component->dev, "%s: event %d, enabled %d\n",
__func__, event, rx_priv->is_softclip_on);
if (!rx_priv->is_softclip_on)
@@ -1451,16 +1466,16 @@
if (SND_SOC_DAPM_EVENT_ON(event)) {
/* Enable Softclip clock */
- rx_macro_enable_softclip_clk(codec, rx_priv, true);
+ rx_macro_enable_softclip_clk(component, rx_priv, true);
/* Enable Softclip control */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 0x01, 0x01);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 0x01, 0x00);
- rx_macro_enable_softclip_clk(codec, rx_priv, false);
+ rx_macro_enable_softclip_clk(component, rx_priv, false);
}
return 0;
@@ -1471,7 +1486,7 @@
{
if ((enable && ++rx_priv->clsh_users == 1) ||
(!enable && --rx_priv->clsh_users == 0))
- snd_soc_update_bits(rx_priv->codec,
+ snd_soc_component_update_bits(rx_priv->component,
BOLERO_CDC_RX_CLSH_CRC, 0x01,
(u8) enable);
if (rx_priv->clsh_users < 0)
@@ -1480,7 +1495,7 @@
rx_priv->clsh_users, enable);
}
-static int rx_macro_config_classh(struct snd_soc_codec *codec,
+static int rx_macro_config_classh(struct snd_soc_component *component,
struct rx_macro_priv *rx_priv,
int interp_n, int event)
{
@@ -1499,36 +1514,44 @@
* These K1 values depend on the Headphone Impedance
* For now it is assumed to be 16 ohm
*/
- snd_soc_update_bits(codec, BOLERO_CDC_RX_CLSH_K1_LSB,
- 0xFF, 0xC0);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_CLSH_K1_MSB,
- 0x0F, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_CLSH_K1_LSB,
+ 0xFF, 0xC0);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_CLSH_K1_MSB,
+ 0x0F, 0x00);
}
switch (interp_n) {
case INTERP_HPHL:
if (rx_priv->is_ear_mode_on)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_CLSH_HPH_V_PA,
0x3F, 0x39);
else
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_CLSH_HPH_V_PA,
0x3F, 0x1C);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_CLSH_DECAY_CTRL,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_CLSH_DECAY_CTRL,
0x07, 0x00);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX0_RX_PATH_CFG0,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX0_RX_PATH_CFG0,
0x40, 0x40);
break;
case INTERP_HPHR:
- snd_soc_update_bits(codec, BOLERO_CDC_RX_CLSH_HPH_V_PA,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_CLSH_HPH_V_PA,
0x3F, 0x1C);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_CLSH_DECAY_CTRL,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_CLSH_DECAY_CTRL,
0x07, 0x00);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX1_RX_PATH_CFG0,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX1_RX_PATH_CFG0,
0x40, 0x40);
break;
case INTERP_AUX:
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_CFG0,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX2_RX_PATH_CFG0,
0x10, 0x10);
break;
}
@@ -1536,7 +1559,7 @@
return 0;
}
-static void rx_macro_hd2_control(struct snd_soc_codec *codec,
+static void rx_macro_hd2_control(struct snd_soc_component *component,
u16 interp_idx, int event)
{
u16 hd2_scale_reg = 0;
@@ -1554,26 +1577,31 @@
}
if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x14);
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x04);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x3C, 0x14);
+ snd_soc_component_update_bits(component, hd2_enable_reg,
+ 0x04, 0x04);
}
if (hd2_enable_reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x00);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x00);
+ snd_soc_component_update_bits(component, hd2_enable_reg,
+ 0x04, 0x00);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x3C, 0x00);
}
}
static int rx_macro_get_compander(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = rx_priv->comp_enabled[comp];
@@ -1583,17 +1611,18 @@
static int rx_macro_set_compander(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
int value = ucontrol->value.integer.value[0];
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
- dev_dbg(codec->dev, "%s: Compander %d enable current %d, new %d\n",
+ dev_dbg(component->dev, "%s: Compander %d enable current %d, new %d\n",
__func__, comp + 1, rx_priv->comp_enabled[comp], value);
rx_priv->comp_enabled[comp] = value;
@@ -1605,11 +1634,12 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] =
@@ -1622,7 +1652,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
struct snd_soc_dapm_update *update = NULL;
u32 rx_port_value = ucontrol->value.integer.value[0];
@@ -1630,7 +1661,7 @@
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
aif_rst = rx_priv->rx_port_value[widget->shift];
@@ -1657,7 +1688,7 @@
rx_priv->active_ch_cnt[rx_port_value]++;
break;
default:
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s:Invalid AIF_ID for RX_MACRO MUX\n", __func__);
goto err;
}
@@ -1672,11 +1703,12 @@
static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = rx_priv->is_ear_mode_on;
@@ -1686,11 +1718,12 @@
static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
rx_priv->is_ear_mode_on =
@@ -1701,11 +1734,12 @@
static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = rx_priv->hph_hd2_mode;
@@ -1715,11 +1749,12 @@
static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
rx_priv->hph_hd2_mode = ucontrol->value.integer.value[0];
@@ -1729,11 +1764,12 @@
static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = rx_priv->hph_pwr_mode;
@@ -1743,11 +1779,12 @@
static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
rx_priv->hph_pwr_mode = ucontrol->value.integer.value[0];
@@ -1757,13 +1794,15 @@
static int rx_macro_vbat_bcl_gsm_mode_func_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
ucontrol->value.integer.value[0] =
- ((snd_soc_read(codec, BOLERO_CDC_RX_BCL_VBAT_CFG) & 0x04) ?
+ ((snd_soc_component_read32(
+ component, BOLERO_CDC_RX_BCL_VBAT_CFG) & 0x04) ?
1 : 0);
- dev_dbg(codec->dev, "%s: value: %lu\n", __func__,
+ dev_dbg(component->dev, "%s: value: %lu\n", __func__,
ucontrol->value.integer.value[0]);
return 0;
@@ -1772,18 +1811,21 @@
static int rx_macro_vbat_bcl_gsm_mode_func_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: value: %lu\n", __func__,
+ dev_dbg(component->dev, "%s: value: %lu\n", __func__,
ucontrol->value.integer.value[0]);
/* Set Vbat register configuration for GSM mode bit based on value */
if (ucontrol->value.integer.value[0])
- snd_soc_update_bits(codec, BOLERO_CDC_RX_BCL_VBAT_CFG,
- 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_BCL_VBAT_CFG,
+ 0x04, 0x04);
else
- snd_soc_update_bits(codec, BOLERO_CDC_RX_BCL_VBAT_CFG,
- 0x04, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_BCL_VBAT_CFG,
+ 0x04, 0x00);
return 0;
}
@@ -1791,16 +1833,17 @@
static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = rx_priv->is_softclip_on;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -1809,16 +1852,17 @@
static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
- rx_priv->is_softclip_on = ucontrol->value.integer.value[0];
+ rx_priv->is_softclip_on = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: soft clip enable = %d\n", __func__,
+ dev_dbg(component->dev, "%s: soft clip enable = %d\n", __func__,
rx_priv->is_softclip_on);
return 0;
@@ -1828,108 +1872,113 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Enable clock for VBAT block */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_PATH_CTL, 0x10, 0x10);
/* Enable VBAT block */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_CFG, 0x01, 0x01);
/* Update interpolator with 384K path */
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_CFG1,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX2_RX_PATH_CFG1, 0x80, 0x80);
/* Update DSM FS rate */
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_SEC7,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX2_RX_PATH_SEC7, 0x02, 0x02);
/* Use attenuation mode */
- snd_soc_update_bits(codec, BOLERO_CDC_RX_BCL_VBAT_CFG,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_BCL_VBAT_CFG, 0x02, 0x00);
/* BCL block needs softclip clock to be enabled */
- rx_macro_enable_softclip_clk(codec, rx_priv, true);
+ rx_macro_enable_softclip_clk(component, rx_priv, true);
/* Enable VBAT at channel level */
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_CFG1,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX2_RX_PATH_CFG1, 0x02, 0x02);
/* Set the ATTK1 gain */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD1,
0xFF, 0xFF);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD2,
0xFF, 0x03);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD3,
0xFF, 0x00);
/* Set the ATTK2 gain */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD4,
0xFF, 0xFF);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD5,
0xFF, 0x03);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD6,
0xFF, 0x00);
/* Set the ATTK3 gain */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD7,
0xFF, 0xFF);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD8,
0xFF, 0x03);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD9,
0xFF, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_CFG1,
- 0x80, 0x00);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_SEC7,
- 0x02, 0x00);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_BCL_VBAT_CFG,
- 0x02, 0x02);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_CFG1,
- 0x02, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX2_RX_PATH_CFG1,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX2_RX_PATH_SEC7,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_BCL_VBAT_CFG,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX2_RX_PATH_CFG1,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD1,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD2,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD3,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD4,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD5,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD6,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD7,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD8,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_BCL_GAIN_UPD9,
0xFF, 0x00);
- rx_macro_enable_softclip_clk(codec, rx_priv, false);
- snd_soc_update_bits(codec,
+ rx_macro_enable_softclip_clk(component, rx_priv, false);
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_CFG, 0x01, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_PATH_CTL, 0x10, 0x00);
break;
default:
@@ -1939,7 +1988,7 @@
return 0;
}
-static void rx_macro_idle_detect_control(struct snd_soc_codec *codec,
+static void rx_macro_idle_detect_control(struct snd_soc_component *component,
struct rx_macro_priv *rx_priv,
int interp, int event)
{
@@ -1960,16 +2009,17 @@
}
if (reg && SND_SOC_DAPM_EVENT_ON(event))
- snd_soc_update_bits(codec, reg, mask, val);
+ snd_soc_component_update_bits(component, reg, mask, val);
if (reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, reg, mask, 0x00);
+ snd_soc_component_update_bits(component, reg, mask, 0x00);
rx_priv->idle_det_cfg.hph_idle_thr = 0;
- snd_soc_write(codec, BOLERO_CDC_RX_IDLE_DETECT_CFG3, 0x0);
+ snd_soc_component_write(component,
+ BOLERO_CDC_RX_IDLE_DETECT_CFG3, 0x0);
}
}
-static void rx_macro_hphdelay_lutbypass(struct snd_soc_codec *codec,
+static void rx_macro_hphdelay_lutbypass(struct snd_soc_component *component,
struct rx_macro_priv *rx_priv,
u16 interp_idx, int event)
{
@@ -1992,43 +2042,48 @@
if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_ON(event)) {
if (interp_idx == INTERP_HPHL) {
if (rx_priv->is_ear_mode_on)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_RX0_RX_PATH_CFG1,
0x02, 0x02);
else
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
hph_lut_bypass_reg,
0x80, 0x80);
} else {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
hph_lut_bypass_reg,
0x80, 0x80);
}
if (rx_priv->hph_pwr_mode)
- snd_soc_update_bits(codec, hph_comp_ctrl7, 0x20, 0x00);
+ snd_soc_component_update_bits(component,
+ hph_comp_ctrl7,
+ 0x20, 0x00);
}
if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX0_RX_PATH_CFG1,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX0_RX_PATH_CFG1,
0x02, 0x00);
- snd_soc_update_bits(codec, hph_lut_bypass_reg, 0x80, 0x00);
- snd_soc_update_bits(codec, hph_comp_ctrl7, 0x20, 0x20);
+ snd_soc_component_update_bits(component, hph_lut_bypass_reg,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component, hph_comp_ctrl7,
+ 0x20, 0x0);
}
}
-static int rx_macro_enable_interp_clk(struct snd_soc_codec *codec,
+static int rx_macro_enable_interp_clk(struct snd_soc_component *component,
int event, int interp_idx)
{
u16 main_reg = 0, dsm_reg = 0, rx_cfg2_reg = 0;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
main_reg = BOLERO_CDC_RX_RX0_RX_PATH_CTL +
@@ -2040,24 +2095,29 @@
if (SND_SOC_DAPM_EVENT_ON(event)) {
if (rx_priv->main_clk_users[interp_idx] == 0) {
- snd_soc_update_bits(codec, dsm_reg, 0x01, 0x01);
+ snd_soc_component_update_bits(component, dsm_reg,
+ 0x01, 0x01);
/* Main path PGA mute enable */
- snd_soc_update_bits(codec, main_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x10, 0x10);
/* Clk enable */
- snd_soc_update_bits(codec, main_reg, 0x20, 0x20);
- snd_soc_update_bits(codec, rx_cfg2_reg, 0x03, 0x03);
- rx_macro_idle_detect_control(codec, rx_priv,
+ snd_soc_component_update_bits(component, main_reg,
+ 0x20, 0x20);
+ snd_soc_component_update_bits(component, rx_cfg2_reg,
+ 0x03, 0x03);
+ rx_macro_idle_detect_control(component, rx_priv,
interp_idx, event);
if (rx_priv->hph_hd2_mode)
- rx_macro_hd2_control(codec, interp_idx, event);
- rx_macro_hphdelay_lutbypass(codec, rx_priv, interp_idx,
- event);
- rx_macro_config_compander(codec, rx_priv,
+ rx_macro_hd2_control(
+ component, interp_idx, event);
+ rx_macro_hphdelay_lutbypass(component, rx_priv,
+ interp_idx, event);
+ rx_macro_config_compander(component, rx_priv,
interp_idx, event);
if (interp_idx == INTERP_AUX)
- rx_macro_config_softclip(codec, rx_priv,
+ rx_macro_config_softclip(component, rx_priv,
event);
- rx_macro_config_classh(codec, rx_priv,
+ rx_macro_config_classh(component, rx_priv,
interp_idx, event);
}
rx_priv->main_clk_users[interp_idx]++;
@@ -2068,31 +2128,38 @@
if (rx_priv->main_clk_users[interp_idx] <= 0) {
rx_priv->main_clk_users[interp_idx] = 0;
/* Clk Disable */
- snd_soc_update_bits(codec, dsm_reg, 0x01, 0x00);
- snd_soc_update_bits(codec, main_reg, 0x20, 0x00);
+ snd_soc_component_update_bits(component, dsm_reg,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x20, 0x00);
/* Reset enable and disable */
- snd_soc_update_bits(codec, main_reg, 0x40, 0x40);
- snd_soc_update_bits(codec, main_reg, 0x40, 0x00);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x40, 0x40);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x40, 0x00);
/* Reset rate to 48K*/
- snd_soc_update_bits(codec, main_reg, 0x0F, 0x04);
- snd_soc_update_bits(codec, rx_cfg2_reg, 0x03, 0x00);
- rx_macro_config_classh(codec, rx_priv,
+ snd_soc_component_update_bits(component, main_reg,
+ 0x0F, 0x04);
+ snd_soc_component_update_bits(component, rx_cfg2_reg,
+ 0x03, 0x00);
+ rx_macro_config_classh(component, rx_priv,
interp_idx, event);
- rx_macro_config_compander(codec, rx_priv,
+ rx_macro_config_compander(component, rx_priv,
interp_idx, event);
if (interp_idx == INTERP_AUX)
- rx_macro_config_softclip(codec, rx_priv,
+ rx_macro_config_softclip(component, rx_priv,
event);
- rx_macro_hphdelay_lutbypass(codec, rx_priv, interp_idx,
- event);
+ rx_macro_hphdelay_lutbypass(component, rx_priv,
+ interp_idx, event);
if (rx_priv->hph_hd2_mode)
- rx_macro_hd2_control(codec, interp_idx, event);
- rx_macro_idle_detect_control(codec, rx_priv,
+ rx_macro_hd2_control(component, interp_idx,
+ event);
+ rx_macro_idle_detect_control(component, rx_priv,
interp_idx, event);
}
}
- dev_dbg(codec->dev, "%s event %d main_clk_users %d\n",
+ dev_dbg(component->dev, "%s event %d main_clk_users %d\n",
__func__, event, rx_priv->main_clk_users[interp_idx]);
return rx_priv->main_clk_users[interp_idx];
@@ -2101,21 +2168,24 @@
static int rx_macro_enable_rx_path_clk(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 sidetone_reg = 0;
- dev_dbg(codec->dev, "%s %d %d\n", __func__, event, w->shift);
+ dev_dbg(component->dev, "%s %d %d\n", __func__, event, w->shift);
sidetone_reg = BOLERO_CDC_RX_RX0_RX_PATH_CFG1 +
RX_MACRO_RX_PATH_OFFSET * (w->shift);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- rx_macro_enable_interp_clk(codec, event, w->shift);
- snd_soc_update_bits(codec, sidetone_reg, 0x10, 0x10);
+ rx_macro_enable_interp_clk(component, event, w->shift);
+ snd_soc_component_update_bits(component, sidetone_reg,
+ 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, sidetone_reg, 0x10, 0x00);
- rx_macro_enable_interp_clk(codec, event, w->shift);
+ snd_soc_component_update_bits(component, sidetone_reg,
+ 0x10, 0x00);
+ rx_macro_enable_interp_clk(component, event, w->shift);
break;
default:
break;
@@ -2158,7 +2228,8 @@
static int rx_macro_iir_enable_audio_mixer_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -2166,10 +2237,11 @@
/* IIR filter band registers are at integer multiples of 0x80 */
u16 iir_reg = BOLERO_CDC_RX_SIDETONE_IIR0_IIR_CTL + 0x80 * iir_idx;
- ucontrol->value.integer.value[0] = (snd_soc_read(codec, iir_reg) &
- (1 << band_idx)) != 0;
+ ucontrol->value.integer.value[0] = (
+ snd_soc_component_read32(component, iir_reg) &
+ (1 << band_idx)) != 0;
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
+ dev_dbg(component->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
iir_idx, band_idx,
(uint32_t)ucontrol->value.integer.value[0]);
return 0;
@@ -2178,7 +2250,8 @@
static int rx_macro_iir_enable_audio_mixer_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -2189,62 +2262,62 @@
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
rx_macro_restore_iir_coeff(rx_priv, iir_idx, band_idx);
/* Mask first 5 bits, 6-8 are reserved */
- snd_soc_update_bits(codec, iir_reg, (1 << band_idx),
+ snd_soc_component_update_bits(component, iir_reg, (1 << band_idx),
(value << band_idx));
- iir_band_en_status = ((snd_soc_read(codec, iir_reg) &
+ iir_band_en_status = ((snd_soc_component_read32(component, iir_reg) &
(1 << band_idx)) != 0);
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
+ dev_dbg(component->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
iir_idx, band_idx, iir_band_en_status);
return 0;
}
-static uint32_t get_iir_band_coeff(struct snd_soc_codec *codec,
+static uint32_t get_iir_band_coeff(struct snd_soc_component *component,
int iir_idx, int band_idx,
int coeff_idx)
{
uint32_t value = 0;
/* Address does not automatically update if reading */
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t)) & 0x7F);
- value |= snd_soc_read(codec,
+ value |= snd_soc_component_read32(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 1) & 0x7F);
- value |= (snd_soc_read(codec,
+ value |= (snd_soc_component_read32(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL +
0x80 * iir_idx)) << 8);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 2) & 0x7F);
- value |= (snd_soc_read(codec,
+ value |= (snd_soc_component_read32(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL +
0x80 * iir_idx)) << 16);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 3) & 0x7F);
/* Mask bits top 2 bits since they are reserved */
- value |= ((snd_soc_read(codec,
+ value |= ((snd_soc_component_read32(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL +
16 * iir_idx)) & 0x3F) << 24);
@@ -2254,24 +2327,25 @@
static int rx_macro_iir_band_audio_mixer_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
ucontrol->value.integer.value[0] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 0);
+ get_iir_band_coeff(component, iir_idx, band_idx, 0);
ucontrol->value.integer.value[1] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 1);
+ get_iir_band_coeff(component, iir_idx, band_idx, 1);
ucontrol->value.integer.value[2] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 2);
+ get_iir_band_coeff(component, iir_idx, band_idx, 2);
ucontrol->value.integer.value[3] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 3);
+ get_iir_band_coeff(component, iir_idx, band_idx, 3);
ucontrol->value.integer.value[4] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 4);
+ get_iir_band_coeff(component, iir_idx, band_idx, 4);
- dev_dbg(codec->dev, "%s: IIR #%d band #%d b0 = 0x%x\n"
+ dev_dbg(component->dev, "%s: IIR #%d band #%d b0 = 0x%x\n"
"%s: IIR #%d band #%d b1 = 0x%x\n"
"%s: IIR #%d band #%d b2 = 0x%x\n"
"%s: IIR #%d band #%d a1 = 0x%x\n"
@@ -2289,24 +2363,24 @@
return 0;
}
-static void set_iir_band_coeff(struct snd_soc_codec *codec,
+static void set_iir_band_coeff(struct snd_soc_component *component,
int iir_idx, int band_idx,
uint32_t value)
{
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx),
(value & 0xFF));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx),
(value >> 8) & 0xFF);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx),
(value >> 16) & 0xFF);
/* Mask top 2 bits, 7-8 are reserved */
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx),
(value >> 24) & 0x3F);
}
@@ -2314,7 +2388,8 @@
static int rx_macro_iir_band_audio_mixer_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -2323,14 +2398,14 @@
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
/*
* Mask top bit it is reserved
* Updates addr automatically for each B2 write
*/
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
(band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F);
@@ -2339,7 +2414,7 @@
coeff_idx++) {
uint32_t value = ucontrol->value.integer.value[coeff_idx];
- set_iir_band_coeff(codec, iir_idx, band_idx, value);
+ set_iir_band_coeff(component, iir_idx, band_idx, value);
/* Four 8 bit values(one 32 bit) per coefficient */
rx_priv->sidetone_coeff_array[iir_idx][band_idx][idx++] =
@@ -2358,61 +2433,62 @@
"%s: IIR #%d band #%d a1 = 0x%x\n"
"%s: IIR #%d band #%d a2 = 0x%x\n",
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 0),
+ get_iir_band_coeff(component, iir_idx, band_idx, 0),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 1),
+ get_iir_band_coeff(component, iir_idx, band_idx, 1),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 2),
+ get_iir_band_coeff(component, iir_idx, band_idx, 2),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 3),
+ get_iir_band_coeff(component, iir_idx, band_idx, 3),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 4));
+ get_iir_band_coeff(component, iir_idx, band_idx, 4));
return 0;
}
static int rx_macro_set_iir_gain(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s: event = %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event = %d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU: /* fall through */
case SND_SOC_DAPM_PRE_PMD:
if (strnstr(w->name, "IIR0", sizeof("IIR0"))) {
- snd_soc_write(codec,
+ snd_soc_component_write(component,
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL));
} else {
- snd_soc_write(codec,
+ snd_soc_component_write(component,
BOLERO_CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
BOLERO_CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
BOLERO_CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
BOLERO_CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
BOLERO_CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
BOLERO_CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
BOLERO_CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
BOLERO_CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL));
}
break;
@@ -3026,43 +3102,43 @@
return ret;
}
-static void rx_macro_init_bcl_pmic_reg(struct snd_soc_codec *codec)
+static void rx_macro_init_bcl_pmic_reg(struct snd_soc_component *component)
{
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!codec) {
- pr_err("%s: NULL codec pointer!\n", __func__);
+ if (!component) {
+ pr_err("%s: NULL component pointer!\n", __func__);
return;
}
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return;
switch (rx_priv->bcl_pmic_params.id) {
case 0:
/* Enable ID0 to listen to respective PMIC group interrupts */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_DECODE_CTL1, 0x02, 0x02);
/* Update MC_SID0 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_DECODE_CFG1, 0x0F,
rx_priv->bcl_pmic_params.sid);
/* Update MC_PPID0 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_DECODE_CFG2, 0xFF,
rx_priv->bcl_pmic_params.ppid);
break;
case 1:
/* Enable ID1 to listen to respective PMIC group interrupts */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_DECODE_CTL1, 0x01, 0x01);
/* Update MC_SID1 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_DECODE_CFG3, 0x0F,
rx_priv->bcl_pmic_params.sid);
/* Update MC_PPID1 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_RX_BCL_VBAT_DECODE_CFG1, 0xFF,
rx_priv->bcl_pmic_params.ppid);
break;
@@ -3073,22 +3149,23 @@
}
}
-static int rx_macro_init(struct snd_soc_codec *codec)
+static int rx_macro_init(struct snd_soc_component *component)
{
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
int ret = 0;
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- rx_dev = bolero_get_device_ptr(codec->dev, RX_MACRO);
+ rx_dev = bolero_get_device_ptr(component->dev, RX_MACRO);
if (!rx_dev) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: null device for macro!\n", __func__);
return -EINVAL;
}
rx_priv = dev_get_drvdata(rx_dev);
if (!rx_priv) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: priv is null for macro!\n", __func__);
return -EINVAL;
}
@@ -3110,7 +3187,7 @@
dev_err(rx_dev, "%s: failed to add widgets\n", __func__);
return ret;
}
- ret = snd_soc_add_codec_controls(codec, rx_macro_snd_controls,
+ ret = snd_soc_add_component_controls(component, rx_macro_snd_controls,
ARRAY_SIZE(rx_macro_snd_controls));
if (ret < 0) {
dev_err(rx_dev, "%s: failed to add snd_ctls\n", __func__);
@@ -3130,31 +3207,44 @@
snd_soc_dapm_ignore_suspend(dapm, "RX_TX DEC3_INP");
snd_soc_dapm_sync(dapm);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX0_RX_PATH_DSM_CTL, 0x01, 0x01);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX1_RX_PATH_DSM_CTL, 0x01, 0x01);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_DSM_CTL, 0x01, 0x01);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX0_RX_PATH_SEC7, 0x07, 0x02);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX1_RX_PATH_SEC7, 0x07, 0x02);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_SEC7, 0x07, 0x02);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX0_RX_PATH_CFG3, 0x03, 0x02);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX1_RX_PATH_CFG3, 0x03, 0x02);
- snd_soc_update_bits(codec, BOLERO_CDC_RX_RX2_RX_PATH_CFG3, 0x03, 0x02);
- rx_macro_init_bcl_pmic_reg(codec);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX0_RX_PATH_DSM_CTL,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX1_RX_PATH_DSM_CTL,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_RX_RX2_RX_PATH_DSM_CTL,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX0_RX_PATH_SEC7,
+ 0x07, 0x02);
+ snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX1_RX_PATH_SEC7,
+ 0x07, 0x02);
+ snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX2_RX_PATH_SEC7,
+ 0x07, 0x02);
+ snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX0_RX_PATH_CFG3,
+ 0x03, 0x02);
+ snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX1_RX_PATH_CFG3,
+ 0x03, 0x02);
+ snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX2_RX_PATH_CFG3,
+ 0x03, 0x02);
- rx_priv->codec = codec;
+ rx_macro_init_bcl_pmic_reg(component);
+
+ rx_priv->component = component;
return 0;
}
-static int rx_macro_deinit(struct snd_soc_codec *codec)
+static int rx_macro_deinit(struct snd_soc_component *component)
{
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
- if (!rx_macro_get_data(codec, &rx_dev, &rx_priv, __func__))
+ if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
- rx_priv->codec = NULL;
+ rx_priv->component = NULL;
return 0;
}
diff --git a/asoc/codecs/bolero/tx-macro.c b/asoc/codecs/bolero/tx-macro.c
index e58cbd5..96182d3 100644
--- a/asoc/codecs/bolero/tx-macro.c
+++ b/asoc/codecs/bolero/tx-macro.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -138,7 +130,7 @@
struct clk *tx_npl_clk;
struct mutex mclk_lock;
struct mutex swr_clk_lock;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct device_node *tx_swr_gpio_p;
struct tx_macro_swr_ctrl_data *swr_ctrl_data;
struct tx_macro_swr_ctrl_platform_data swr_plat_data;
@@ -158,28 +150,28 @@
int child_count;
};
-static bool tx_macro_get_data(struct snd_soc_codec *codec,
+static bool tx_macro_get_data(struct snd_soc_component *component,
struct device **tx_dev,
struct tx_macro_priv **tx_priv,
const char *func_name)
{
- *tx_dev = bolero_get_device_ptr(codec->dev, TX_MACRO);
+ *tx_dev = bolero_get_device_ptr(component->dev, TX_MACRO);
if (!(*tx_dev)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: null device for macro!\n", func_name);
return false;
}
*tx_priv = dev_get_drvdata((*tx_dev));
if (!(*tx_priv)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: priv is null for macro!\n", func_name);
return false;
}
- if (!(*tx_priv)->codec) {
- dev_err(codec->dev,
- "%s: tx_priv->codec not initialized!\n", func_name);
+ if (!(*tx_priv)->component) {
+ dev_err(component->dev,
+ "%s: tx_priv->component not initialized!\n", func_name);
return false;
}
@@ -253,12 +245,13 @@
static int tx_macro_mclk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
dev_dbg(tx_dev, "%s: event = %d\n", __func__, event);
@@ -304,13 +297,13 @@
return ret;
}
-static int tx_macro_event_handler(struct snd_soc_codec *codec, u16 event,
- u32 data)
+static int tx_macro_event_handler(struct snd_soc_component *component,
+ u16 event, u32 data)
{
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
switch (event) {
@@ -331,7 +324,7 @@
return 0;
}
-static int tx_macro_reg_wake_irq(struct snd_soc_codec *codec,
+static int tx_macro_reg_wake_irq(struct snd_soc_component *component,
u32 data)
{
struct device *tx_dev = NULL;
@@ -339,7 +332,7 @@
u32 ipc_wakeup = data;
int ret = 0;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
ret = swrm_wcd_notify(
@@ -354,7 +347,7 @@
struct delayed_work *hpf_delayed_work = NULL;
struct hpf_work *hpf_work = NULL;
struct tx_macro_priv *tx_priv = NULL;
- struct snd_soc_codec *codec = NULL;
+ struct snd_soc_component *component = NULL;
u16 dec_cfg_reg = 0, hpf_gate_reg = 0;
u8 hpf_cut_off_freq = 0;
u16 adc_mux_reg = 0, adc_n = 0, adc_reg = 0;
@@ -362,7 +355,7 @@
hpf_delayed_work = to_delayed_work(work);
hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork);
tx_priv = hpf_work->tx_priv;
- codec = tx_priv->codec;
+ component = tx_priv->component;
hpf_cut_off_freq = hpf_work->hpf_cut_off_freq;
dec_cfg_reg = BOLERO_CDC_TX0_TX_PATH_CFG0 +
@@ -370,34 +363,35 @@
hpf_gate_reg = BOLERO_CDC_TX0_TX_PATH_SEC2 +
TX_MACRO_TX_PATH_OFFSET * hpf_work->decimator;
- dev_dbg(codec->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
+ dev_dbg(component->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
__func__, hpf_work->decimator, hpf_cut_off_freq);
adc_mux_reg = BOLERO_CDC_TX_INP_MUX_ADC_MUX0_CFG1 +
TX_MACRO_ADC_MUX_CFG_OFFSET * hpf_work->decimator;
- if (snd_soc_read(codec, adc_mux_reg) & SWR_MIC) {
+ if (snd_soc_component_read32(component, adc_mux_reg) & SWR_MIC) {
adc_reg = BOLERO_CDC_TX_INP_MUX_ADC_MUX0_CFG0 +
TX_MACRO_ADC_MUX_CFG_OFFSET * hpf_work->decimator;
- adc_n = snd_soc_read(codec, adc_reg) &
+ adc_n = snd_soc_component_read32(component, adc_reg) &
TX_MACRO_SWR_MIC_MUX_SEL_MASK;
if (adc_n >= BOLERO_ADC_MAX)
goto tx_hpf_set;
/* analog mic clear TX hold */
- bolero_clear_amic_tx_hold(codec->dev, adc_n);
+ bolero_clear_amic_tx_hold(component->dev, adc_n);
}
tx_hpf_set:
- snd_soc_update_bits(codec, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x03, 0x02);
+ snd_soc_component_update_bits(component,
+ dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02);
/* Minimum 1 clk cycle delay is required as per HW spec */
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x03, 0x01);
+ snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x01);
}
static void tx_macro_mute_update_callback(struct work_struct *work)
{
struct tx_mute_work *tx_mute_dwork = NULL;
- struct snd_soc_codec *codec = NULL;
+ struct snd_soc_component *component = NULL;
struct tx_macro_priv *tx_priv = NULL;
struct delayed_work *delayed_work = NULL;
u16 tx_vol_ctl_reg = 0;
@@ -406,13 +400,13 @@
delayed_work = to_delayed_work(work);
tx_mute_dwork = container_of(delayed_work, struct tx_mute_work, dwork);
tx_priv = tx_mute_dwork->tx_priv;
- codec = tx_priv->codec;
+ component = tx_priv->component;
decimator = tx_mute_dwork->decimator;
tx_vol_ctl_reg =
BOLERO_CDC_TX0_TX_PATH_CTL +
TX_MACRO_TX_PATH_OFFSET * decimator;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x10, 0x00);
dev_dbg(tx_priv->dev, "%s: decimator %u unmute\n",
__func__, decimator);
}
@@ -422,7 +416,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val = 0;
u16 mic_sel_reg = 0;
@@ -431,7 +426,7 @@
if (val > e->items - 1)
return -EINVAL;
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: wname: %s, val: 0x%x\n", __func__,
widget->name, val);
switch (e->reg) {
@@ -460,23 +455,26 @@
mic_sel_reg = BOLERO_CDC_TX7_TX_PATH_CFG0;
break;
default:
- dev_err(codec->dev, "%s: e->reg: 0x%x not expected\n",
+ dev_err(component->dev, "%s: e->reg: 0x%x not expected\n",
__func__, e->reg);
return -EINVAL;
}
if (strnstr(widget->name, "SMIC", strlen(widget->name))) {
if (val != 0) {
if (val < 5)
- snd_soc_update_bits(codec, mic_sel_reg,
+ snd_soc_component_update_bits(component,
+ mic_sel_reg,
1 << 7, 0x0 << 7);
else
- snd_soc_update_bits(codec, mic_sel_reg,
+ snd_soc_component_update_bits(component,
+ mic_sel_reg,
1 << 7, 0x1 << 7);
}
} else {
/* DMIC selected */
if (val != 0)
- snd_soc_update_bits(codec, mic_sel_reg, 1 << 7, 1 << 7);
+ snd_soc_component_update_bits(component, mic_sel_reg,
+ 1 << 7, 1 << 7);
}
return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
@@ -487,7 +485,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
u32 dai_id = widget->shift;
@@ -495,7 +494,7 @@
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
if (test_bit(dec_id, &tx_priv->active_ch_mask[dai_id]))
@@ -510,7 +509,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct snd_soc_dapm_update *update = NULL;
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
@@ -520,7 +520,7 @@
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
if (enable) {
@@ -538,7 +538,8 @@
static int tx_macro_enable_dmic(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u8 dmic_clk_en = 0x01;
u16 dmic_clk_reg = 0;
s32 *dmic_clk_cnt = NULL;
@@ -548,18 +549,18 @@
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
wname = strpbrk(w->name, "01234567");
if (!wname) {
- dev_err(codec->dev, "%s: widget not found\n", __func__);
+ dev_err(component->dev, "%s: widget not found\n", __func__);
return -EINVAL;
}
ret = kstrtouint(wname, 10, &dmic);
if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid DMIC line on the codec\n",
+ dev_err(component->dev, "%s: Invalid DMIC line on the codec\n",
__func__);
return -EINVAL;
}
@@ -586,30 +587,31 @@
dmic_clk_reg = BOLERO_CDC_VA_TOP_CSR_DMIC3_CTL;
break;
default:
- dev_err(codec->dev, "%s: Invalid DMIC Selection\n",
+ dev_err(component->dev, "%s: Invalid DMIC Selection\n",
__func__);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
+ dev_dbg(component->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
__func__, event, dmic, *dmic_clk_cnt);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
(*dmic_clk_cnt)++;
if (*dmic_clk_cnt == 1) {
- snd_soc_update_bits(codec, BOLERO_CDC_VA_TOP_CSR_DMIC_CFG,
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_VA_TOP_CSR_DMIC_CFG,
0x80, 0x00);
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
0x0E, tx_priv->dmic_clk_div << 0x1);
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
dmic_clk_en, dmic_clk_en);
}
break;
case SND_SOC_DAPM_POST_PMD:
(*dmic_clk_cnt)--;
if (*dmic_clk_cnt == 0)
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
dmic_clk_en, 0);
break;
}
@@ -620,7 +622,8 @@
static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
unsigned int decimator = 0;
u16 tx_vol_ctl_reg = 0;
u16 dec_cfg_reg = 0;
@@ -630,12 +633,12 @@
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
decimator = w->shift;
- dev_dbg(codec->dev, "%s(): widget = %s decimator = %u\n", __func__,
+ dev_dbg(component->dev, "%s(): widget = %s decimator = %u\n", __func__,
w->name, decimator);
tx_vol_ctl_reg = BOLERO_CDC_TX0_TX_PATH_CTL +
@@ -650,21 +653,27 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Enable TX PGA Mute */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ tx_vol_ctl_reg, 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x20, 0x20);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ tx_vol_ctl_reg, 0x20, 0x20);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg, 0x01, 0x00);
- hpf_cut_off_freq = (snd_soc_read(codec, dec_cfg_reg) &
- TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
+ hpf_cut_off_freq = (
+ snd_soc_component_read32(component, dec_cfg_reg) &
+ TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
+
tx_priv->tx_hpf_work[decimator].hpf_cut_off_freq =
- hpf_cut_off_freq;
+ hpf_cut_off_freq;
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ)
- snd_soc_update_bits(codec, dec_cfg_reg,
- TX_HPF_CUT_OFF_FREQ_MASK,
- CF_MIN_3DB_150HZ << 5);
+ snd_soc_component_update_bits(component, dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ CF_MIN_3DB_150HZ << 5);
+
/* schedule work queue to Remove Mute */
schedule_delayed_work(&tx_priv->tx_mute_dwork[decimator].dwork,
msecs_to_jiffies(tx_unmute_delay));
@@ -673,35 +682,42 @@
schedule_delayed_work(
&tx_priv->tx_hpf_work[decimator].dwork,
msecs_to_jiffies(300));
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg, 0x02, 0x02);
/*
* Minimum 1 clk cycle delay is required as per HW spec
*/
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg, 0x02, 0x00);
}
/* apply gain after decimator is enabled */
- snd_soc_write(codec, tx_gain_ctl_reg,
- snd_soc_read(codec, tx_gain_ctl_reg));
+ snd_soc_component_write(component, tx_gain_ctl_reg,
+ snd_soc_component_read32(component,
+ tx_gain_ctl_reg));
break;
case SND_SOC_DAPM_PRE_PMD:
hpf_cut_off_freq =
tx_priv->tx_hpf_work[decimator].hpf_cut_off_freq;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ tx_vol_ctl_reg, 0x10, 0x10);
if (cancel_delayed_work_sync(
&tx_priv->tx_hpf_work[decimator].dwork)) {
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
- TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, hpf_gate_reg,
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg,
0x02, 0x02);
/*
* Minimum 1 clk cycle delay is required
* as per HW spec
*/
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg,
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg,
0x02, 0x00);
}
}
@@ -709,8 +725,10 @@
&tx_priv->tx_mute_dwork[decimator].dwork);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x20, 0x00);
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x20, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x00);
break;
}
return 0;
@@ -727,14 +745,14 @@
struct snd_soc_dai *dai)
{
int tx_fs_rate = -EINVAL;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
u32 decimator = 0;
u32 sample_rate = 0;
u16 tx_fs_reg = 0;
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
pr_debug("%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n", __func__,
@@ -765,7 +783,7 @@
tx_fs_rate = 7;
break;
default:
- dev_err(codec->dev, "%s: Invalid TX sample rate: %d\n",
+ dev_err(component->dev, "%s: Invalid TX sample rate: %d\n",
__func__, params_rate(params));
return -EINVAL;
}
@@ -774,12 +792,12 @@
if (decimator >= 0) {
tx_fs_reg = BOLERO_CDC_TX0_TX_PATH_CTL +
TX_MACRO_TX_PATH_OFFSET * decimator;
- dev_dbg(codec->dev, "%s: set DEC%u rate to %u\n",
+ dev_dbg(component->dev, "%s: set DEC%u rate to %u\n",
__func__, decimator, sample_rate);
- snd_soc_update_bits(codec, tx_fs_reg, 0x0F,
- tx_fs_rate);
+ snd_soc_component_update_bits(component, tx_fs_reg,
+ 0x0F, tx_fs_rate);
} else {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: ERROR: Invalid decimator: %d\n",
__func__, decimator);
return -EINVAL;
@@ -792,11 +810,11 @@
unsigned int *tx_num, unsigned int *tx_slot,
unsigned int *rx_num, unsigned int *rx_slot)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
switch (dai->id) {
@@ -1491,22 +1509,23 @@
return dmic_sample_rate;
}
-static int tx_macro_init(struct snd_soc_codec *codec)
+static int tx_macro_init(struct snd_soc_component *component)
{
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
int ret = 0, i = 0;
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- tx_dev = bolero_get_device_ptr(codec->dev, TX_MACRO);
+ tx_dev = bolero_get_device_ptr(component->dev, TX_MACRO);
if (!tx_dev) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: null device for macro!\n", __func__);
return -EINVAL;
}
tx_priv = dev_get_drvdata(tx_dev);
if (!tx_priv) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: priv is null for macro!\n", __func__);
return -EINVAL;
}
@@ -1530,7 +1549,7 @@
return ret;
}
- ret = snd_soc_add_codec_controls(codec, tx_macro_snd_controls,
+ ret = snd_soc_add_component_controls(component, tx_macro_snd_controls,
ARRAY_SIZE(tx_macro_snd_controls));
if (ret < 0) {
dev_err(tx_dev, "%s: Failed to add snd_ctls\n", __func__);
@@ -1566,20 +1585,20 @@
INIT_DELAYED_WORK(&tx_priv->tx_mute_dwork[i].dwork,
tx_macro_mute_update_callback);
}
- tx_priv->codec = codec;
+ tx_priv->component = component;
return 0;
}
-static int tx_macro_deinit(struct snd_soc_codec *codec)
+static int tx_macro_deinit(struct snd_soc_component *component)
{
struct device *tx_dev = NULL;
struct tx_macro_priv *tx_priv = NULL;
- if (!tx_macro_get_data(codec, &tx_dev, &tx_priv, __func__))
+ if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
return -EINVAL;
- tx_priv->codec = NULL;
+ tx_priv->component = NULL;
return 0;
}
diff --git a/asoc/codecs/bolero/va-macro.c b/asoc/codecs/bolero/va-macro.c
index eccd8db..985424a 100644
--- a/asoc/codecs/bolero/va-macro.c
+++ b/asoc/codecs/bolero/va-macro.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -103,7 +95,7 @@
bool va_without_decimation;
struct clk *va_core_clk;
struct mutex mclk_lock;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct hpf_work va_hpf_work[VA_MACRO_NUM_DECIMATORS];
struct va_mute_work va_mute_dwork[VA_MACRO_NUM_DECIMATORS];
unsigned long active_ch_mask[VA_MACRO_MAX_DAIS];
@@ -121,20 +113,20 @@
int micb_users;
};
-static bool va_macro_get_data(struct snd_soc_codec *codec,
+static bool va_macro_get_data(struct snd_soc_component *component,
struct device **va_dev,
struct va_macro_priv **va_priv,
const char *func_name)
{
- *va_dev = bolero_get_device_ptr(codec->dev, VA_MACRO);
+ *va_dev = bolero_get_device_ptr(component->dev, VA_MACRO);
if (!(*va_dev)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: null device for macro!\n", func_name);
return false;
}
*va_priv = dev_get_drvdata((*va_dev));
- if (!(*va_priv) || !(*va_priv)->codec) {
- dev_err(codec->dev,
+ if (!(*va_priv) || !(*va_priv)->component) {
+ dev_err(component->dev,
"%s: priv is null for macro!\n", func_name);
return false;
}
@@ -208,14 +200,14 @@
return ret;
}
-static int va_macro_event_handler(struct snd_soc_codec *codec, u16 event,
- u32 data)
+static int va_macro_event_handler(struct snd_soc_component *component,
+ u16 event, u32 data)
{
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
int retry_cnt = MAX_RETRY_ATTEMPTS;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
switch (event) {
@@ -245,12 +237,13 @@
static int va_macro_mclk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
dev_dbg(va_dev, "%s: event = %d\n", __func__, event);
@@ -293,14 +286,14 @@
struct delayed_work *hpf_delayed_work;
struct hpf_work *hpf_work;
struct va_macro_priv *va_priv;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u16 dec_cfg_reg, hpf_gate_reg;
u8 hpf_cut_off_freq;
hpf_delayed_work = to_delayed_work(work);
hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork);
va_priv = hpf_work->va_priv;
- codec = va_priv->codec;
+ component = va_priv->component;
hpf_cut_off_freq = hpf_work->hpf_cut_off_freq;
dec_cfg_reg = BOLERO_CDC_VA_TX0_TX_PATH_CFG0 +
@@ -311,18 +304,19 @@
dev_dbg(va_priv->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
__func__, hpf_work->decimator, hpf_cut_off_freq);
- snd_soc_update_bits(codec, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x03, 0x02);
+ snd_soc_component_update_bits(component,
+ dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x02);
/* Minimum 1 clk cycle delay is required as per HW spec */
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x03, 0x01);
+ snd_soc_component_update_bits(component, hpf_gate_reg, 0x03, 0x01);
}
static void va_macro_mute_update_callback(struct work_struct *work)
{
struct va_mute_work *va_mute_dwork;
- struct snd_soc_codec *codec = NULL;
+ struct snd_soc_component *component = NULL;
struct va_macro_priv *va_priv;
struct delayed_work *delayed_work;
u16 tx_vol_ctl_reg, decimator;
@@ -330,13 +324,13 @@
delayed_work = to_delayed_work(work);
va_mute_dwork = container_of(delayed_work, struct va_mute_work, dwork);
va_priv = va_mute_dwork->va_priv;
- codec = va_priv->codec;
+ component = va_priv->component;
decimator = va_mute_dwork->decimator;
tx_vol_ctl_reg =
BOLERO_CDC_VA_TX0_TX_PATH_CTL +
VA_MACRO_TX_PATH_OFFSET * decimator;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x10, 0x00);
dev_dbg(va_priv->dev, "%s: decimator %u unmute\n",
__func__, decimator);
}
@@ -346,7 +340,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val;
u16 mic_sel_reg;
@@ -355,7 +350,7 @@
if (val > e->items - 1)
return -EINVAL;
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: wname: %s, val: 0x%x\n", __func__,
widget->name, val);
switch (e->reg) {
@@ -384,13 +379,14 @@
mic_sel_reg = BOLERO_CDC_VA_TX7_TX_PATH_CFG0;
break;
default:
- dev_err(codec->dev, "%s: e->reg: 0x%x not expected\n",
+ dev_err(component->dev, "%s: e->reg: 0x%x not expected\n",
__func__, e->reg);
return -EINVAL;
}
/* DMIC selected */
if (val != 0)
- snd_soc_update_bits(codec, mic_sel_reg, 1 << 7, 1 << 7);
+ snd_soc_component_update_bits(component, mic_sel_reg,
+ 1 << 7, 1 << 7);
return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
}
@@ -400,7 +396,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
u32 dai_id = widget->shift;
@@ -408,7 +405,7 @@
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
if (test_bit(dec_id, &va_priv->active_ch_mask[dai_id]))
@@ -423,7 +420,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct snd_soc_dapm_update *update = NULL;
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
@@ -433,7 +431,7 @@
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
if (enable) {
@@ -452,7 +450,8 @@
static int va_macro_enable_dmic(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u8 dmic_clk_en = 0x01;
u16 dmic_clk_reg;
s32 *dmic_clk_cnt;
@@ -462,7 +461,7 @@
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
wname = strpbrk(w->name, "01234567");
@@ -511,21 +510,21 @@
case SND_SOC_DAPM_PRE_PMU:
(*dmic_clk_cnt)++;
if (*dmic_clk_cnt == 1) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_VA_TOP_CSR_DMIC_CFG,
0x80, 0x00);
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
VA_MACRO_TX_DMIC_CLK_DIV_MASK,
va_priv->dmic_clk_div <<
VA_MACRO_TX_DMIC_CLK_DIV_SHFT);
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
dmic_clk_en, dmic_clk_en);
}
break;
case SND_SOC_DAPM_POST_PMD:
(*dmic_clk_cnt)--;
if (*dmic_clk_cnt == 0) {
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
dmic_clk_en, 0);
}
break;
@@ -537,7 +536,8 @@
static int va_macro_enable_dec(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
unsigned int decimator;
u16 tx_vol_ctl_reg, dec_cfg_reg, hpf_gate_reg;
u16 tx_gain_ctl_reg;
@@ -545,7 +545,7 @@
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
decimator = w->shift;
@@ -565,28 +565,34 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Enable TX PGA Mute */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ tx_vol_ctl_reg, 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMU:
/* Enable TX CLK */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x20, 0x20);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ tx_vol_ctl_reg, 0x20, 0x20);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg, 0x01, 0x00);
- hpf_cut_off_freq = (snd_soc_read(codec, dec_cfg_reg) &
+ hpf_cut_off_freq = (snd_soc_component_read32(
+ component, dec_cfg_reg) &
TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
va_priv->va_hpf_work[decimator].hpf_cut_off_freq =
hpf_cut_off_freq;
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
+ snd_soc_component_update_bits(component, dec_cfg_reg,
TX_HPF_CUT_OFF_FREQ_MASK,
CF_MIN_3DB_150HZ << 5);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg, 0x02, 0x02);
/*
* Minimum 1 clk cycle delay is required as per HW spec
*/
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg, 0x02, 0x00);
}
/* schedule work queue to Remove Mute */
schedule_delayed_work(&va_priv->va_mute_dwork[decimator].dwork,
@@ -597,28 +603,32 @@
&va_priv->va_hpf_work[decimator].dwork,
msecs_to_jiffies(300));
/* apply gain after decimator is enabled */
- snd_soc_write(codec, tx_gain_ctl_reg,
- snd_soc_read(codec, tx_gain_ctl_reg));
+ snd_soc_component_write(component, tx_gain_ctl_reg,
+ snd_soc_component_read32(component, tx_gain_ctl_reg));
break;
case SND_SOC_DAPM_PRE_PMD:
hpf_cut_off_freq =
va_priv->va_hpf_work[decimator].hpf_cut_off_freq;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x10);
if (cancel_delayed_work_sync(
&va_priv->va_hpf_work[decimator].dwork)) {
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
- TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, hpf_gate_reg,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg,
+ 0x02, 0x02);
/*
* Minimum 1 clk cycle delay is required
* as per HW spec
*/
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg,
+ 0x02, 0x00);
}
}
cancel_delayed_work_sync(
@@ -626,8 +636,10 @@
break;
case SND_SOC_DAPM_POST_PMD:
/* Disable TX CLK */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x20, 0x00);
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x20, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x00);
break;
}
return 0;
@@ -636,12 +648,13 @@
static int va_macro_enable_micbias(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
int ret = 0;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
if (!va_priv->micb_supply) {
@@ -703,13 +716,13 @@
struct snd_soc_dai *dai)
{
int tx_fs_rate = -EINVAL;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
u32 decimator, sample_rate;
u16 tx_fs_reg = 0;
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
dev_dbg(va_dev,
@@ -752,8 +765,8 @@
VA_MACRO_TX_PATH_OFFSET * decimator;
dev_dbg(va_dev, "%s: set DEC%u rate to %u\n",
__func__, decimator, sample_rate);
- snd_soc_update_bits(codec, tx_fs_reg, 0x0F,
- tx_fs_rate);
+ snd_soc_component_update_bits(component, tx_fs_reg,
+ 0x0F, tx_fs_rate);
} else {
dev_err(va_dev,
"%s: ERROR: Invalid decimator: %d\n",
@@ -768,11 +781,11 @@
unsigned int *tx_num, unsigned int *tx_slot,
unsigned int *rx_num, unsigned int *rx_slot)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
switch (dai->id) {
@@ -1401,22 +1414,23 @@
return dmic_sample_rate;
}
-static int va_macro_init(struct snd_soc_codec *codec)
+static int va_macro_init(struct snd_soc_component *component)
{
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
int ret, i;
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- va_dev = bolero_get_device_ptr(codec->dev, VA_MACRO);
+ va_dev = bolero_get_device_ptr(component->dev, VA_MACRO);
if (!va_dev) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: null device for macro!\n", __func__);
return -EINVAL;
}
va_priv = dev_get_drvdata(va_dev);
if (!va_priv) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: priv is null for macro!\n", __func__);
return -EINVAL;
}
@@ -1430,7 +1444,7 @@
__func__);
return ret;
}
- va_priv->codec = codec;
+ va_priv->component = component;
return 0;
}
@@ -1453,7 +1467,7 @@
dev_err(va_dev, "%s: Failed to add widgets\n", __func__);
return ret;
}
- ret = snd_soc_add_codec_controls(codec, va_macro_snd_controls,
+ ret = snd_soc_add_component_controls(component, va_macro_snd_controls,
ARRAY_SIZE(va_macro_snd_controls));
if (ret < 0) {
dev_err(va_dev, "%s: Failed to add snd_ctls\n", __func__);
@@ -1489,20 +1503,20 @@
INIT_DELAYED_WORK(&va_priv->va_mute_dwork[i].dwork,
va_macro_mute_update_callback);
}
- va_priv->codec = codec;
+ va_priv->component = component;
return 0;
}
-static int va_macro_deinit(struct snd_soc_codec *codec)
+static int va_macro_deinit(struct snd_soc_component *component)
{
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
- if (!va_macro_get_data(codec, &va_dev, &va_priv, __func__))
+ if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
return -EINVAL;
- va_priv->codec = NULL;
+ va_priv->component = NULL;
return 0;
}
diff --git a/asoc/codecs/bolero/wsa-macro.c b/asoc/codecs/bolero/wsa-macro.c
index 2cd1b43..9586770 100644
--- a/asoc/codecs/bolero/wsa-macro.c
+++ b/asoc/codecs/bolero/wsa-macro.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -181,7 +173,7 @@
* @wsa_swr_gpio_p: used by pinctrl API
* @wsa_core_clk: MCLK for wsa macro
* @wsa_npl_clk: NPL clock for WSA soundwire
- * @codec: codec handle
+ * @component: codec handle
* @rx_0_count: RX0 interpolation users
* @rx_1_count: RX1 interpolation users
* @active_ch_mask: channel mask for all AIF DAIs
@@ -205,7 +197,7 @@
struct device_node *wsa_swr_gpio_p;
struct clk *wsa_core_clk;
struct clk *wsa_npl_clk;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
int rx_0_count;
int rx_1_count;
unsigned long active_ch_mask[WSA_MACRO_MAX_DAIS];
@@ -223,7 +215,7 @@
struct wsa_macro_bcl_pmic_params bcl_pmic_params;
};
-static int wsa_macro_config_ear_spkr_gain(struct snd_soc_codec *codec,
+static int wsa_macro_config_ear_spkr_gain(struct snd_soc_component *component,
struct wsa_macro_priv *wsa_priv,
int event, int gain_reg);
static struct snd_soc_dai_driver wsa_macro_dai[];
@@ -437,20 +429,20 @@
{BOLERO_CDC_WSA_BOOST1_BOOST_CTL, 0x7C, 0x44},
};
-static bool wsa_macro_get_data(struct snd_soc_codec *codec,
+static bool wsa_macro_get_data(struct snd_soc_component *component,
struct device **wsa_dev,
struct wsa_macro_priv **wsa_priv,
const char *func_name)
{
- *wsa_dev = bolero_get_device_ptr(codec->dev, WSA_MACRO);
+ *wsa_dev = bolero_get_device_ptr(component->dev, WSA_MACRO);
if (!(*wsa_dev)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: null device for macro!\n", func_name);
return false;
}
*wsa_priv = dev_get_drvdata((*wsa_dev));
- if (!(*wsa_priv) || !(*wsa_priv)->codec) {
- dev_err(codec->dev,
+ if (!(*wsa_priv) || !(*wsa_priv)->component) {
+ dev_err(component->dev,
"%s: priv is null for macro!\n", func_name);
return false;
}
@@ -461,22 +453,23 @@
* wsa_macro_set_spkr_gain_offset - offset the speaker path
* gain with the given offset value.
*
- * @codec: codec instance
+ * @component: codec instance
* @offset: Indicates speaker path gain offset value.
*
* Returns 0 on success or -EINVAL on error.
*/
-int wsa_macro_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset)
+int wsa_macro_set_spkr_gain_offset(struct snd_soc_component *component,
+ int offset)
{
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!codec) {
- pr_err("%s: NULL codec pointer!\n", __func__);
+ if (!component) {
+ pr_err("%s: NULL component pointer!\n", __func__);
return -EINVAL;
}
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
wsa_priv->spkr_gain_offset = offset;
@@ -488,12 +481,12 @@
* wsa_macro_set_spkr_mode - Configures speaker compander and smartboost
* settings based on speaker mode.
*
- * @codec: codec instance
+ * @component: codec instance
* @mode: Indicates speaker configuration mode.
*
* Returns 0 on success or -EINVAL on error.
*/
-int wsa_macro_set_spkr_mode(struct snd_soc_codec *codec, int mode)
+int wsa_macro_set_spkr_mode(struct snd_soc_component *component, int mode)
{
int i;
const struct wsa_macro_reg_mask_val *regs;
@@ -501,12 +494,12 @@
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!codec) {
+ if (!component) {
pr_err("%s: NULL codec pointer!\n", __func__);
return -EINVAL;
}
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
switch (mode) {
@@ -522,7 +515,7 @@
wsa_priv->spkr_mode = mode;
for (i = 0; i < size; i++)
- snd_soc_update_bits(codec, regs[i].reg,
+ snd_soc_component_update_bits(component, regs[i].reg,
regs[i].mask, regs[i].val);
return 0;
}
@@ -538,11 +531,11 @@
u16 int_fs_reg;
u8 int_mux_cfg0_val, int_mux_cfg1_val;
u8 inp0_sel, inp1_sel, inp2_sel;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
for_each_set_bit(port, &wsa_priv->active_ch_mask[dai->id],
@@ -566,8 +559,10 @@
for (j = 0; j < NUM_INTERPOLATORS; j++) {
int_mux_cfg1 = int_mux_cfg0 + WSA_MACRO_MUX_CFG1_OFFSET;
- int_mux_cfg0_val = snd_soc_read(codec, int_mux_cfg0);
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1);
+ int_mux_cfg0_val = snd_soc_component_read32(component,
+ int_mux_cfg0);
+ int_mux_cfg1_val = snd_soc_component_read32(component,
+ int_mux_cfg1);
inp0_sel = int_mux_cfg0_val & WSA_MACRO_MUX_INP_MASK1;
inp1_sel = (int_mux_cfg0_val >>
WSA_MACRO_MUX_INP_SHFT) &
@@ -587,7 +582,8 @@
"%s: set INT%u_1 sample rate to %u\n",
__func__, j, sample_rate);
/* sample_rate is in Hz */
- snd_soc_update_bits(codec, int_fs_reg,
+ snd_soc_component_update_bits(component,
+ int_fs_reg,
WSA_MACRO_FS_RATE_MASK,
int_prim_fs_rate_reg_val);
}
@@ -606,11 +602,11 @@
u32 j, port;
u16 int_mux_cfg1, int_fs_reg;
u8 int_mux_cfg1_val;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
@@ -627,7 +623,8 @@
int_mux_cfg1 = BOLERO_CDC_WSA_RX_INP_MUX_RX_INT0_CFG1;
for (j = 0; j < NUM_INTERPOLATORS; j++) {
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1) &
+ int_mux_cfg1_val = snd_soc_component_read32(component,
+ int_mux_cfg1) &
WSA_MACRO_MUX_INP_MASK1;
if (int_mux_cfg1_val == int_2_inp) {
int_fs_reg =
@@ -640,7 +637,8 @@
dev_dbg(wsa_dev,
"%s: set INT%u_2 sample rate to %u\n",
__func__, j, sample_rate);
- snd_soc_update_bits(codec, int_fs_reg,
+ snd_soc_component_update_bits(component,
+ int_fs_reg,
WSA_MACRO_FS_RATE_MASK,
int_mix_fs_rate_reg_val);
}
@@ -692,10 +690,10 @@
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
int ret;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n", __func__,
dai->name, dai->id, params_rate(params),
params_channels(params));
@@ -704,7 +702,7 @@
case SNDRV_PCM_STREAM_PLAYBACK:
ret = wsa_macro_set_interpolator_rate(dai, params_rate(params));
if (ret) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: cannot set sample rate: %u\n",
__func__, params_rate(params));
return ret;
@@ -721,11 +719,11 @@
unsigned int *tx_num, unsigned int *tx_slot,
unsigned int *rx_num, unsigned int *rx_slot)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
wsa_priv = dev_get_drvdata(wsa_dev);
@@ -817,12 +815,13 @@
static int wsa_macro_mclk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
dev_dbg(wsa_dev, "%s: event = %d\n", __func__, event);
@@ -870,13 +869,13 @@
return ret;
}
-static int wsa_macro_event_handler(struct snd_soc_codec *codec, u16 event,
- u32 data)
+static int wsa_macro_event_handler(struct snd_soc_component *component,
+ u16 event, u32 data)
{
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
switch (event) {
@@ -901,11 +900,12 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
switch (event) {
@@ -914,28 +914,28 @@
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI])) {
dev_dbg(wsa_dev, "%s: spkr1 enabled\n", __func__);
/* Enable V&I sensing */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX0_SPKR_PROT_PATH_CTL,
0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX1_SPKR_PROT_PATH_CTL,
0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX0_SPKR_PROT_PATH_CTL,
0x0F, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX1_SPKR_PROT_PATH_CTL,
0x0F, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX0_SPKR_PROT_PATH_CTL,
0x10, 0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX1_SPKR_PROT_PATH_CTL,
0x10, 0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX0_SPKR_PROT_PATH_CTL,
0x20, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX1_SPKR_PROT_PATH_CTL,
0x20, 0x00);
}
@@ -943,28 +943,28 @@
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI])) {
dev_dbg(wsa_dev, "%s: spkr2 enabled\n", __func__);
/* Enable V&I sensing */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX2_SPKR_PROT_PATH_CTL,
0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX3_SPKR_PROT_PATH_CTL,
0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX2_SPKR_PROT_PATH_CTL,
0x0F, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX3_SPKR_PROT_PATH_CTL,
0x0F, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX2_SPKR_PROT_PATH_CTL,
0x10, 0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX3_SPKR_PROT_PATH_CTL,
0x10, 0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX2_SPKR_PROT_PATH_CTL,
0x20, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX3_SPKR_PROT_PATH_CTL,
0x20, 0x00);
}
@@ -973,17 +973,17 @@
if (test_bit(WSA_MACRO_TX0,
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI])) {
/* Disable V&I sensing */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX0_SPKR_PROT_PATH_CTL,
0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX1_SPKR_PROT_PATH_CTL,
0x20, 0x20);
dev_dbg(wsa_dev, "%s: spkr1 disabled\n", __func__);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX0_SPKR_PROT_PATH_CTL,
0x10, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX1_SPKR_PROT_PATH_CTL,
0x10, 0x00);
}
@@ -991,16 +991,16 @@
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI])) {
/* Disable V&I sensing */
dev_dbg(wsa_dev, "%s: spkr2 disabled\n", __func__);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX2_SPKR_PROT_PATH_CTL,
0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX3_SPKR_PROT_PATH_CTL,
0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX2_SPKR_PROT_PATH_CTL,
0x10, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_TX3_SPKR_PROT_PATH_CTL,
0x10, 0x00);
}
@@ -1013,12 +1013,13 @@
static int wsa_macro_enable_mix_path(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 gain_reg;
int offset_val = 0;
int val = 0;
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s %d %s\n", __func__, event, w->name);
switch (w->reg) {
case BOLERO_CDC_WSA_RX0_RX_PATH_MIX_CTL:
@@ -1028,16 +1029,16 @@
gain_reg = BOLERO_CDC_WSA_RX1_RX_VOL_MIX_CTL;
break;
default:
- dev_err(codec->dev, "%s: No gain register avail for %s\n",
+ dev_err(component->dev, "%s: No gain register avail for %s\n",
__func__, w->name);
return 0;
}
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
break;
case SND_SOC_DAPM_POST_PMD:
break;
@@ -1046,7 +1047,7 @@
return 0;
}
-static void wsa_macro_hd2_control(struct snd_soc_codec *codec,
+static void wsa_macro_hd2_control(struct snd_soc_component *component,
u16 reg, int event)
{
u16 hd2_scale_reg;
@@ -1062,27 +1063,34 @@
}
if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x10);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x03, 0x01);
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x04);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x3C, 0x10);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x03, 0x01);
+ snd_soc_component_update_bits(component, hd2_enable_reg,
+ 0x04, 0x04);
}
if (hd2_enable_reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x00);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x03, 0x00);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x00);
+ snd_soc_component_update_bits(component, hd2_enable_reg,
+ 0x04, 0x00);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x03, 0x00);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x3C, 0x00);
}
}
static int wsa_macro_enable_swr(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ch_cnt;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
switch (event) {
@@ -1122,17 +1130,17 @@
return 0;
}
-static int wsa_macro_config_compander(struct snd_soc_codec *codec,
+static int wsa_macro_config_compander(struct snd_soc_component *component,
int comp, int event)
{
u16 comp_ctl0_reg, rx_path_cfg0_reg;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
- dev_dbg(codec->dev, "%s: event %d compander %d, enabled %d\n",
+ dev_dbg(component->dev, "%s: event %d compander %d, enabled %d\n",
__func__, event, comp + 1, wsa_priv->comp_enabled[comp]);
if (!wsa_priv->comp_enabled[comp])
@@ -1145,25 +1153,35 @@
if (SND_SOC_DAPM_EVENT_ON(event)) {
/* Enable Compander Clock */
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, rx_path_cfg0_reg,
+ 0x02, 0x02);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x04);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component, rx_path_cfg0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x04, 0x00);
}
return 0;
}
-static void wsa_macro_enable_softclip_clk(struct snd_soc_codec *codec,
+static void wsa_macro_enable_softclip_clk(struct snd_soc_component *component,
struct wsa_macro_priv *wsa_priv,
int path,
bool enable)
@@ -1173,13 +1191,13 @@
u8 softclip_mux_mask = (1 << path);
u8 softclip_mux_value = (1 << path);
- dev_dbg(codec->dev, "%s: path %d, enable %d\n",
+ dev_dbg(component->dev, "%s: path %d, enable %d\n",
__func__, path, enable);
if (enable) {
if (wsa_priv->softclip_clk_users[path] == 0) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
softclip_clk_reg, 0x01, 0x01);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_RX_INP_MUX_SOFTCLIP_CFG0,
softclip_mux_mask, softclip_mux_value);
}
@@ -1187,16 +1205,16 @@
} else {
wsa_priv->softclip_clk_users[path]--;
if (wsa_priv->softclip_clk_users[path] == 0) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
softclip_clk_reg, 0x01, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_RX_INP_MUX_SOFTCLIP_CFG0,
softclip_mux_mask, 0x00);
}
}
}
-static int wsa_macro_config_softclip(struct snd_soc_codec *codec,
+static int wsa_macro_config_softclip(struct snd_soc_component *component,
int path, int event)
{
u16 softclip_ctrl_reg = 0;
@@ -1204,7 +1222,7 @@
struct wsa_macro_priv *wsa_priv = NULL;
int softclip_path = 0;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
if (path == WSA_MACRO_COMP1)
@@ -1212,7 +1230,7 @@
else if (path == WSA_MACRO_COMP2)
softclip_path = WSA_MACRO_SOFTCLIP1;
- dev_dbg(codec->dev, "%s: event %d path %d, enabled %d\n",
+ dev_dbg(component->dev, "%s: event %d path %d, enabled %d\n",
__func__, event, softclip_path,
wsa_priv->is_softclip_on[softclip_path]);
@@ -1224,16 +1242,18 @@
if (SND_SOC_DAPM_EVENT_ON(event)) {
/* Enable Softclip clock and mux */
- wsa_macro_enable_softclip_clk(codec, wsa_priv, softclip_path,
- true);
+ wsa_macro_enable_softclip_clk(component, wsa_priv,
+ softclip_path, true);
/* Enable Softclip control */
- snd_soc_update_bits(codec, softclip_ctrl_reg, 0x01, 0x01);
+ snd_soc_component_update_bits(component, softclip_ctrl_reg,
+ 0x01, 0x01);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, softclip_ctrl_reg, 0x01, 0x00);
- wsa_macro_enable_softclip_clk(codec, wsa_priv, softclip_path,
- false);
+ snd_soc_component_update_bits(component, softclip_ctrl_reg,
+ 0x01, 0x00);
+ wsa_macro_enable_softclip_clk(component, wsa_priv,
+ softclip_path, false);
}
return 0;
@@ -1260,7 +1280,7 @@
}
static int wsa_macro_enable_prim_interpolator(
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
u16 reg, int event)
{
u16 prim_int_reg;
@@ -1268,7 +1288,7 @@
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
prim_int_reg = wsa_macro_interp_get_primary_reg(reg, &ind);
@@ -1277,37 +1297,39 @@
case SND_SOC_DAPM_PRE_PMU:
wsa_priv->prim_int_users[ind]++;
if (wsa_priv->prim_int_users[ind] == 1) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
prim_int_reg + WSA_MACRO_RX_PATH_CFG3_OFFSET,
0x03, 0x03);
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
0x10, 0x10);
- wsa_macro_hd2_control(codec, prim_int_reg, event);
- snd_soc_update_bits(codec,
+ wsa_macro_hd2_control(component, prim_int_reg, event);
+ snd_soc_component_update_bits(component,
prim_int_reg + WSA_MACRO_RX_PATH_DSMDEM_OFFSET,
0x1, 0x1);
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
1 << 0x5, 1 << 0x5);
}
if ((reg != prim_int_reg) &&
- ((snd_soc_read(codec, prim_int_reg)) & 0x10))
- snd_soc_update_bits(codec, reg, 0x10, 0x10);
+ ((snd_soc_component_read32(
+ component, prim_int_reg)) & 0x10))
+ snd_soc_component_update_bits(component, reg,
+ 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMD:
wsa_priv->prim_int_users[ind]--;
if (wsa_priv->prim_int_users[ind] == 0) {
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
1 << 0x5, 0 << 0x5);
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
0x40, 0x40);
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
0x40, 0x00);
- wsa_macro_hd2_control(codec, prim_int_reg, event);
+ wsa_macro_hd2_control(component, prim_int_reg, event);
}
break;
}
- dev_dbg(codec->dev, "%s: primary interpolator: INT%d, users: %d\n",
+ dev_dbg(component->dev, "%s: primary interpolator: INT%d, users: %d\n",
__func__, ind, wsa_priv->prim_int_users[ind]);
return 0;
}
@@ -1316,7 +1338,8 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 gain_reg;
u16 reg;
int val;
@@ -1324,10 +1347,10 @@
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s %d %s\n", __func__, event, w->name);
if (!(strcmp(w->name, "WSA_RX INT0 INTERP"))) {
reg = BOLERO_CDC_WSA_RX0_RX_PATH_CTL;
@@ -1336,7 +1359,7 @@
reg = BOLERO_CDC_WSA_RX1_RX_PATH_CTL;
gain_reg = BOLERO_CDC_WSA_RX1_RX_VOL_CTL;
} else {
- dev_err(codec->dev, "%s: Interpolator reg not found\n",
+ dev_err(component->dev, "%s: Interpolator reg not found\n",
__func__);
return -EINVAL;
}
@@ -1344,11 +1367,11 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Reset if needed */
- wsa_macro_enable_prim_interpolator(codec, reg, event);
+ wsa_macro_enable_prim_interpolator(component, reg, event);
break;
case SND_SOC_DAPM_POST_PMU:
- wsa_macro_config_compander(codec, w->shift, event);
- wsa_macro_config_softclip(codec, w->shift, event);
+ wsa_macro_config_compander(component, w->shift, event);
+ wsa_macro_config_softclip(component, w->shift, event);
/* apply gain after int clk is enabled */
if ((wsa_priv->spkr_gain_offset ==
WSA_MACRO_GAIN_OFFSET_M1P5_DB) &&
@@ -1356,50 +1379,54 @@
wsa_priv->comp_enabled[WSA_MACRO_COMP2]) &&
(gain_reg == BOLERO_CDC_WSA_RX0_RX_VOL_CTL ||
gain_reg == BOLERO_CDC_WSA_RX1_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_RX0_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- BOLERO_CDC_WSA_RX0_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_RX1_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- BOLERO_CDC_WSA_RX1_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_RX0_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_RX0_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_RX1_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_RX1_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
offset_val = -2;
}
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- wsa_macro_config_ear_spkr_gain(codec, wsa_priv,
+ snd_soc_component_write(component, gain_reg, val);
+ wsa_macro_config_ear_spkr_gain(component, wsa_priv,
event, gain_reg);
break;
case SND_SOC_DAPM_POST_PMD:
- wsa_macro_config_compander(codec, w->shift, event);
- wsa_macro_config_softclip(codec, w->shift, event);
- wsa_macro_enable_prim_interpolator(codec, reg, event);
+ wsa_macro_config_compander(component, w->shift, event);
+ wsa_macro_config_softclip(component, w->shift, event);
+ wsa_macro_enable_prim_interpolator(component, reg, event);
if ((wsa_priv->spkr_gain_offset ==
WSA_MACRO_GAIN_OFFSET_M1P5_DB) &&
(wsa_priv->comp_enabled[WSA_MACRO_COMP1] ||
wsa_priv->comp_enabled[WSA_MACRO_COMP2]) &&
(gain_reg == BOLERO_CDC_WSA_RX0_RX_VOL_CTL ||
gain_reg == BOLERO_CDC_WSA_RX1_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_RX0_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- BOLERO_CDC_WSA_RX0_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_RX1_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- BOLERO_CDC_WSA_RX1_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_RX0_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_RX0_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_RX1_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_RX1_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
offset_val = 2;
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
}
- wsa_macro_config_ear_spkr_gain(codec, wsa_priv,
+ wsa_macro_config_ear_spkr_gain(component, wsa_priv,
event, gain_reg);
break;
}
@@ -1407,7 +1434,7 @@
return 0;
}
-static int wsa_macro_config_ear_spkr_gain(struct snd_soc_codec *codec,
+static int wsa_macro_config_ear_spkr_gain(struct snd_soc_component *component,
struct wsa_macro_priv *wsa_priv,
int event, int gain_reg)
{
@@ -1432,7 +1459,7 @@
(wsa_priv->ear_spkr_gain != 0)) {
/* For example, val is -8(-12+5-1) for 4dB of gain */
val = comp_gain_offset + wsa_priv->ear_spkr_gain - 1;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
dev_dbg(wsa_priv->dev, "%s: RX0 Volume %d dB\n",
__func__, val);
@@ -1446,7 +1473,7 @@
if (wsa_priv->comp_enabled[WSA_MACRO_COMP1] &&
(gain_reg == BOLERO_CDC_WSA_RX0_RX_VOL_CTL) &&
(wsa_priv->ear_spkr_gain != 0)) {
- snd_soc_write(codec, gain_reg, 0x0);
+ snd_soc_component_write(component, gain_reg, 0x0);
dev_dbg(wsa_priv->dev, "%s: Reset RX0 Volume to 0 dB\n",
__func__);
@@ -1461,11 +1488,12 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 boost_path_ctl, boost_path_cfg1;
u16 reg, reg_mix;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
if (!strcmp(w->name, "WSA_RX INT0 CHAIN")) {
boost_path_ctl = BOLERO_CDC_WSA_BOOST0_BOOST_PATH_CTL;
@@ -1478,24 +1506,29 @@
reg = BOLERO_CDC_WSA_RX1_RX_PATH_CTL;
reg_mix = BOLERO_CDC_WSA_RX1_RX_PATH_MIX_CTL;
} else {
- dev_err(codec->dev, "%s: unknown widget: %s\n",
+ dev_err(component->dev, "%s: unknown widget: %s\n",
__func__, w->name);
return -EINVAL;
}
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x01);
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x10);
- if ((snd_soc_read(codec, reg_mix)) & 0x10)
- snd_soc_update_bits(codec, reg_mix, 0x10, 0x00);
+ snd_soc_component_update_bits(component, boost_path_cfg1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, boost_path_ctl,
+ 0x10, 0x10);
+ if ((snd_soc_component_read32(component, reg_mix)) & 0x10)
+ snd_soc_component_update_bits(component, reg_mix,
+ 0x10, 0x00);
break;
case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec, reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, reg, 0x10, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x00);
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x00);
+ snd_soc_component_update_bits(component, boost_path_ctl,
+ 0x10, 0x00);
+ snd_soc_component_update_bits(component, boost_path_cfg1,
+ 0x01, 0x00);
break;
}
@@ -1507,16 +1540,17 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
u16 vbat_path_cfg = 0;
int softclip_path = 0;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
if (!strcmp(w->name, "WSA_RX INT0 VBAT")) {
vbat_path_cfg = BOLERO_CDC_WSA_RX0_RX_PATH_CFG1;
softclip_path = WSA_MACRO_SOFTCLIP0;
@@ -1528,92 +1562,97 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Enable clock for VBAT block */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_PATH_CTL, 0x10, 0x10);
/* Enable VBAT block */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG, 0x01, 0x01);
/* Update interpolator with 384K path */
- snd_soc_update_bits(codec, vbat_path_cfg, 0x80, 0x80);
+ snd_soc_component_update_bits(component, vbat_path_cfg,
+ 0x80, 0x80);
/* Use attenuation mode */
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG, 0x02, 0x00);
/*
* BCL block needs softclip clock and mux config to be enabled
*/
- wsa_macro_enable_softclip_clk(codec, wsa_priv, softclip_path,
- true);
+ wsa_macro_enable_softclip_clk(component, wsa_priv,
+ softclip_path, true);
/* Enable VBAT at channel level */
- snd_soc_update_bits(codec, vbat_path_cfg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, vbat_path_cfg,
+ 0x02, 0x02);
/* Set the ATTK1 gain */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD1,
0xFF, 0xFF);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD2,
0xFF, 0x03);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD3,
0xFF, 0x00);
/* Set the ATTK2 gain */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD4,
0xFF, 0xFF);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD5,
0xFF, 0x03);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD6,
0xFF, 0x00);
/* Set the ATTK3 gain */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD7,
0xFF, 0xFF);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD8,
0xFF, 0x03);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD9,
0xFF, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, vbat_path_cfg, 0x80, 0x00);
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG,
- 0x02, 0x02);
- snd_soc_update_bits(codec, vbat_path_cfg, 0x02, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component, vbat_path_cfg,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, vbat_path_cfg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD1,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD2,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD3,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD4,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD5,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD6,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD7,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD8,
0xFF, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_BCL_GAIN_UPD9,
0xFF, 0x00);
- wsa_macro_enable_softclip_clk(codec, wsa_priv, softclip_path,
- false);
- snd_soc_update_bits(codec,
+ wsa_macro_enable_softclip_clk(component, wsa_priv,
+ softclip_path, false);
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG, 0x01, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_PATH_CTL, 0x10, 0x00);
break;
default:
@@ -1627,17 +1666,19 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
u16 val, ec_tx = 0, ec_hq_reg;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
dev_dbg(wsa_dev, "%s %d %s\n", __func__, event, w->name);
- val = snd_soc_read(codec, BOLERO_CDC_WSA_RX_INP_MUX_RX_MIX_CFG0);
+ val = snd_soc_component_read32(component,
+ BOLERO_CDC_WSA_RX_INP_MUX_RX_MIX_CFG0);
if (!(strcmp(w->name, "WSA RX_MIX EC0_MUX")))
ec_tx = (val & 0x07) - 1;
else
@@ -1649,16 +1690,16 @@
return -EINVAL;
}
if (wsa_priv->ec_hq[ec_tx]) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_RX_INP_MUX_RX_MIX_CFG0,
0x1 << ec_tx, 0x1 << ec_tx);
ec_hq_reg = BOLERO_CDC_WSA_EC_HQ0_EC_REF_HQ_PATH_CTL +
0x20 * ec_tx;
- snd_soc_update_bits(codec, ec_hq_reg, 0x01, 0x01);
+ snd_soc_component_update_bits(component, ec_hq_reg, 0x01, 0x01);
ec_hq_reg = BOLERO_CDC_WSA_EC_HQ0_EC_REF_HQ_CFG0 +
0x20 * ec_tx;
/* default set to 48k */
- snd_soc_update_bits(codec, ec_hq_reg, 0x1E, 0x08);
+ snd_soc_component_update_bits(component, ec_hq_reg, 0x1E, 0x08);
}
return 0;
@@ -1668,13 +1709,14 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int ec_tx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = wsa_priv->ec_hq[ec_tx];
@@ -1684,14 +1726,15 @@
static int wsa_macro_set_ec_hq(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int ec_tx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
int value = ucontrol->value.integer.value[0];
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
dev_dbg(wsa_dev, "%s: enable current %d, new %d\n",
@@ -1705,13 +1748,14 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = wsa_priv->comp_enabled[comp];
@@ -1721,17 +1765,18 @@
static int wsa_macro_set_compander(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
int value = ucontrol->value.integer.value[0];
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
- dev_dbg(codec->dev, "%s: Compander %d enable current %d, new %d\n",
+ dev_dbg(component->dev, "%s: Compander %d enable current %d, new %d\n",
__func__, comp + 1, wsa_priv->comp_enabled[comp], value);
wsa_priv->comp_enabled[comp] = value;
@@ -1741,16 +1786,17 @@
static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = wsa_priv->ear_spkr_gain;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -1759,16 +1805,17 @@
static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
wsa_priv->ear_spkr_gain = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: gain = %d\n", __func__,
+ dev_dbg(component->dev, "%s: gain = %d\n", __func__,
wsa_priv->ear_spkr_gain);
return 0;
@@ -1778,12 +1825,14 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- bst_state_max = snd_soc_read(codec, BOLERO_CDC_WSA_BOOST0_BOOST_CTL);
+ bst_state_max = snd_soc_component_read32(component,
+ BOLERO_CDC_WSA_BOOST0_BOOST_CTL);
bst_state_max = (bst_state_max & 0x0c) >> 2;
ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -1793,13 +1842,15 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_BOOST0_BOOST_CTL,
- 0x0c, bst_state_max);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_BOOST0_BOOST_CTL,
+ 0x0c, bst_state_max);
return 0;
}
@@ -1808,12 +1859,14 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- bst_state_max = snd_soc_read(codec, BOLERO_CDC_WSA_BOOST1_BOOST_CTL);
+ bst_state_max = snd_soc_component_read32(component,
+ BOLERO_CDC_WSA_BOOST1_BOOST_CTL);
bst_state_max = (bst_state_max & 0x0c) >> 2;
ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -1823,13 +1876,15 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_BOOST1_BOOST_CTL,
- 0x0c, bst_state_max);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_BOOST1_BOOST_CTL,
+ 0x0c, bst_state_max);
return 0;
}
@@ -1839,11 +1894,12 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] =
@@ -1856,7 +1912,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
struct snd_soc_dapm_update *update = NULL;
u32 rx_port_value = ucontrol->value.integer.value[0];
@@ -1865,7 +1922,7 @@
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
aif_rst = wsa_priv->rx_port_value[widget->shift];
@@ -1907,13 +1964,15 @@
static int wsa_macro_vbat_bcl_gsm_mode_func_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
ucontrol->value.integer.value[0] =
- ((snd_soc_read(codec, BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG) & 0x04) ?
+ ((snd_soc_component_read32(
+ component, BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG) & 0x04) ?
1 : 0);
- dev_dbg(codec->dev, "%s: value: %lu\n", __func__,
+ dev_dbg(component->dev, "%s: value: %lu\n", __func__,
ucontrol->value.integer.value[0]);
return 0;
@@ -1922,18 +1981,21 @@
static int wsa_macro_vbat_bcl_gsm_mode_func_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: value: %lu\n", __func__,
+ dev_dbg(component->dev, "%s: value: %lu\n", __func__,
ucontrol->value.integer.value[0]);
/* Set Vbat register configuration for GSM mode bit based on value */
if (ucontrol->value.integer.value[0])
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG,
- 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG,
+ 0x04, 0x04);
else
- snd_soc_update_bits(codec, BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG,
- 0x04, 0x00);
+ snd_soc_component_update_bits(component,
+ BOLERO_CDC_WSA_VBAT_BCL_VBAT_CFG,
+ 0x04, 0x00);
return 0;
}
@@ -1941,18 +2003,19 @@
static int wsa_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
int path = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = wsa_priv->is_softclip_on[path];
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -1961,18 +2024,19 @@
static int wsa_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
int path = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
wsa_priv->is_softclip_on[path] = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: soft clip enable for %d: %d\n", __func__,
+ dev_dbg(component->dev, "%s: soft clip enable for %d: %d\n", __func__,
path, wsa_priv->is_softclip_on[path]);
return 0;
@@ -2036,7 +2100,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
u32 dai_id = widget->shift;
@@ -2044,7 +2109,7 @@
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
if (test_bit(spk_tx_id, &wsa_priv->active_ch_mask[dai_id]))
@@ -2060,7 +2125,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
u32 spk_tx_id = mixer->shift;
@@ -2068,7 +2134,7 @@
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
wsa_priv->vi_feed_value = ucontrol->value.integer.value[0];
@@ -2377,43 +2443,43 @@
{BOLERO_CDC_WSA_RX1_RX_PATH_MIX_CFG, 0x01, 0x01},
};
-static void wsa_macro_init_bcl_pmic_reg(struct snd_soc_codec *codec)
+static void wsa_macro_init_bcl_pmic_reg(struct snd_soc_component *component)
{
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!codec) {
- pr_err("%s: NULL codec pointer!\n", __func__);
+ if (!component) {
+ pr_err("%s: NULL component pointer!\n", __func__);
return;
}
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return;
switch (wsa_priv->bcl_pmic_params.id) {
case 0:
/* Enable ID0 to listen to respective PMIC group interrupts */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_DECODE_CTL1, 0x02, 0x02);
/* Update MC_SID0 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_DECODE_CFG1, 0x0F,
wsa_priv->bcl_pmic_params.sid);
/* Update MC_PPID0 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_DECODE_CFG2, 0xFF,
wsa_priv->bcl_pmic_params.ppid);
break;
case 1:
/* Enable ID1 to listen to respective PMIC group interrupts */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_DECODE_CTL1, 0x01, 0x01);
/* Update MC_SID1 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_DECODE_CFG3, 0x0F,
wsa_priv->bcl_pmic_params.sid);
/* Update MC_PPID1 */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
BOLERO_CDC_WSA_VBAT_BCL_VBAT_DECODE_CFG4, 0xFF,
wsa_priv->bcl_pmic_params.ppid);
break;
@@ -2424,17 +2490,17 @@
}
}
-static void wsa_macro_init_reg(struct snd_soc_codec *codec)
+static void wsa_macro_init_reg(struct snd_soc_component *component)
{
int i;
for (i = 0; i < ARRAY_SIZE(wsa_macro_reg_init); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
wsa_macro_reg_init[i].reg,
wsa_macro_reg_init[i].mask,
wsa_macro_reg_init[i].val);
- wsa_macro_init_bcl_pmic_reg(codec);
+ wsa_macro_init_bcl_pmic_reg(component);
}
static int wsa_swrm_clock(void *handle, bool enable)
@@ -2495,22 +2561,23 @@
return ret;
}
-static int wsa_macro_init(struct snd_soc_codec *codec)
+static int wsa_macro_init(struct snd_soc_component *component)
{
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
int ret;
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- wsa_dev = bolero_get_device_ptr(codec->dev, WSA_MACRO);
+ wsa_dev = bolero_get_device_ptr(component->dev, WSA_MACRO);
if (!wsa_dev) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: null device for macro!\n", __func__);
return -EINVAL;
}
wsa_priv = dev_get_drvdata(wsa_dev);
if (!wsa_priv) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: priv is null for macro!\n", __func__);
return -EINVAL;
}
@@ -2535,7 +2602,7 @@
return ret;
}
- ret = snd_soc_add_codec_controls(codec, wsa_macro_snd_controls,
+ ret = snd_soc_add_component_controls(component, wsa_macro_snd_controls,
ARRAY_SIZE(wsa_macro_snd_controls));
if (ret < 0) {
dev_err(wsa_dev, "%s: Failed to add snd_ctls\n", __func__);
@@ -2553,22 +2620,22 @@
snd_soc_dapm_ignore_suspend(dapm, "WSA_TX DEC1_INP");
snd_soc_dapm_sync(dapm);
- wsa_priv->codec = codec;
+ wsa_priv->component = component;
wsa_priv->spkr_gain_offset = WSA_MACRO_GAIN_OFFSET_0_DB;
- wsa_macro_init_reg(codec);
+ wsa_macro_init_reg(component);
return 0;
}
-static int wsa_macro_deinit(struct snd_soc_codec *codec)
+static int wsa_macro_deinit(struct snd_soc_component *component)
{
struct device *wsa_dev = NULL;
struct wsa_macro_priv *wsa_priv = NULL;
- if (!wsa_macro_get_data(codec, &wsa_dev, &wsa_priv, __func__))
+ if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
return -EINVAL;
- wsa_priv->codec = NULL;
+ wsa_priv->component = NULL;
return 0;
}
diff --git a/asoc/codecs/bolero/wsa-macro.h b/asoc/codecs/bolero/wsa-macro.h
index ec1aa9a..f2553c0 100644
--- a/asoc/codecs/bolero/wsa-macro.h
+++ b/asoc/codecs/bolero/wsa-macro.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef WSA_MACRO_H
#define WSA_MACRO_H
@@ -29,16 +21,19 @@
#if IS_ENABLED(CONFIG_WSA_MACRO)
-extern int wsa_macro_set_spkr_mode(struct snd_soc_codec *codec, int mode);
-extern int wsa_macro_set_spkr_gain_offset(struct snd_soc_codec *codec,
+extern int wsa_macro_set_spkr_mode(struct snd_soc_component *component,
+ int mode);
+extern int wsa_macro_set_spkr_gain_offset(struct snd_soc_component *component,
int offset);
#else /* CONFIG_WSA_MACRO */
-static inline int wsa_macro_set_spkr_mode(struct snd_soc_codec *codec, int mode)
+static inline int wsa_macro_set_spkr_mode(struct snd_soc_component *component,
+ int mode)
{
return 0;
}
-static inline int wsa_macro_set_spkr_gain_offset(struct snd_soc_codec *codec,
- int offset);
+static inline int wsa_macro_set_spkr_gain_offset(
+ struct snd_soc_component *component,
+ int offset);
{
return 0;
}
diff --git a/asoc/codecs/core.h b/asoc/codecs/core.h
index c102a55..ab0f0c7 100644
--- a/asoc/codecs/core.h
+++ b/asoc/codecs/core.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __MFD_TABLA_CORE_H__
diff --git a/asoc/codecs/cpe_cmi.h b/asoc/codecs/cpe_cmi.h
index c145a8a..21df2ae 100644
--- a/asoc/codecs/cpe_cmi.h
+++ b/asoc/codecs/cpe_cmi.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __CPE_CMI_H__
diff --git a/asoc/codecs/cpe_core.h b/asoc/codecs/cpe_core.h
index 99504c5..7cfbd43 100644
--- a/asoc/codecs/cpe_core.h
+++ b/asoc/codecs/cpe_core.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __CPE_CORE_H__
@@ -115,35 +107,37 @@
u8 size, u8 *payload));
int (*lsm_dealloc_session)
- (void *core_handle, struct cpe_lsm_session *);
+ (void *core_handle, struct cpe_lsm_session *session);
int (*lsm_open_tx)(void *core_handle,
- struct cpe_lsm_session *, u16, u16);
+ struct cpe_lsm_session *session, u16 app_id,
+ u16 sample_rate);
int (*lsm_close_tx)(void *core_handle,
- struct cpe_lsm_session *);
+ struct cpe_lsm_session *session);
int (*lsm_shmem_alloc)(void *core_handle,
- struct cpe_lsm_session *, u32 size);
+ struct cpe_lsm_session *session, u32 size);
int (*lsm_shmem_dealloc)(void *core_handle,
- struct cpe_lsm_session *);
+ struct cpe_lsm_session *session);
int (*lsm_register_snd_model)(void *core_handle,
- struct cpe_lsm_session *,
- enum lsm_detection_mode, bool);
+ struct cpe_lsm_session *session,
+ enum lsm_detection_mode,
+ bool detect_failure);
int (*lsm_deregister_snd_model)(void *core_handle,
- struct cpe_lsm_session *);
+ struct cpe_lsm_session *session);
int (*lsm_get_afe_out_port_id)(void *core_handle,
struct cpe_lsm_session *session);
int (*lsm_start)(void *core_handle,
- struct cpe_lsm_session *);
+ struct cpe_lsm_session *session);
int (*lsm_stop)(void *core_handle,
- struct cpe_lsm_session *);
+ struct cpe_lsm_session *session);
int (*lsm_lab_control)(void *core_handle,
struct cpe_lsm_session *session,
@@ -164,7 +158,7 @@
struct lsm_params_info *p_info,
void *data, uint32_t param_type);
void (*lsm_get_snd_model_offset)
- (void *core_handle, struct cpe_lsm_session *,
+ (void *core_handle, struct cpe_lsm_session *session,
size_t *offset);
int (*lsm_set_media_fmt_params)(void *core_handle,
struct cpe_lsm_session *session,
@@ -176,7 +170,7 @@
#if IS_ENABLED(CONFIG_SND_SOC_WCD_CPE)
int wcd_cpe_get_lsm_ops(struct wcd_cpe_lsm_ops *lsm_ops);
int wcd_cpe_get_afe_ops(struct wcd_cpe_afe_ops *afe_ops);
-void *wcd_cpe_get_core_handle(struct snd_soc_codec *codec);
+void *wcd_cpe_get_core_handle(struct snd_soc_component *component);
#else /* CONFIG_SND_SOC_WCD_CPE */
static inline int wcd_cpe_get_lsm_ops(struct wcd_cpe_lsm_ops *lsm_ops)
{
@@ -186,7 +180,7 @@
{
return 0;
}
-static inline void *wcd_cpe_get_core_handle(struct snd_soc_codec *codec)
+static inline void *wcd_cpe_get_core_handle(struct snd_soc_component *component)
{
return NULL;
}
diff --git a/asoc/codecs/cpe_err.h b/asoc/codecs/cpe_err.h
index b70dc49..5a2dea1 100644
--- a/asoc/codecs/cpe_err.h
+++ b/asoc/codecs/cpe_err.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015, 2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __CPE_ERR__
diff --git a/asoc/codecs/csra66x0/csra66x0.c b/asoc/codecs/csra66x0/csra66x0.c
index 2189f9b..33e5334 100644
--- a/asoc/codecs/csra66x0/csra66x0.c
+++ b/asoc/codecs/csra66x0/csra66x0.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
#include <linux/delay.h>
@@ -27,6 +19,8 @@
#include <linux/debugfs.h>
#include "csra66x0.h"
+#define DRV_NAME "csra66x0_codec"
+
/* CSRA66X0 register default values */
static struct reg_default csra66x0_reg_defaults[] = {
{CSRA66X0_AUDIO_IF_RX_CONFIG1, 0x00},
@@ -255,7 +249,7 @@
/* codec private data */
struct csra66x0_priv {
struct regmap *regmap;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
int spk_volume_ch1;
int spk_volume_ch2;
int irq;
@@ -320,7 +314,7 @@
{
struct csra66x0_priv *csra66x0 =
(struct csra66x0_priv *) filp->private_data;
- struct snd_soc_codec *codec = csra66x0->codec;
+ struct snd_soc_component *component = csra66x0->component;
char lbuf[32];
int rc;
u32 param[2];
@@ -336,46 +330,47 @@
rc = debugfs_get_parameters(lbuf, param, 2);
if ((param[0] < CSRA66X0_AUDIO_IF_RX_CONFIG1)
|| (param[0] > CSRA66X0_MAX_REGISTER_ADDR)) {
- dev_err(codec->dev, "%s: register address 0x%04X out of range\n",
+ dev_err(component->dev, "%s: register address 0x%04X out of range\n",
__func__, param[0]);
return -EINVAL;
}
if ((param[1] < 0) || (param[1] > 255)) {
- dev_err(codec->dev, "%s: register data 0x%02X out of range\n",
+ dev_err(component->dev, "%s: register data 0x%02X out of range\n",
__func__, param[1]);
return -EINVAL;
}
if (rc == 0)
{
rc = cnt;
- dev_info(codec->dev, "%s: reg[0x%04X]=0x%02X\n",
+ dev_info(component->dev, "%s: reg[0x%04X]=0x%02X\n",
__func__, param[0], param[1]);
- snd_soc_write(codec, param[0], param[1]);
+ snd_soc_component_write(component, param[0], param[1]);
} else {
- dev_err(codec->dev, "%s: write to register addr=0x%04X failed\n",
+ dev_err(component->dev, "%s: write to register addr=0x%04X failed\n",
__func__, param[0]);
}
return rc;
}
-static ssize_t debugfs_csra66x0_reg_show(struct snd_soc_codec *codec,
+static ssize_t debugfs_csra66x0_reg_show(struct snd_soc_component *component,
char __user *ubuf, size_t count, loff_t *ppos)
{
int i, reg_val, len;
ssize_t total = 0;
char tmp_buf[20];
- if (!ubuf || !ppos || !codec || *ppos < 0)
+ if (!ubuf || !ppos || !component || *ppos < 0)
return -EINVAL;
for (i = ((int) *ppos + CSRA66X0_BASE);
i <= CSRA66X0_MAX_REGISTER_ADDR; i++) {
- reg_val = snd_soc_read(codec, i);
+ reg_val = snd_soc_component_read32(component, i);
len = snprintf(tmp_buf, 20, "0x%04X: 0x%02X\n", i, (reg_val & 0xFF));
if ((total + len) >= count - 1)
break;
if (copy_to_user((ubuf + total), tmp_buf, len)) {
- dev_err(codec->dev, "%s: fail to copy reg dump\n", __func__);
+ dev_err(component->dev, "%s: fail to copy reg dump\n",
+ __func__);
total = -EFAULT;
goto copy_err;
}
@@ -392,12 +387,12 @@
{
struct csra66x0_priv *csra66x0 =
(struct csra66x0_priv *) filp->private_data;
- struct snd_soc_codec *codec = csra66x0->codec;
+ struct snd_soc_component *component = csra66x0->component;
ssize_t ret_cnt;
if (!filp || !ppos || !ubuf || *ppos < 0)
return -EINVAL;
- ret_cnt = debugfs_csra66x0_reg_show(codec, ubuf, cnt, ppos);
+ ret_cnt = debugfs_csra66x0_reg_show(component, ubuf, cnt, ppos);
return ret_cnt;
}
@@ -423,16 +418,17 @@
{
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
unsigned int reg_l = mc->reg;
unsigned int reg_r = mc->rreg;
unsigned int val_l, val_r;
- val_l = (snd_soc_read(codec, reg_l) & 0xff) |
- ((snd_soc_read(codec,
+ val_l = (snd_soc_component_read32(component, reg_l) & 0xff) |
+ ((snd_soc_component_read32(component,
CSRA66X0_CH1_VOLUME_1_FA) & (0x01)) << 8);
- val_r = (snd_soc_read(codec, reg_r) & 0xff) |
- ((snd_soc_read(codec,
+ val_r = (snd_soc_component_read32(component, reg_r) & 0xff) |
+ ((snd_soc_component_read32(component,
CSRA66X0_CH2_VOLUME_1_FA) & (0x01)) << 8);
ucontrol->value.integer.value[0] = val_l;
ucontrol->value.integer.value[1] = val_r;
@@ -444,8 +440,10 @@
{
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct csra66x0_priv *csra66x0 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct csra66x0_priv *csra66x0 =
+ snd_soc_component_get_drvdata(component);
unsigned int reg_l = mc->reg;
unsigned int reg_r = mc->rreg;
unsigned int val_l[2];
@@ -457,10 +455,10 @@
val_l[1] = (csra66x0->spk_volume_ch1 & SPK_VOLUME_MSB_MSK) ? 1 : 0;
val_r[0] = csra66x0->spk_volume_ch2 & SPK_VOLUME_LSB_MSK;
val_r[1] = (csra66x0->spk_volume_ch2 & SPK_VOLUME_MSB_MSK) ? 1 : 0;
- snd_soc_write(codec, reg_l, val_l[0]);
- snd_soc_write(codec, reg_r, val_r[0]);
- snd_soc_write(codec, CSRA66X0_CH1_VOLUME_1_FA, val_l[1]);
- snd_soc_write(codec, CSRA66X0_CH2_VOLUME_1_FA, val_r[1]);
+ snd_soc_component_write(component, reg_l, val_l[0]);
+ snd_soc_component_write(component, reg_r, val_r[0]);
+ snd_soc_component_write(component, CSRA66X0_CH1_VOLUME_1_FA, val_l[1]);
+ snd_soc_component_write(component, CSRA66X0_CH2_VOLUME_1_FA, val_r[1]);
return 0;
}
@@ -534,51 +532,66 @@
static int csra66x0_init(struct csra66x0_priv *csra66x0)
{
- struct snd_soc_codec *codec = csra66x0->codec;
+ struct snd_soc_component *component = csra66x0->component;
- dev_dbg(codec->dev, "%s: initialize %s\n",
- __func__, codec->component.name);
+ dev_dbg(component->dev, "%s: initialize %s\n",
+ __func__, component->name);
/* config */
- snd_soc_write(codec, CSRA66X0_CHIP_STATE_CTRL_FA, CONFIG_STATE);
+ snd_soc_component_write(component, CSRA66X0_CHIP_STATE_CTRL_FA,
+ CONFIG_STATE);
/* settle time in HW is min. 500ms before proceeding */
msleep(500);
/* setup */
- snd_soc_write(codec, CSRA66X0_MISC_CONTROL_STATUS_0, 0x09);
- snd_soc_write(codec, CSRA66X0_TEMP_PROT_BACKOFF, 0x0C);
- snd_soc_write(codec, CSRA66X0_EXT_PA_PROTECT_POLARITY, 0x03);
- snd_soc_write(codec, CSRA66X0_PWM_OUTPUT_CONFIG, 0xC8);
+ snd_soc_component_write(component, CSRA66X0_MISC_CONTROL_STATUS_0,
+ 0x09);
+ snd_soc_component_write(component, CSRA66X0_TEMP_PROT_BACKOFF, 0x0C);
+ snd_soc_component_write(component, CSRA66X0_EXT_PA_PROTECT_POLARITY,
+ 0x03);
+ snd_soc_component_write(component, CSRA66X0_PWM_OUTPUT_CONFIG, 0xC8);
csra66x0->spk_volume_ch1 = SPK_VOLUME_M20DB;
csra66x0->spk_volume_ch2 = SPK_VOLUME_M20DB;
- snd_soc_write(codec, CSRA66X0_CH1_VOLUME_0_FA, SPK_VOLUME_M20DB_LSB);
- snd_soc_write(codec, CSRA66X0_CH2_VOLUME_0_FA, SPK_VOLUME_M20DB_LSB);
- snd_soc_write(codec, CSRA66X0_CH1_VOLUME_1_FA, SPK_VOLUME_M20DB_MSB);
- snd_soc_write(codec, CSRA66X0_CH2_VOLUME_1_FA, SPK_VOLUME_M20DB_MSB);
+ snd_soc_component_write(component, CSRA66X0_CH1_VOLUME_0_FA,
+ SPK_VOLUME_M20DB_LSB);
+ snd_soc_component_write(component, CSRA66X0_CH2_VOLUME_0_FA,
+ SPK_VOLUME_M20DB_LSB);
+ snd_soc_component_write(component, CSRA66X0_CH1_VOLUME_1_FA,
+ SPK_VOLUME_M20DB_MSB);
+ snd_soc_component_write(component, CSRA66X0_CH2_VOLUME_1_FA,
+ SPK_VOLUME_M20DB_MSB);
- snd_soc_write(codec, CSRA66X0_DEAD_TIME_CTRL, 0x0);
- snd_soc_write(codec, CSRA66X0_DEAD_TIME_THRESHOLD_0, 0xE7);
- snd_soc_write(codec, CSRA66X0_DEAD_TIME_THRESHOLD_1, 0x26);
- snd_soc_write(codec, CSRA66X0_DEAD_TIME_THRESHOLD_2, 0x40);
+ snd_soc_component_write(component, CSRA66X0_DEAD_TIME_CTRL, 0x0);
+ snd_soc_component_write(component, CSRA66X0_DEAD_TIME_THRESHOLD_0,
+ 0xE7);
+ snd_soc_component_write(component, CSRA66X0_DEAD_TIME_THRESHOLD_1,
+ 0x26);
+ snd_soc_component_write(component, CSRA66X0_DEAD_TIME_THRESHOLD_2,
+ 0x40);
- snd_soc_write(codec, CSRA66X0_MIN_MODULATION_PULSE_WIDTH, 0x7A);
- snd_soc_write(codec, CSRA66X0_CH1_HARD_CLIP_THRESH, 0x00);
- snd_soc_write(codec, CSRA66X0_CH2_HARD_CLIP_THRESH, 0x00);
+ snd_soc_component_write(component, CSRA66X0_MIN_MODULATION_PULSE_WIDTH,
+ 0x7A);
+ snd_soc_component_write(component, CSRA66X0_CH1_HARD_CLIP_THRESH, 0x00);
+ snd_soc_component_write(component, CSRA66X0_CH2_HARD_CLIP_THRESH, 0x00);
- snd_soc_write(codec, CSRA66X0_CH1_DCA_THRESH, 0x40);
- snd_soc_write(codec, CSRA66X0_CH2_DCA_THRESH, 0x40);
- snd_soc_write(codec, CSRA66X0_DCA_ATTACK_RATE, 0x00);
- snd_soc_write(codec, CSRA66X0_DCA_RELEASE_RATE, 0x00);
+ snd_soc_component_write(component, CSRA66X0_CH1_DCA_THRESH, 0x40);
+ snd_soc_component_write(component, CSRA66X0_CH2_DCA_THRESH, 0x40);
+ snd_soc_component_write(component, CSRA66X0_DCA_ATTACK_RATE, 0x00);
+ snd_soc_component_write(component, CSRA66X0_DCA_RELEASE_RATE, 0x00);
if (csra66x0->irq) {
- snd_soc_write(codec, CSRA66X0_PIO0_SELECT, 0x1);
+ snd_soc_component_write(component, CSRA66X0_PIO0_SELECT, 0x1);
if (csra66x0->irq_active_low)
- snd_soc_write(codec, CSRA66X0_IRQ_OUTPUT_POLARITY, 0x0);
+ snd_soc_component_write(component,
+ CSRA66X0_IRQ_OUTPUT_POLARITY, 0x0);
else
- snd_soc_write(codec, CSRA66X0_IRQ_OUTPUT_POLARITY, 0x1);
+ snd_soc_component_write(component,
+ CSRA66X0_IRQ_OUTPUT_POLARITY, 0x1);
- snd_soc_write(codec, CSRA66X0_IRQ_OUTPUT_ENABLE, 0x01);
+ snd_soc_component_write(component,
+ CSRA66X0_IRQ_OUTPUT_ENABLE, 0x01);
} else {
- snd_soc_write(codec, CSRA66X0_IRQ_OUTPUT_ENABLE, 0x00);
+ snd_soc_component_write(component,
+ CSRA66X0_IRQ_OUTPUT_ENABLE, 0x00);
}
/* settle time in HW is min. 500ms before slave initializing */
msleep(500);
@@ -587,37 +600,39 @@
static int csra66x0_reset(struct csra66x0_priv *csra66x0)
{
- struct snd_soc_codec *codec = csra66x0->codec;
+ struct snd_soc_component *component = csra66x0->component;
u16 val;
- val = snd_soc_read(codec, CSRA66X0_FAULT_STATUS_FA);
+ val = snd_soc_component_read32(component, CSRA66X0_FAULT_STATUS_FA);
if (val & FAULT_STATUS_INTERNAL)
- dev_dbg(codec->dev, "%s: FAULT_STATUS_INTERNAL 0x%X\n",
+ dev_dbg(component->dev, "%s: FAULT_STATUS_INTERNAL 0x%X\n",
__func__, val);
if (val & FAULT_STATUS_OTP_INTEGRITY)
- dev_dbg(codec->dev, "%s: FAULT_STATUS_OTP_INTEGRITY 0x%X\n",
+ dev_dbg(component->dev, "%s: FAULT_STATUS_OTP_INTEGRITY 0x%X\n",
__func__, val);
if (val & FAULT_STATUS_PADS2)
- dev_dbg(codec->dev, "%s: FAULT_STATUS_PADS2 0x%X\n",
+ dev_dbg(component->dev, "%s: FAULT_STATUS_PADS2 0x%X\n",
__func__, val);
if (val & FAULT_STATUS_SMPS)
- dev_dbg(codec->dev, "%s: FAULT_STATUS_SMPS 0x%X\n",
+ dev_dbg(component->dev, "%s: FAULT_STATUS_SMPS 0x%X\n",
__func__, val);
if (val & FAULT_STATUS_TEMP)
- dev_dbg(codec->dev, "%s: FAULT_STATUS_TEMP 0x%X\n",
+ dev_dbg(component->dev, "%s: FAULT_STATUS_TEMP 0x%X\n",
__func__, val);
if (val & FAULT_STATUS_PROTECT)
- dev_dbg(codec->dev, "%s: FAULT_STATUS_PROTECT 0x%X\n",
+ dev_dbg(component->dev, "%s: FAULT_STATUS_PROTECT 0x%X\n",
__func__, val);
- dev_dbg(codec->dev, "%s: reset %s\n",
- __func__, codec->component.name);
+ dev_dbg(component->dev, "%s: reset %s\n",
+ __func__, component->name);
/* clear fault state and re-init */
- snd_soc_write(codec, CSRA66X0_FAULT_STATUS_FA, 0x00);
- snd_soc_write(codec, CSRA66X0_IRQ_OUTPUT_STATUS_FA, 0x00);
+ snd_soc_component_write(component, CSRA66X0_FAULT_STATUS_FA, 0x00);
+ snd_soc_component_write(component, CSRA66X0_IRQ_OUTPUT_STATUS_FA, 0x00);
/* apply reset to CSRA66X0 */
- val = snd_soc_read(codec, CSRA66X0_MISC_CONTROL_STATUS_1_FA);
- snd_soc_write(codec, CSRA66X0_MISC_CONTROL_STATUS_1_FA, val | 0x08);
+ val = snd_soc_component_read32(component,
+ CSRA66X0_MISC_CONTROL_STATUS_1_FA);
+ snd_soc_component_write(component, CSRA66X0_MISC_CONTROL_STATUS_1_FA,
+ val | 0x08);
/* wait 500ms after reset to recover CSRA66X0 */
msleep(500);
return 0;
@@ -625,51 +640,58 @@
static int csra66x0_msconfig(struct csra66x0_priv *csra66x0)
{
- struct snd_soc_codec *codec = csra66x0->codec;
+ struct snd_soc_component *component = csra66x0->component;
- dev_dbg(codec->dev, "%s: configure %s\n",
- __func__, codec->component.name);
+ dev_dbg(component->dev, "%s: configure %s\n",
+ __func__, component->name);
/* config */
- snd_soc_write(codec, CSRA66X0_CHIP_STATE_CTRL_FA,
+ snd_soc_component_write(component, CSRA66X0_CHIP_STATE_CTRL_FA,
CONFIG_STATE);
/* settle time in HW is min. 500ms before proceeding */
msleep(500);
- snd_soc_write(codec, CSRA66X0_PIO7_SELECT, 0x04);
- snd_soc_write(codec, CSRA66X0_PIO8_SELECT, 0x04);
+ snd_soc_component_write(component, CSRA66X0_PIO7_SELECT, 0x04);
+ snd_soc_component_write(component, CSRA66X0_PIO8_SELECT, 0x04);
if (csra66x0->is_master) {
/* Master specific config */
- snd_soc_write(codec, CSRA66X0_PIO_PULL_EN0, 0xFF);
- snd_soc_write(codec, CSRA66X0_PIO_PULL_DIR0, 0x80);
- snd_soc_write(codec, CSRA66X0_PIO_PULL_EN1, 0x01);
- snd_soc_write(codec, CSRA66X0_PIO_PULL_DIR1, 0x01);
+ snd_soc_component_write(component,
+ CSRA66X0_PIO_PULL_EN0, 0xFF);
+ snd_soc_component_write(component,
+ CSRA66X0_PIO_PULL_DIR0, 0x80);
+ snd_soc_component_write(component,
+ CSRA66X0_PIO_PULL_EN1, 0x01);
+ snd_soc_component_write(component,
+ CSRA66X0_PIO_PULL_DIR1, 0x01);
} else {
/* Slave specific config */
- snd_soc_write(codec, CSRA66X0_PIO_PULL_EN0, 0x7F);
- snd_soc_write(codec, CSRA66X0_PIO_PULL_EN1, 0x00);
+ snd_soc_component_write(component,
+ CSRA66X0_PIO_PULL_EN0, 0x7F);
+ snd_soc_component_write(component,
+ CSRA66X0_PIO_PULL_EN1, 0x00);
}
- snd_soc_write(codec, CSRA66X0_DCA_CTRL, 0x05);
+ snd_soc_component_write(component, CSRA66X0_DCA_CTRL, 0x05);
return 0;
}
-static int csra66x0_soc_probe(struct snd_soc_codec *codec)
+static int csra66x0_soc_probe(struct snd_soc_component *component)
{
- struct csra66x0_priv *csra66x0 = snd_soc_codec_get_drvdata(codec);
+ struct csra66x0_priv *csra66x0 =
+ snd_soc_component_get_drvdata(component);
struct snd_soc_dapm_context *dapm;
char name[50];
unsigned int i, max_num_cluster_devices;
- csra66x0->codec = codec;
+ csra66x0->component = component;
if (csra66x0->in_cluster) {
- dapm = snd_soc_codec_get_dapm(codec);
- dev_dbg(codec->dev, "%s: assign prefix %s to codec device %s\n",
- __func__, codec->component.name_prefix,
- codec->component.name);
+ dapm = snd_soc_component_get_dapm(component);
+ dev_dbg(component->dev, "%s: assign prefix %s to codec device %s\n",
+ __func__, component->name_prefix,
+ component->name);
/* add device to cluster table */
max_num_cluster_devices = sizeof(csra_clust_dev_tbl)/
sizeof(csra_clust_dev_tbl[0]);
for (i = 0; i < max_num_cluster_devices; i++) {
- if (!strncmp(codec->component.name_prefix,
+ if (!strncmp(component->name_prefix,
csra_clust_dev_tbl[i].csra66x0_prefix,
strlen(
csra_clust_dev_tbl[i].csra66x0_prefix))) {
@@ -677,21 +699,21 @@
break;
}
if (i == max_num_cluster_devices-1)
- dev_warn(codec->dev,
+ dev_warn(component->dev,
"%s: Unknown prefix %s of cluster device %s\n",
- __func__, codec->component.name_prefix,
- codec->component.name);
+ __func__, component->name_prefix,
+ component->name);
}
/* master slave config */
csra66x0_msconfig(csra66x0);
if (dapm->component) {
strlcpy(name, dapm->component->name_prefix,
- sizeof(name));
+ sizeof(name));
strlcat(name, " IN", sizeof(name));
snd_soc_dapm_ignore_suspend(dapm, name);
strlcpy(name, dapm->component->name_prefix,
- sizeof(name));
+ sizeof(name));
strlcat(name, " SPKR", sizeof(name));
snd_soc_dapm_ignore_suspend(dapm, name);
}
@@ -702,53 +724,45 @@
return 0;
}
-static int csra66x0_soc_remove(struct snd_soc_codec *codec)
+static void csra66x0_soc_remove(struct snd_soc_component *component)
{
- snd_soc_write(codec, CSRA66X0_CHIP_STATE_CTRL_FA, STDBY_STATE);
+ snd_soc_component_write(component, CSRA66X0_CHIP_STATE_CTRL_FA,
+ STDBY_STATE);
+ return;
+}
+
+static int csra66x0_soc_suspend(struct snd_soc_component *component)
+{
+ u16 state_reg = snd_soc_component_read32(component,
+ CSRA66X0_CHIP_STATE_CTRL_FA) & 0xFC;
+
+ snd_soc_component_write(component, CSRA66X0_CHIP_STATE_CTRL_FA,
+ state_reg | STDBY_STATE);
return 0;
}
-static int csra66x0_soc_suspend(struct snd_soc_codec *codec)
+static int csra66x0_soc_resume(struct snd_soc_component *component)
{
- u16 state_reg = snd_soc_read(codec, CSRA66X0_CHIP_STATE_CTRL_FA) & 0xFC;
+ u16 state_reg = snd_soc_component_read32(
+ component, CSRA66X0_CHIP_STATE_CTRL_FA) & 0xFC;
- snd_soc_write(codec, CSRA66X0_CHIP_STATE_CTRL_FA, state_reg |
- STDBY_STATE);
+ snd_soc_component_write(component, CSRA66X0_CHIP_STATE_CTRL_FA,
+ state_reg | RUN_STATE);
return 0;
}
-static int csra66x0_soc_resume(struct snd_soc_codec *codec)
-{
- u16 state_reg = snd_soc_read(codec, CSRA66X0_CHIP_STATE_CTRL_FA) & 0xFC;
-
- snd_soc_write(codec, CSRA66X0_CHIP_STATE_CTRL_FA, state_reg |
- RUN_STATE);
- return 0;
-}
-
-static struct regmap *csra66x0_get_regmap(struct device *dev)
-{
- struct csra66x0_priv *csra66x0_ctrl = dev_get_drvdata(dev);
-
- if (!csra66x0_ctrl)
- return NULL;
- return csra66x0_ctrl->regmap;
-}
-
-static struct snd_soc_codec_driver soc_codec_drv_csra66x0 = {
+static const struct snd_soc_component_driver soc_codec_drv_csra66x0 = {
+ .name = DRV_NAME,
.probe = csra66x0_soc_probe,
.remove = csra66x0_soc_remove,
.suspend = csra66x0_soc_suspend,
.resume = csra66x0_soc_resume,
- .get_regmap = csra66x0_get_regmap,
- .component_driver = {
- .controls = csra66x0_snd_controls,
- .num_controls = ARRAY_SIZE(csra66x0_snd_controls),
- .dapm_widgets = csra66x0_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(csra66x0_dapm_widgets),
- .dapm_routes = csra66x0_dapm_routes,
- .num_dapm_routes = ARRAY_SIZE(csra66x0_dapm_routes),
- },
+ .controls = csra66x0_snd_controls,
+ .num_controls = ARRAY_SIZE(csra66x0_snd_controls),
+ .dapm_widgets = csra66x0_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(csra66x0_dapm_widgets),
+ .dapm_routes = csra66x0_dapm_routes,
+ .num_dapm_routes = ARRAY_SIZE(csra66x0_dapm_routes),
};
static struct regmap_config csra66x0_regmap_config = {
@@ -766,19 +780,20 @@
static irqreturn_t csra66x0_irq(int irq, void *data)
{
struct csra66x0_priv *csra66x0 = (struct csra66x0_priv *) data;
- struct snd_soc_codec *codec = csra66x0->codec;
+ struct snd_soc_component *component = csra66x0->component;
u16 val;
unsigned int i, max_num_cluster_devices;
- /* Treat interrupt before codec is initialized as spurious */
- if (codec == NULL)
+ /* Treat interrupt before component is initialized as spurious */
+ if (component == NULL)
return IRQ_NONE;
- dev_dbg(codec->dev, "%s: csra66x0_interrupt triggered by %s\n",
- __func__, codec->component.name);
+ dev_dbg(component->dev, "%s: csra66x0_interrupt triggered by %s\n",
+ __func__, component->name);
/* fault indication */
- val = snd_soc_read(codec, CSRA66X0_IRQ_OUTPUT_STATUS_FA) & 0x1;
+ val = snd_soc_component_read32(component, CSRA66X0_IRQ_OUTPUT_STATUS_FA)
+ & 0x1;
if (!val)
return IRQ_HANDLED;
@@ -788,7 +803,7 @@
sizeof(csra_clust_dev_tbl) /
sizeof(csra_clust_dev_tbl[0]);
for (i = 0; i < max_num_cluster_devices; i++) {
- if (i >= codec->component.card->num_aux_devs)
+ if (i >= component->card->num_aux_devs)
break;
if (csra_clust_dev_tbl[i].csra66x0_ptr == NULL)
continue;
@@ -798,7 +813,7 @@
}
/* reset all master codecs */
for (i = 0; i < max_num_cluster_devices; i++) {
- if (i >= codec->component.card->num_aux_devs)
+ if (i >= component->card->num_aux_devs)
break;
if (csra_clust_dev_tbl[i].csra66x0_ptr == NULL)
continue;
@@ -808,7 +823,7 @@
}
/* recover all codecs */
for (i = 0; i < max_num_cluster_devices; i++) {
- if (i >= codec->component.card->num_aux_devs)
+ if (i >= component->card->num_aux_devs)
break;
if (csra_clust_dev_tbl[i].csra66x0_ptr == NULL)
continue;
@@ -966,7 +981,7 @@
#endif /* CONFIG_DEBUG_FS */
/* register codec */
- ret = snd_soc_register_codec(&client_i2c->dev,
+ ret = snd_soc_register_component(&client_i2c->dev,
&soc_codec_drv_csra66x0, NULL, 0);
if (ret != 0) {
dev_err(&client_i2c->dev, "%s %d: Failed to register codec: %d\n",
@@ -993,7 +1008,7 @@
debugfs_remove_recursive(csra66x0->debugfs_dir);
#endif
}
- snd_soc_unregister_codec(&i2c_client->dev);
+ snd_soc_unregister_component(&i2c_client->dev);
return 0;
}
diff --git a/asoc/codecs/csra66x0/csra66x0.h b/asoc/codecs/csra66x0/csra66x0.h
index 43d83d8..c449d67 100644
--- a/asoc/codecs/csra66x0/csra66x0.h
+++ b/asoc/codecs/csra66x0/csra66x0.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _CSRA66X0_H
diff --git a/asoc/codecs/ep92/ep92.c b/asoc/codecs/ep92/ep92.c
index 52f5e6d..81ff656 100644
--- a/asoc/codecs/ep92/ep92.c
+++ b/asoc/codecs/ep92/ep92.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -29,6 +21,8 @@
#include <linux/workqueue.h>
#include "ep92.h"
+#define DRV_NAME "ep92_codec"
+
#define EP92_POLL_INTERVAL_OFF_MSEC 200
#define EP92_POLL_INTERVAL_ON_MSEC 20
#define EP92_SYSFS_ENTRY_MAX_LEN 64
@@ -99,7 +93,7 @@
/* codec private data */
struct ep92_pdata {
struct regmap *regmap;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct timer_list timer;
struct work_struct read_status_worker;
int irq;
@@ -177,7 +171,7 @@
const char __user *ubuf, size_t cnt, loff_t *ppos)
{
struct ep92_pdata *ep92 = (struct ep92_pdata *) filp->private_data;
- struct snd_soc_codec *codec = ep92->codec;
+ struct snd_soc_component *component = ep92->component;
char lbuf[32];
int rc;
u32 param[2];
@@ -193,45 +187,45 @@
rc = debugfs_get_parameters(lbuf, param, 2);
if ((param[0] < EP92_ISP_MODE_ENTER_ISP)
|| (param[0] > EP92_GENERAL_CONTROL_4)) {
- dev_err(codec->dev, "%s: reg address 0x%02X out of range\n",
+ dev_err(component->dev, "%s: reg address 0x%02X out of range\n",
__func__, param[0]);
return -EINVAL;
}
if ((param[1] < 0) || (param[1] > 255)) {
- dev_err(codec->dev, "%s: reg data 0x%02X out of range\n",
+ dev_err(component->dev, "%s: reg data 0x%02X out of range\n",
__func__, param[1]);
return -EINVAL;
}
if (rc == 0) {
rc = cnt;
- dev_info(codec->dev, "%s: reg[0x%02X]=0x%02X\n",
+ dev_info(component->dev, "%s: reg[0x%02X]=0x%02X\n",
__func__, param[0], param[1]);
- snd_soc_write(codec, param[0], param[1]);
+ snd_soc_component_write(component, param[0], param[1]);
} else {
- dev_err(codec->dev, "%s: write to register addr=0x%02X failed\n",
+ dev_err(component->dev, "%s: write to register addr=0x%02X failed\n",
__func__, param[0]);
}
return rc;
}
-static ssize_t debugfs_ep92_reg_show(struct snd_soc_codec *codec,
+static ssize_t debugfs_ep92_reg_show(struct snd_soc_component *component,
char __user *ubuf, size_t count, loff_t *ppos)
{
int i, reg_val, len;
ssize_t total = 0;
char tmp_buf[20];
- if (!ubuf || !ppos || !codec || *ppos < 0)
+ if (!ubuf || !ppos || !component || *ppos < 0)
return -EINVAL;
for (i = (int) *ppos / 11; i <= EP92_MAX_REGISTER_ADDR; i++) {
- reg_val = snd_soc_read(codec, i);
+ reg_val = snd_soc_component_read32(component, i);
len = snprintf(tmp_buf, 20, "0x%02X: 0x%02X\n", i,
(reg_val & 0xFF));
if ((total + len) > count)
break;
if (copy_to_user((ubuf + total), tmp_buf, len)) {
- dev_err(codec->dev, "%s: fail to copy reg dump\n",
+ dev_err(component->dev, "%s: fail to copy reg dump\n",
__func__);
total = -EFAULT;
goto copy_err;
@@ -248,12 +242,12 @@
char __user *ubuf, size_t cnt, loff_t *ppos)
{
struct ep92_pdata *ep92 = (struct ep92_pdata *) filp->private_data;
- struct snd_soc_codec *codec = ep92->codec;
+ struct snd_soc_component *component = ep92->component;
ssize_t ret_cnt;
if (!filp || !ppos || !ubuf || *ppos < 0)
return -EINVAL;
- ret_cnt = debugfs_ep92_reg_show(codec, ubuf, cnt, ppos);
+ ret_cnt = debugfs_ep92_reg_show(component, ubuf, cnt, ppos);
return ret_cnt;
}
@@ -271,7 +265,8 @@
if (!event || !ep92)
return -EINVAL;
- return kobject_uevent_env(&ep92->codec->dev->kobj, KOBJ_CHANGE, env);
+ return kobject_uevent_env(&ep92->component->dev->kobj,
+ KOBJ_CHANGE, env);
}
static int ep92_startup(struct snd_pcm_substream *substream,
@@ -328,14 +323,15 @@
},
};
-static void ep92_read_general_control(struct snd_soc_codec *codec,
+static void ep92_read_general_control(struct snd_soc_component *component,
struct ep92_pdata *ep92)
{
u8 old, change;
int val;
old = ep92->gi.tx_info;
- ep92->gi.tx_info = snd_soc_read(codec, EP92_BI_GENERAL_INFO_0);
+ ep92->gi.tx_info = snd_soc_component_read32(component,
+ EP92_BI_GENERAL_INFO_0);
if (ep92->gi.tx_info == 0xff) {
pr_debug("ep92 EP92_BI_GENERAL_INFO_0 read 0xff\n");
ep92->gi.tx_info = old;
@@ -366,7 +362,8 @@
}
old = ep92->gi.video_latency;
- ep92->gi.video_latency = snd_soc_read(codec, EP92_BI_GENERAL_INFO_4);
+ ep92->gi.video_latency = snd_soc_component_read32(component,
+ EP92_BI_GENERAL_INFO_4);
if (ep92->gi.video_latency == 0xff) {
pr_debug("ep92 EP92_BI_GENERAL_INFO_4 read 0xff\n");
ep92->gi.video_latency = old;
@@ -381,7 +378,8 @@
}
old = ep92->gc.ctl;
- ep92->gc.ctl = snd_soc_read(codec, EP92_GENERAL_CONTROL_0);
+ ep92->gc.ctl = snd_soc_component_read32(component,
+ EP92_GENERAL_CONTROL_0);
if (ep92->gc.ctl == 0xff) {
pr_debug("ep92 EP92_GENERAL_CONTROL_0 read 0xff\n");
ep92->gc.ctl = old;
@@ -424,7 +422,8 @@
}
old = ep92->gc.rx_sel;
- ep92->gc.rx_sel = snd_soc_read(codec, EP92_GENERAL_CONTROL_1);
+ ep92->gc.rx_sel = snd_soc_component_read32(component,
+ EP92_GENERAL_CONTROL_1);
if (ep92->gc.rx_sel == 0xff) {
pr_debug("ep92 EP92_GENERAL_CONTROL_1 read 0xff\n");
ep92->gc.rx_sel = old;
@@ -437,7 +436,8 @@
}
old = ep92->gc.cec_volume;
- ep92->gc.cec_volume = snd_soc_read(codec, EP92_GENERAL_CONTROL_3);
+ ep92->gc.cec_volume = snd_soc_component_read32(component,
+ EP92_GENERAL_CONTROL_3);
if (ep92->gc.cec_volume == 0xff) {
pr_debug("ep92 EP92_GENERAL_CONTROL_3 read 0xff\n");
ep92->gc.cec_volume = old;
@@ -450,7 +450,8 @@
}
old = ep92->gc.link;
- ep92->gc.link = snd_soc_read(codec, EP92_GENERAL_CONTROL_4);
+ ep92->gc.link = snd_soc_component_read32(component,
+ EP92_GENERAL_CONTROL_4);
if (ep92->gc.link == 0xff) {
pr_debug("ep92 EP92_GENERAL_CONTROL_4 read 0xff\n");
ep92->gc.link = old;
@@ -532,7 +533,7 @@
}
}
-static void ep92_read_audio_info(struct snd_soc_codec *codec,
+static void ep92_read_audio_info(struct snd_soc_component *component,
struct ep92_pdata *ep92)
{
u8 old, change;
@@ -540,7 +541,7 @@
bool send_uevent = false;
old = ep92->ai.system_status_0;
- ep92->ai.system_status_0 = snd_soc_read(codec,
+ ep92->ai.system_status_0 = snd_soc_component_read32(component,
EP92_AUDIO_INFO_SYSTEM_STATUS_0);
if (ep92->ai.system_status_0 == 0xff) {
pr_debug("ep92 EP92_AUDIO_INFO_SYSTEM_STATUS_0 read 0xff\n");
@@ -566,7 +567,7 @@
}
old = ep92->ai.audio_status;
- ep92->ai.audio_status = snd_soc_read(codec,
+ ep92->ai.audio_status = snd_soc_component_read32(component,
EP92_AUDIO_INFO_AUDIO_STATUS);
if (ep92->ai.audio_status == 0xff) {
pr_debug("ep92 EP92_AUDIO_INFO_AUDIO_STATUS read 0xff\n");
@@ -583,7 +584,7 @@
new_mode = ep92->old_mode;
if (ep92->ai.audio_status & EP92_AI_STD_ADO_MASK) {
old = ep92->ai.cs[0];
- ep92->ai.cs[0] = snd_soc_read(codec,
+ ep92->ai.cs[0] = snd_soc_component_read32(component,
EP92_AUDIO_INFO_CHANNEL_STATUS_0);
if (ep92->ai.cs[0] == 0xff) {
pr_debug("ep92 EP92_AUDIO_INFO_CHANNEL_STATUS_0 read 0xff\n");
@@ -603,7 +604,8 @@
ep92->old_mode = new_mode;
old = ep92->ai.cc;
- ep92->ai.cc = snd_soc_read(codec, EP92_AUDIO_INFO_ADO_INFO_FRAME_1);
+ ep92->ai.cc = snd_soc_component_read32(component,
+ EP92_AUDIO_INFO_ADO_INFO_FRAME_1);
if (ep92->ai.cc == 0xff) {
pr_debug("ep92 EP92_AUDIO_INFO_ADO_INFO_FRAME_1 read 0xff\n");
ep92->ai.cc = old;
@@ -618,7 +620,8 @@
}
old = ep92->ai.ca;
- ep92->ai.ca = snd_soc_read(codec, EP92_AUDIO_INFO_ADO_INFO_FRAME_4);
+ ep92->ai.ca = snd_soc_component_read32(component,
+ EP92_AUDIO_INFO_ADO_INFO_FRAME_4);
if (ep92->ai.ca == 0xff) {
pr_debug("ep92 EP92_AUDIO_INFO_ADO_INFO_FRAME_4 read 0xff\n");
ep92->ai.ca = old;
@@ -634,42 +637,33 @@
ep92_send_uevent(ep92, "EP92EVT_AUDIO=MEDIA_CONFIG_CHANGE");
}
-static void ep92_init(struct snd_soc_codec *codec, struct ep92_pdata *ep92)
+static void ep92_init(struct snd_soc_component *component,
+ struct ep92_pdata *ep92)
{
/* update the format information in mixer controls */
- ep92_read_general_control(codec, ep92);
- ep92_read_audio_info(codec, ep92);
+ ep92_read_general_control(component, ep92);
+ ep92_read_audio_info(component, ep92);
}
-static int ep92_probe(struct snd_soc_codec *codec)
+static int ep92_probe(struct snd_soc_component *component)
{
- struct ep92_pdata *ep92 = snd_soc_codec_get_drvdata(codec);
+ struct ep92_pdata *ep92 = snd_soc_component_get_drvdata(component);
- ep92->codec = codec;
- ep92_init(codec, ep92);
+ ep92->component = component;
+ ep92_init(component, ep92);
return 0;
}
-static int ep92_remove(struct snd_soc_codec *codec)
+static void ep92_remove(struct snd_soc_component *component)
{
- return 0;
+ return;
}
-static struct regmap *ep92_get_regmap(struct device *dev)
-{
- struct ep92_pdata *ep92_ctrl = dev_get_drvdata(dev);
-
- if (!ep92_ctrl)
- return NULL;
-
- return ep92_ctrl->regmap;
-}
-
-static struct snd_soc_codec_driver soc_codec_drv_ep92 = {
+static const struct snd_soc_component_driver soc_codec_drv_ep92 = {
+ .name = DRV_NAME,
.probe = ep92_probe,
.remove = ep92_remove,
- .get_regmap = ep92_get_regmap,
};
static struct regmap_config ep92_regmap_config = {
@@ -688,18 +682,19 @@
{
struct ep92_pdata *ep92 = container_of(work, struct ep92_pdata,
read_status_worker);
- struct snd_soc_codec *codec = ep92->codec;
+ struct snd_soc_component *component = ep92->component;
u8 val;
/* No polling before codec is initialized */
- if (codec == NULL)
+ if (component == NULL)
return;
/* check ADO_CHF that is set when audio format has changed */
- val = snd_soc_read(codec, EP92_BI_GENERAL_INFO_1);
+ val = snd_soc_component_read32(component, EP92_BI_GENERAL_INFO_1);
if (val == 0xff) {
/* workaround for Nak'ed first read */
- val = snd_soc_read(codec, EP92_BI_GENERAL_INFO_1);
+ val = snd_soc_component_read32(component,
+ EP92_BI_GENERAL_INFO_1);
if (val == 0xff)
return; /* assume device not present */
}
@@ -711,31 +706,31 @@
pr_debug("ep92 CEC change trigger.\n");
/* check for general control changes */
- ep92_read_general_control(codec, ep92);
+ ep92_read_general_control(component, ep92);
/* update the format information in mixer controls */
- ep92_read_audio_info(codec, ep92);
+ ep92_read_audio_info(component, ep92);
}
static irqreturn_t ep92_irq(int irq, void *data)
{
struct ep92_pdata *ep92 = data;
- struct snd_soc_codec *codec = ep92->codec;
+ struct snd_soc_component *component = ep92->component;
/* Treat interrupt before codec is initialized as spurious */
- if (codec == NULL)
+ if (component == NULL)
return IRQ_NONE;
- dev_dbg(codec->dev, "ep92_interrupt\n");
+ dev_dbg(component->dev, "ep92_interrupt\n");
schedule_work(&ep92->read_status_worker);
return IRQ_HANDLED;
};
-void ep92_poll_status(unsigned long data)
+void ep92_poll_status(struct timer_list *t)
{
- struct ep92_pdata *ep92 = (struct ep92_pdata *)data;
+ struct ep92_pdata *ep92 = from_timer(ep92, t, timer);
u32 poll_msec;
if ((ep92->gc.ctl & EP92_GC_POWER_MASK) == 0)
@@ -1046,10 +1041,11 @@
goto end;
}
- reg = snd_soc_read(ep92->codec, EP92_GENERAL_CONTROL_2);
+ reg = snd_soc_component_read32(ep92->component,
+ EP92_GENERAL_CONTROL_2);
reg &= ~EP92_GC_ARC_DIS_MASK;
reg |= ((val << EP92_GC_ARC_DIS_SHIFT) & EP92_GC_ARC_DIS_MASK);
- snd_soc_write(ep92->codec, EP92_GENERAL_CONTROL_2, reg);
+ snd_soc_component_write(ep92->component, EP92_GENERAL_CONTROL_2, reg);
ep92->gc.ctl2 &= ~EP92_GC_ARC_DIS_MASK;
ep92->gc.ctl2 |= (val << EP92_GC_ARC_DIS_SHIFT) & EP92_GC_ARC_DIS_MASK;
@@ -1100,10 +1096,10 @@
goto end;
}
- reg = snd_soc_read(ep92->codec, EP92_GENERAL_CONTROL_0);
+ reg = snd_soc_component_read32(ep92->component, EP92_GENERAL_CONTROL_0);
reg &= ~EP92_GC_POWER_MASK;
reg |= (val << EP92_GC_POWER_SHIFT) & EP92_GC_POWER_MASK;
- snd_soc_write(ep92->codec, EP92_GENERAL_CONTROL_0, reg);
+ snd_soc_component_write(ep92->component, EP92_GENERAL_CONTROL_0, reg);
ep92->gc.ctl &= ~EP92_GC_POWER_MASK;
ep92->gc.ctl |= (val << EP92_GC_POWER_SHIFT) & EP92_GC_POWER_MASK;
@@ -1154,10 +1150,11 @@
goto end;
}
- reg = snd_soc_read(ep92->codec, EP92_GENERAL_CONTROL_0);
+ reg = snd_soc_component_read32(ep92->component,
+ EP92_GENERAL_CONTROL_0);
reg &= ~EP92_GC_AUDIO_PATH_MASK;
reg |= (val << EP92_GC_AUDIO_PATH_SHIFT) & EP92_GC_AUDIO_PATH_MASK;
- snd_soc_write(ep92->codec, EP92_GENERAL_CONTROL_0, reg);
+ snd_soc_component_write(ep92->component, EP92_GENERAL_CONTROL_0, reg);
ep92->gc.ctl &= ~EP92_GC_AUDIO_PATH_MASK;
ep92->gc.ctl |= (val << EP92_GC_AUDIO_PATH_SHIFT) &
EP92_GC_AUDIO_PATH_MASK;
@@ -1209,10 +1206,11 @@
goto end;
}
- reg = snd_soc_read(ep92->codec, EP92_GENERAL_CONTROL_1);
+ reg = snd_soc_component_read32(ep92->component,
+ EP92_GENERAL_CONTROL_1);
reg &= ~EP92_GC_RX_SEL_MASK;
reg |= (val << EP92_GC_RX_SEL_SHIFT) & EP92_GC_RX_SEL_MASK;
- snd_soc_write(ep92->codec, EP92_GENERAL_CONTROL_1, reg);
+ snd_soc_component_write(ep92->component, EP92_GENERAL_CONTROL_1, reg);
ep92->gc.rx_sel &= ~EP92_GC_RX_SEL_MASK;
ep92->gc.rx_sel |= (val << EP92_GC_RX_SEL_SHIFT) & EP92_GC_RX_SEL_MASK;
@@ -1263,10 +1261,10 @@
goto end;
}
- reg = snd_soc_read(ep92->codec, EP92_GENERAL_CONTROL_0);
+ reg = snd_soc_component_read32(ep92->component, EP92_GENERAL_CONTROL_0);
reg &= ~EP92_GC_AUDIO_PATH_MASK;
reg |= (val << EP92_GC_AUDIO_PATH_SHIFT) & EP92_GC_AUDIO_PATH_MASK;
- snd_soc_write(ep92->codec, EP92_GENERAL_CONTROL_0, reg);
+ snd_soc_component_write(ep92->component, EP92_GENERAL_CONTROL_0, reg);
ep92->gc.ctl &= ~EP92_GC_AUDIO_PATH_MASK;
ep92->gc.ctl |= (val << EP92_GC_AUDIO_PATH_SHIFT) &
EP92_GC_AUDIO_PATH_MASK;
@@ -1318,10 +1316,10 @@
goto end;
}
- reg = snd_soc_read(ep92->codec, EP92_GENERAL_CONTROL_0);
+ reg = snd_soc_component_read32(ep92->component, EP92_GENERAL_CONTROL_0);
reg &= ~EP92_GC_CEC_MUTE_MASK;
reg |= (val << EP92_GC_CEC_MUTE_SHIFT) & EP92_GC_CEC_MUTE_MASK;
- snd_soc_write(ep92->codec, EP92_GENERAL_CONTROL_0, reg);
+ snd_soc_component_write(ep92->component, EP92_GENERAL_CONTROL_0, reg);
ep92->gc.ctl &= ~EP92_GC_CEC_MUTE_MASK;
ep92->gc.ctl |= (val << EP92_GC_CEC_MUTE_SHIFT) &
EP92_GC_CEC_MUTE_MASK;
@@ -1375,7 +1373,7 @@
}
reg = val & EP92_GC_CEC_VOLUME_MASK;
- snd_soc_write(ep92->codec, EP92_GENERAL_CONTROL_3, reg);
+ snd_soc_component_write(ep92->component, EP92_GENERAL_CONTROL_3, reg);
ep92->gc.cec_volume = val & EP92_GC_CEC_VOLUME_MASK;
rc = strnlen(buf, EP92_SYSFS_ENTRY_MAX_LEN);
@@ -1493,8 +1491,7 @@
}
/* poll status if IRQ is not configured */
if (ep92->irq == 0) {
- setup_timer(&ep92->timer, ep92_poll_status,
- (unsigned long)ep92);
+ timer_setup(&ep92->timer, ep92_poll_status, 0);
mod_timer(&ep92->timer, jiffies +
msecs_to_jiffies(EP92_POLL_INTERVAL_OFF_MSEC));
}
@@ -1533,7 +1530,7 @@
#endif /* CONFIG_DEBUG_FS */
/* register codec */
- ret = snd_soc_register_codec(&client->dev, &soc_codec_drv_ep92,
+ ret = snd_soc_register_component(&client->dev, &soc_codec_drv_ep92,
ep92_dai, ARRAY_SIZE(ep92_dai));
if (ret) {
dev_err(&client->dev,
@@ -1551,7 +1548,7 @@
return 0;
err_sysfs:
- snd_soc_unregister_codec(&client->dev);
+ snd_soc_unregister_component(&client->dev);
err_reg:
if (ep92->irq == 0)
del_timer(&ep92->timer);
@@ -1572,7 +1569,7 @@
debugfs_remove_recursive(ep92->debugfs_dir);
#endif
}
- snd_soc_unregister_codec(&client->dev);
+ snd_soc_unregister_component(&client->dev);
ep92_sysfs_remove(client, ep92);
diff --git a/asoc/codecs/ep92/ep92.h b/asoc/codecs/ep92/ep92.h
index ad067ea..7aafab2 100644
--- a/asoc/codecs/ep92/ep92.h
+++ b/asoc/codecs/ep92/ep92.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __EP92_H__
diff --git a/asoc/codecs/msm-cdc-pinctrl.c b/asoc/codecs/msm-cdc-pinctrl.c
index 79e322f..901864a 100644
--- a/asoc/codecs/msm-cdc-pinctrl.c
+++ b/asoc/codecs/msm-cdc-pinctrl.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/asoc/codecs/msm-cdc-pinctrl.h b/asoc/codecs/msm-cdc-pinctrl.h
index 4286fff..3bd3443 100644
--- a/asoc/codecs/msm-cdc-pinctrl.h
+++ b/asoc/codecs/msm-cdc-pinctrl.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __MFD_CDC_PINCTRL_H_
diff --git a/asoc/codecs/msm-cdc-supply.c b/asoc/codecs/msm-cdc-supply.c
index 1b3c5f9..751d81e 100644
--- a/asoc/codecs/msm-cdc-supply.c
+++ b/asoc/codecs/msm-cdc-supply.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/asoc/codecs/msm-cdc-supply.h b/asoc/codecs/msm-cdc-supply.h
index b6516fa..6d7b41a 100644
--- a/asoc/codecs/msm-cdc-supply.h
+++ b/asoc/codecs/msm-cdc-supply.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2016, 2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __CODEC_POWER_SUPPLY_H__
diff --git a/asoc/codecs/msm_hdmi_codec_rx.c b/asoc/codecs/msm_hdmi_codec_rx.c
index 07e1cef..95bb26d 100644
--- a/asoc/codecs/msm_hdmi_codec_rx.c
+++ b/asoc/codecs/msm_hdmi_codec_rx.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -19,6 +11,8 @@
#include <sound/soc.h>
#include <linux/msm_ext_display.h>
+#define DRV_NAME "HDMI_codec"
+
#define MSM_EXT_DISP_PCM_RATES SNDRV_PCM_RATE_48000
#define AUD_EXT_DISP_ACK_DISCONNECT (AUDIO_ACK_CONNECT ^ AUDIO_ACK_CONNECT)
#define AUD_EXT_DISP_ACK_CONNECT (AUDIO_ACK_CONNECT)
@@ -72,29 +66,30 @@
static int msm_ext_disp_edid_ctl_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct msm_ext_disp_audio_codec_rx_data *codec_data;
struct msm_ext_disp_audio_edid_blk edid_blk;
int rc = 0;
struct msm_ext_disp_codec_id codec_info;
int dai_id = kcontrol->private_value;
- codec_data = snd_soc_codec_get_drvdata(codec);
+ codec_data = snd_soc_component_get_drvdata(component);
if (!codec_data) {
- dev_err(codec->dev, "%s: codec_data is NULL\n", __func__);
+ dev_err(component->dev, "%s: codec_data is NULL\n", __func__);
return -EINVAL;
}
if (!codec_data->ext_disp_ops.get_audio_edid_blk) {
- dev_dbg(codec->dev, "%s: get_audio_edid_blk() is NULL\n",
+ dev_dbg(component->dev, "%s: get_audio_edid_blk() is NULL\n",
__func__);
uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
uinfo->count = 0;
return 0;
}
- dev_dbg(codec->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
+ dev_dbg(component->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
codec_data->ctl[dai_id], codec_data->stream[dai_id]);
mutex_lock(&codec_data->dp_ops_lock);
@@ -108,28 +103,29 @@
edid_blk.spk_alloc_data_blk_size;
}
- dev_dbg(codec->dev, "%s: count: %d\n", __func__, uinfo->count);
+ dev_dbg(component->dev, "%s: count: %d\n", __func__, uinfo->count);
return rc;
}
static int msm_ext_disp_edid_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) {
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct msm_ext_disp_audio_codec_rx_data *codec_data;
struct msm_ext_disp_audio_edid_blk edid_blk;
struct msm_ext_disp_codec_id codec_info;
int rc = 0;
int dai_id = kcontrol->private_value;
- codec_data = snd_soc_codec_get_drvdata(codec);
+ codec_data = snd_soc_component_get_drvdata(component);
if (!codec_data || !codec_data->ext_disp_ops.get_audio_edid_blk) {
- dev_err(codec->dev, "%s: codec_data or get_audio_edid_blk() is NULL\n",
+ dev_err(component->dev, "%s: codec_data or get_audio_edid_blk() is NULL\n",
__func__);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
+ dev_dbg(component->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
codec_data->ctl[dai_id], codec_data->stream[dai_id]);
mutex_lock(&codec_data->dp_ops_lock);
@@ -141,7 +137,7 @@
if (sizeof(ucontrol->value.bytes.data) <
(edid_blk.audio_data_blk_size +
edid_blk.spk_alloc_data_blk_size)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Not enough memory to copy EDID data\n",
__func__);
return -ENOMEM;
@@ -155,7 +151,7 @@
edid_blk.spk_alloc_data_blk,
edid_blk.spk_alloc_data_blk_size);
- dev_dbg(codec->dev, "%s: data_blk_size:%d, spk_alloc_data_blk_size:%d\n",
+ dev_dbg(component->dev, "%s: data_blk_size:%d, spk_alloc_data_blk_size:%d\n",
__func__, edid_blk.audio_data_blk_size,
edid_blk.spk_alloc_data_blk_size);
}
@@ -166,7 +162,8 @@
static int msm_ext_disp_audio_type_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct msm_ext_disp_audio_codec_rx_data *codec_data;
enum msm_ext_disp_cable_state cable_state;
enum msm_ext_disp_type disp_type;
@@ -174,16 +171,16 @@
int rc = 0;
int dai_id = ((struct soc_enum *) kcontrol->private_value)->shift_l;
- codec_data = snd_soc_codec_get_drvdata(codec);
+ codec_data = snd_soc_component_get_drvdata(component);
if (!codec_data ||
!codec_data->ext_disp_ops.get_audio_edid_blk ||
!codec_data->ext_disp_ops.get_intf_id) {
- dev_err(codec->dev, "%s: codec_data, get_audio_edid_blk() or get_intf_id is NULL\n",
+ dev_err(component->dev, "%s: codec_data, get_audio_edid_blk() or get_intf_id is NULL\n",
__func__);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
+ dev_dbg(component->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
codec_data->ctl[dai_id], codec_data->stream[dai_id]);
mutex_lock(&codec_data->dp_ops_lock);
@@ -191,7 +188,7 @@
cable_state = codec_data->ext_disp_ops.cable_status(
codec_data->ext_disp_core_pdev, 1);
if (cable_state < 0) {
- dev_err(codec->dev, "%s: Error retrieving cable state from ext_disp, err:%d\n",
+ dev_err(component->dev, "%s: Error retrieving cable state from ext_disp, err:%d\n",
__func__, cable_state);
rc = cable_state;
goto cable_err;
@@ -199,7 +196,7 @@
codec_data->cable_status = cable_state;
if (cable_state == EXT_DISPLAY_CABLE_DISCONNECT) {
- dev_err(codec->dev, "%s: Display cable disconnected\n",
+ dev_err(component->dev, "%s: Display cable disconnected\n",
__func__);
ucontrol->value.integer.value[0] = 0;
rc = 0;
@@ -221,14 +218,14 @@
break;
default:
rc = -EINVAL;
- dev_err(codec->dev, "%s: Invalid disp_type:%d\n",
+ dev_err(component->dev, "%s: Invalid disp_type:%d\n",
__func__, disp_type);
goto done;
}
- dev_dbg(codec->dev, "%s: Display type: %d\n",
+ dev_dbg(component->dev, "%s: Display type: %d\n",
__func__, disp_type);
} else {
- dev_err(codec->dev, "%s: Error retrieving disp_type from ext_disp, err:%d\n",
+ dev_err(component->dev, "%s: Error retrieving disp_type from ext_disp, err:%d\n",
__func__, disp_type);
rc = disp_type;
}
@@ -243,24 +240,25 @@
static int msm_ext_disp_audio_ack_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct msm_ext_disp_audio_codec_rx_data *codec_data;
u32 ack_state = 0;
struct msm_ext_disp_codec_id codec_info;
int rc = 0;
int dai_id = ((struct soc_enum *) kcontrol->private_value)->shift_l;
- codec_data = snd_soc_codec_get_drvdata(codec);
+ codec_data = snd_soc_component_get_drvdata(component);
if (!codec_data ||
!codec_data->ext_disp_ops.acknowledge) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: codec_data or ops acknowledge() is NULL\n",
__func__);
rc = -EINVAL;
goto done;
}
- dev_dbg(codec->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
+ dev_dbg(component->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
codec_data->ctl[dai_id], codec_data->stream[dai_id]);
switch (ucontrol->value.enumerated.item[0]) {
@@ -275,12 +273,12 @@
break;
default:
rc = -EINVAL;
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: invalid value %d for mixer ctl\n",
__func__, ucontrol->value.enumerated.item[0]);
goto done;
}
- dev_dbg(codec->dev, "%s: control %d, ack set value 0x%x\n",
+ dev_dbg(component->dev, "%s: control %d, ack set value 0x%x\n",
__func__, ucontrol->value.enumerated.item[0], ack_state);
mutex_lock(&codec_data->dp_ops_lock);
@@ -289,7 +287,7 @@
codec_data->ext_disp_core_pdev, ack_state);
mutex_unlock(&codec_data->dp_ops_lock);
if (rc < 0) {
- dev_err(codec->dev, "%s: error from acknowledge(), err:%d\n",
+ dev_err(component->dev, "%s: error from acknowledge(), err:%d\n",
__func__, rc);
}
@@ -300,14 +298,15 @@
static int msm_ext_disp_audio_device_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
struct msm_ext_disp_audio_codec_rx_data *codec_data;
int rc = 0;
int dai_id = ((struct soc_enum *) kcontrol->private_value)->shift_l;
- codec_data = snd_soc_codec_get_drvdata(codec);
+ codec_data = snd_soc_component_get_drvdata(component);
if (!codec_data) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: codec_data or ops acknowledge() is NULL\n",
__func__);
rc = -EINVAL;
@@ -379,7 +378,7 @@
int ret = 0;
struct msm_ext_disp_codec_id codec_info;
struct msm_ext_disp_audio_codec_rx_data *codec_data =
- dev_get_drvdata(dai->codec->dev);
+ dev_get_drvdata(dai->component->dev);
if (!codec_data || !codec_data->ext_disp_ops.cable_status) {
dev_err(dai->dev, "%s() codec_data or cable_status is null\n",
@@ -387,7 +386,8 @@
return -EINVAL;
}
- dev_dbg(dai->codec->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
+ dev_dbg(dai->component->dev, "%s: DP ctl id %d Stream id %d\n",
+ __func__,
codec_data->ctl[dai->id], codec_data->stream[dai->id]);
mutex_lock(&codec_data->dp_ops_lock);
@@ -425,7 +425,7 @@
struct msm_ext_disp_audio_setup_params audio_setup_params = {0};
struct msm_ext_disp_audio_codec_rx_data *codec_data =
- dev_get_drvdata(dai->codec->dev);
+ dev_get_drvdata(dai->component->dev);
if (!codec_data || !codec_data->ext_disp_ops.audio_info_setup) {
dev_err(dai->dev, "%s: codec_data or audio_info_setup is null\n",
@@ -433,7 +433,8 @@
return -EINVAL;
}
- dev_dbg(dai->codec->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
+ dev_dbg(dai->component->dev, "%s: DP ctl id %d Stream id %d\n",
+ __func__,
codec_data->ctl[dai->id], codec_data->stream[dai->id]);
if (codec_data->cable_status < 0) {
@@ -515,7 +516,7 @@
struct msm_ext_disp_codec_id codec_info;
struct msm_ext_disp_audio_codec_rx_data *codec_data =
- dev_get_drvdata(dai->codec->dev);
+ dev_get_drvdata(dai->component->dev);
if (!codec_data || !codec_data->ext_disp_ops.teardown_done ||
!codec_data->ext_disp_ops.cable_status) {
@@ -524,7 +525,8 @@
return;
}
- dev_dbg(dai->codec->dev, "%s: DP ctl id %d Stream id %d\n", __func__,
+ dev_dbg(dai->component->dev, "%s: DP ctl id %d Stream id %d\n",
+ __func__,
codec_data->ctl[dai->id], codec_data->stream[dai->id]);
mutex_lock(&codec_data->dp_ops_lock);
@@ -542,7 +544,8 @@
mutex_unlock(&codec_data->dp_ops_lock);
}
-static int msm_ext_disp_audio_codec_rx_probe(struct snd_soc_codec *codec)
+static int msm_ext_disp_audio_codec_rx_probe(
+ struct snd_soc_component *component)
{
struct msm_ext_disp_audio_codec_rx_data *codec_data;
struct device_node *of_node_parent = NULL;
@@ -551,14 +554,14 @@
GFP_KERNEL);
if (!codec_data) {
- dev_err(codec->dev, "%s(): fail to allocate dai data\n",
+ dev_err(component->dev, "%s(): fail to allocate dai data\n",
__func__);
return -ENOMEM;
}
- of_node_parent = of_get_parent(codec->dev->of_node);
+ of_node_parent = of_get_parent(component->dev->of_node);
if (!of_node_parent) {
- dev_err(codec->dev, "%s(): Parent device tree node not found\n",
+ dev_err(component->dev, "%s(): Parent device tree node not found\n",
__func__);
kfree(codec_data);
return -ENODEV;
@@ -566,37 +569,39 @@
codec_data->ext_disp_core_pdev = of_find_device_by_node(of_node_parent);
if (!codec_data->ext_disp_core_pdev) {
- dev_err(codec->dev, "%s(): can't get parent pdev\n", __func__);
+ dev_err(component->dev, "%s(): can't get parent pdev\n",
+ __func__);
kfree(codec_data);
return -ENODEV;
}
if (msm_ext_disp_register_audio_codec(codec_data->ext_disp_core_pdev,
&codec_data->ext_disp_ops)) {
- dev_err(codec->dev, "%s(): can't register with ext disp core",
+ dev_err(component->dev, "%s(): can't register with ext disp core",
__func__);
kfree(codec_data);
return -ENODEV;
}
mutex_init(&codec_data->dp_ops_lock);
- dev_set_drvdata(codec->dev, codec_data);
+ dev_set_drvdata(component->dev, codec_data);
- dev_dbg(codec->dev, "%s(): registered %s with ext disp core\n",
- __func__, codec->component.name);
+ dev_dbg(component->dev, "%s(): registered %s with ext disp core\n",
+ __func__, component->name);
return 0;
}
-static int msm_ext_disp_audio_codec_rx_remove(struct snd_soc_codec *codec)
+static void msm_ext_disp_audio_codec_rx_remove(
+ struct snd_soc_component *component)
{
struct msm_ext_disp_audio_codec_rx_data *codec_data;
- codec_data = dev_get_drvdata(codec->dev);
+ codec_data = dev_get_drvdata(component->dev);
mutex_destroy(&codec_data->dp_ops_lock);
kfree(codec_data);
- return 0;
+ return;
}
static struct snd_soc_dai_ops msm_ext_disp_audio_codec_rx_dai_ops = {
@@ -656,13 +661,12 @@
},
};
-static struct snd_soc_codec_driver msm_ext_disp_audio_codec_rx_soc_driver = {
+static const struct snd_soc_component_driver msm_ext_disp_codec_rx_driver = {
+ .name = DRV_NAME,
.probe = msm_ext_disp_audio_codec_rx_probe,
.remove = msm_ext_disp_audio_codec_rx_remove,
- .component_driver = {
- .controls = msm_ext_disp_codec_rx_controls,
- .num_controls = ARRAY_SIZE(msm_ext_disp_codec_rx_controls),
- },
+ .controls = msm_ext_disp_codec_rx_controls,
+ .num_controls = ARRAY_SIZE(msm_ext_disp_codec_rx_controls),
};
static int msm_ext_disp_audio_codec_rx_plat_probe(
@@ -671,8 +675,8 @@
dev_dbg(&pdev->dev, "%s(): dev name %s\n", __func__,
dev_name(&pdev->dev));
- return snd_soc_register_codec(&pdev->dev,
- &msm_ext_disp_audio_codec_rx_soc_driver,
+ return snd_soc_register_component(&pdev->dev,
+ &msm_ext_disp_codec_rx_driver,
msm_ext_disp_audio_codec_rx_dais,
ARRAY_SIZE(msm_ext_disp_audio_codec_rx_dais));
}
@@ -680,7 +684,7 @@
static int msm_ext_disp_audio_codec_rx_plat_remove(
struct platform_device *pdev)
{
- snd_soc_unregister_codec(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
static const struct of_device_id msm_ext_disp_audio_codec_rx_dt_match[] = {
diff --git a/asoc/codecs/msm_stub.c b/asoc/codecs/msm_stub.c
index 68e55ae..a27111a 100644
--- a/asoc/codecs/msm_stub.c
+++ b/asoc/codecs/msm_stub.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2011-2014, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2011-2014, 2017-2018 The Linux Foundation. All rights reserved.
+
*/
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -17,6 +10,8 @@
#include <sound/pcm.h>
#include <sound/soc.h>
+#define DRV_NAME "msm-stub-codec"
+
/* A dummy driver useful only to advertise hardware parameters */
static struct snd_soc_dai_driver msm_stub_dais[] = {
{
@@ -42,19 +37,21 @@
},
};
-static struct snd_soc_codec_driver soc_msm_stub = {};
+static const struct snd_soc_component_driver soc_msm_stub = {
+ .name = DRV_NAME,
+};
static int msm_stub_dev_probe(struct platform_device *pdev)
{
dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
- return snd_soc_register_codec(&pdev->dev,
+ return snd_soc_register_component(&pdev->dev,
&soc_msm_stub, msm_stub_dais, ARRAY_SIZE(msm_stub_dais));
}
static int msm_stub_dev_remove(struct platform_device *pdev)
{
- snd_soc_unregister_codec(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
static const struct of_device_id msm_stub_codec_dt_match[] = {
diff --git a/asoc/codecs/pdata.h b/asoc/codecs/pdata.h
index d38ae84..c19c118 100644
--- a/asoc/codecs/pdata.h
+++ b/asoc/codecs/pdata.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __MFD_WCD9XXX_PDATA_H__
diff --git a/asoc/codecs/wcd-clsh.c b/asoc/codecs/wcd-clsh.c
index d119b83..7aec959 100644
--- a/asoc/codecs/wcd-clsh.c
+++ b/asoc/codecs/wcd-clsh.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -21,7 +13,7 @@
#define WCD_USLEEP_RANGE 50
-static void (*clsh_state_fp[NUM_CLSH_STATES])(struct snd_soc_codec *,
+static void (*clsh_state_fp[NUM_CLSH_STATES])(struct snd_soc_component *,
struct wcd_clsh_cdc_info *,
u8 req_state, bool en, int mode);
@@ -111,66 +103,82 @@
clsh_d->interpolator_modes[ffs(clsh_state)] = mode;
}
-static inline void wcd_clsh_set_buck_mode(struct snd_soc_codec *codec,
+static inline void wcd_clsh_set_buck_mode(struct snd_soc_component *component,
int mode)
{
if (mode == CLS_H_HIFI || mode == CLS_H_LOHIFI ||
mode == CLS_AB_HIFI)
- snd_soc_update_bits(codec, WCD9XXX_ANA_RX_SUPPLIES,
- 0x08, 0x08); /* set to HIFI */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_ANA_RX_SUPPLIES,
+ 0x08, 0x08); /* set to HIFI */
else
- snd_soc_update_bits(codec, WCD9XXX_ANA_RX_SUPPLIES,
- 0x08, 0x00); /* set to default */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_ANA_RX_SUPPLIES,
+ 0x08, 0x00); /* set to default */
}
-static inline void wcd_clsh_set_flyback_mode(struct snd_soc_codec *codec,
- int mode)
+static inline void wcd_clsh_set_flyback_mode(
+ struct snd_soc_component *component,
+ int mode)
{
if (mode == CLS_H_HIFI || mode == CLS_H_LOHIFI ||
mode == CLS_AB_HIFI) {
- snd_soc_update_bits(codec, WCD9XXX_ANA_RX_SUPPLIES,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEG_CTRL_4,
- 0xF0, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_ANA_RX_SUPPLIES,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEG_CTRL_4,
+ 0xF0, 0x80);
} else {
- snd_soc_update_bits(codec, WCD9XXX_ANA_RX_SUPPLIES,
- 0x04, 0x00); /* set to Default */
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEG_CTRL_4,
- 0xF0, 0x70);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_ANA_RX_SUPPLIES,
+ 0x04, 0x00); /* set to Default */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEG_CTRL_4,
+ 0xF0, 0x70);
}
}
-static inline void wcd_clsh_force_iq_ctl(struct snd_soc_codec *codec,
+static inline void wcd_clsh_force_iq_ctl(struct snd_soc_component *component,
int mode, bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
- 0xE0, 0xA0);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
+ 0xE0, 0xA0);
/* 100usec delay is needed as per HW requirement */
usleep_range(100, 110);
- snd_soc_update_bits(codec, WCD9XXX_CLASSH_MODE_3,
- 0x02, 0x02);
- snd_soc_update_bits(codec, WCD9XXX_CLASSH_MODE_2,
- 0xFF, 0x1C);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_CLASSH_MODE_3,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_CLASSH_MODE_2,
+ 0xFF, 0x1C);
if (mode == CLS_H_LOHIFI) {
- snd_soc_update_bits(codec, WCD9XXX_HPH_NEW_INT_PA_MISC2,
- 0x20, 0x20);
- snd_soc_update_bits(codec, WCD9XXX_RX_BIAS_HPH_LOWPOWER,
- 0xF0, 0xC0);
- snd_soc_update_bits(codec, WCD9XXX_HPH_PA_CTL1,
- 0x0E, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_NEW_INT_PA_MISC2,
+ 0x20, 0x20);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_RX_BIAS_HPH_LOWPOWER,
+ 0xF0, 0xC0);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_PA_CTL1,
+ 0x0E, 0x02);
}
} else {
- snd_soc_update_bits(codec, WCD9XXX_HPH_NEW_INT_PA_MISC2,
- 0x20, 0x00);
- snd_soc_update_bits(codec, WCD9XXX_RX_BIAS_HPH_LOWPOWER,
- 0xF0, 0x80);
- snd_soc_update_bits(codec, WCD9XXX_HPH_PA_CTL1,
- 0x0E, 0x06);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_NEW_INT_PA_MISC2,
+ 0x20, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_RX_BIAS_HPH_LOWPOWER,
+ 0xF0, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_PA_CTL1,
+ 0x0E, 0x06);
}
}
-static void wcd_clsh_buck_ctrl(struct snd_soc_codec *codec,
+static void wcd_clsh_buck_ctrl(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
int mode,
bool enable)
@@ -178,8 +186,9 @@
/* enable/disable buck */
if ((enable && (++clsh_d->buck_users == 1)) ||
(!enable && (--clsh_d->buck_users == 0))) {
- snd_soc_update_bits(codec, WCD9XXX_ANA_RX_SUPPLIES,
- (1 << 7), (enable << 7));
+ snd_soc_component_update_bits(component,
+ WCD9XXX_ANA_RX_SUPPLIES,
+ (1 << 7), (enable << 7));
/*
* 500us sleep is required after buck enable/disable
* as per HW requirement
@@ -187,18 +196,21 @@
usleep_range(500, 510);
if (mode == CLS_H_LOHIFI || mode == CLS_H_ULP ||
mode == CLS_H_HIFI || mode == CLS_H_LP)
- snd_soc_update_bits(codec, WCD9XXX_CLASSH_MODE_3,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_CLASSH_MODE_3,
+ 0x02, 0x00);
- snd_soc_update_bits(codec, WCD9XXX_CLASSH_MODE_2, 0xFF, 0x3A);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_CLASSH_MODE_2,
+ 0xFF, 0x3A);
/* 500usec delay is needed as per HW requirement */
usleep_range(500, 500 + WCD_USLEEP_RANGE);
}
- dev_dbg(codec->dev, "%s: buck_users %d, enable %d, mode: %s\n",
+ dev_dbg(component->dev, "%s: buck_users %d, enable %d, mode: %s\n",
__func__, clsh_d->buck_users, enable, mode_to_str(mode));
}
-static void wcd_clsh_flyback_ctrl(struct snd_soc_codec *codec,
+static void wcd_clsh_flyback_ctrl(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
int mode,
bool enable)
@@ -206,23 +218,25 @@
/* enable/disable flyback */
if ((enable && (++clsh_d->flyback_users == 1)) ||
(!enable && (--clsh_d->flyback_users == 0))) {
- snd_soc_update_bits(codec, WCD9XXX_ANA_RX_SUPPLIES,
- (1 << 6), (enable << 6));
+ snd_soc_component_update_bits(component,
+ WCD9XXX_ANA_RX_SUPPLIES,
+ (1 << 6), (enable << 6));
/*
* 100us sleep is required after flyback enable/disable
* as per HW requirement
*/
usleep_range(100, 110);
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
- 0xE0, 0xE0);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
+ 0xE0, 0xE0);
/* 500usec delay is needed as per HW requirement */
usleep_range(500, 500 + WCD_USLEEP_RANGE);
}
- dev_dbg(codec->dev, "%s: flyback_users %d, enable %d, mode: %s\n",
+ dev_dbg(component->dev, "%s: flyback_users %d, enable %d, mode: %s\n",
__func__, clsh_d->flyback_users, enable, mode_to_str(mode));
}
-static void wcd_clsh_set_hph_mode(struct snd_soc_codec *codec,
+static void wcd_clsh_set_hph_mode(struct snd_soc_component *component,
int mode)
{
u8 val = 0;
@@ -244,185 +258,189 @@
val = 0x04;
break;
default:
- dev_err(codec->dev, "%s:Invalid mode %d\n", __func__, mode);
+ dev_err(component->dev, "%s:Invalid mode %d\n", __func__, mode);
return;
};
- snd_soc_update_bits(codec, WCD9XXX_ANA_HPH, 0x0C, val);
+ snd_soc_component_update_bits(component, WCD9XXX_ANA_HPH, 0x0C, val);
}
-static void wcd_clsh_set_flyback_current(struct snd_soc_codec *codec, int mode)
+static void wcd_clsh_set_flyback_current(struct snd_soc_component *component,
+ int mode)
{
-
- snd_soc_update_bits(codec, WCD9XXX_RX_BIAS_FLYB_BUFF, 0x0F, 0x0A);
- snd_soc_update_bits(codec, WCD9XXX_RX_BIAS_FLYB_BUFF, 0xF0, 0xA0);
+ snd_soc_component_update_bits(component, WCD9XXX_RX_BIAS_FLYB_BUFF,
+ 0x0F, 0x0A);
+ snd_soc_component_update_bits(component, WCD9XXX_RX_BIAS_FLYB_BUFF,
+ 0xF0, 0xA0);
/* Sleep needed to avoid click and pop as per HW requirement */
usleep_range(100, 110);
}
-static void wcd_clsh_set_buck_regulator_mode(struct snd_soc_codec *codec,
- int mode)
+static void wcd_clsh_set_buck_regulator_mode(
+ struct snd_soc_component *component,
+ int mode)
{
- snd_soc_update_bits(codec, WCD9XXX_ANA_RX_SUPPLIES,
+ snd_soc_component_update_bits(component, WCD9XXX_ANA_RX_SUPPLIES,
0x02, 0x00);
}
-static void wcd_clsh_state_ear_aux(struct snd_soc_codec *codec,
+static void wcd_clsh_state_ear_aux(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
- is_enable ? "enable" : "disable");
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode), is_enable ? "enable" : "disable");
}
-static void wcd_clsh_state_hph_aux(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_aux(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
- is_enable ? "enable" : "disable");
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode), is_enable ? "enable" : "disable");
}
-static void wcd_clsh_state_hph_ear(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_ear(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
- is_enable ? "enable" : "disable");
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode), is_enable ? "enable" : "disable");
}
-static void wcd_clsh_state_hph_st(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_st(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
- is_enable ? "enable" : "disable");
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode), is_enable ? "enable" : "disable");
}
-static void wcd_clsh_state_hph_r(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_r(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
- is_enable ? "enable" : "disable");
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode), is_enable ? "enable" : "disable");
if (mode == CLS_H_NORMAL) {
- dev_dbg(codec->dev, "%s: Normal mode not applicable for hph_r\n",
+ dev_dbg(component->dev, "%s: Normal mode not applicable for hph_r\n",
__func__);
return;
}
if (is_enable) {
- wcd_clsh_set_buck_regulator_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_force_iq_ctl(codec, mode, true);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_flyback_current(codec, mode);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_hph_mode(codec, mode);
+ wcd_clsh_set_buck_regulator_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_force_iq_ctl(component, mode, true);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_flyback_current(component, mode);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_hph_mode(component, mode);
} else {
- wcd_clsh_set_hph_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_set_hph_mode(component, CLS_H_NORMAL);
/* buck and flyback set to default mode and disable */
- wcd_clsh_flyback_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_buck_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_force_iq_ctl(codec, CLS_H_NORMAL, false);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_flyback_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_buck_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_force_iq_ctl(component, CLS_H_NORMAL, false);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
}
}
-static void wcd_clsh_state_hph_l(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_l(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
- is_enable ? "enable" : "disable");
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode), is_enable ? "enable" : "disable");
if (mode == CLS_H_NORMAL) {
- dev_dbg(codec->dev, "%s: Normal mode not applicable for hph_l\n",
+ dev_dbg(component->dev, "%s: Normal mode not applicable for hph_l\n",
__func__);
return;
}
if (is_enable) {
- wcd_clsh_set_buck_regulator_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_force_iq_ctl(codec, mode, true);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_flyback_current(codec, mode);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_hph_mode(codec, mode);
+ wcd_clsh_set_buck_regulator_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_force_iq_ctl(component, mode, true);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_flyback_current(component, mode);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_hph_mode(component, mode);
} else {
- wcd_clsh_set_hph_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_set_hph_mode(component, CLS_H_NORMAL);
/* set buck and flyback to Default Mode */
- wcd_clsh_flyback_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_buck_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_force_iq_ctl(codec, CLS_H_NORMAL, false);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_flyback_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_buck_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_force_iq_ctl(component, CLS_H_NORMAL, false);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
}
}
-static void wcd_clsh_state_aux(struct snd_soc_codec *codec,
+static void wcd_clsh_state_aux(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
- is_enable ? "enable" : "disable");
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode), is_enable ? "enable" : "disable");
if (is_enable) {
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_flyback_current(codec, mode);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_flyback_current(component, mode);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, true);
} else {
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, false);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, false);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, false);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, false);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
}
}
-static void wcd_clsh_state_ear(struct snd_soc_codec *codec,
+static void wcd_clsh_state_ear(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (is_enable) {
- wcd_clsh_set_buck_regulator_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_force_iq_ctl(codec, mode, true);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_flyback_current(codec, mode);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_hph_mode(codec, mode);
+ wcd_clsh_set_buck_regulator_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_force_iq_ctl(component, mode, true);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_flyback_current(component, mode);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_hph_mode(component, mode);
} else {
- wcd_clsh_set_hph_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_set_hph_mode(component, CLS_H_NORMAL);
/* set buck and flyback to Default Mode */
- wcd_clsh_flyback_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_buck_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_force_iq_ctl(codec, CLS_H_NORMAL, false);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_flyback_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_buck_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_force_iq_ctl(component, CLS_H_NORMAL, false);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
}
}
-static void wcd_clsh_state_err(struct snd_soc_codec *codec,
+static void wcd_clsh_state_err(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *clsh_d,
u8 req_state, bool is_enable, int mode)
{
char msg[128];
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s Wrong request for class H state machine requested to %s %s\n",
__func__, is_enable ? "enable" : "disable",
state_to_str(req_state, msg, sizeof(msg)));
@@ -455,14 +473,14 @@
/*
* Function: wcd_cls_h_fsm
- * Params: codec, cdc_clsh_d, req_state, req_type, clsh_event
+ * Params: component, cdc_clsh_d, req_state, req_type, clsh_event
* Description:
* This function handles PRE DAC and POST DAC conditions of different devices
* and updates class H configuration of different combination of devices
* based on validity of their states. cdc_clsh_d will contain current
* class h state information
*/
-void wcd_cls_h_fsm(struct snd_soc_codec *codec,
+void wcd_cls_h_fsm(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *cdc_clsh_d,
u8 clsh_event, u8 req_state,
int int_mode)
@@ -476,14 +494,14 @@
new_state = old_state | req_state;
if (!wcd_clsh_is_state_valid(new_state)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H not a valid new state: %s\n",
__func__,
state_to_str(new_state, msg0, sizeof(msg0)));
return;
}
if (new_state == old_state) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H already in requested state: %s\n",
__func__,
state_to_str(new_state, msg0, sizeof(msg0)));
@@ -491,9 +509,9 @@
}
cdc_clsh_d->state = new_state;
wcd_clsh_set_int_mode(cdc_clsh_d, req_state, int_mode);
- (*clsh_state_fp[new_state]) (codec, cdc_clsh_d, req_state,
+ (*clsh_state_fp[new_state]) (component, cdc_clsh_d, req_state,
CLSH_REQ_ENABLE, int_mode);
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: ClassH state transition from %s to %s\n",
__func__, state_to_str(old_state, msg0, sizeof(msg0)),
state_to_str(cdc_clsh_d->state, msg1, sizeof(msg1)));
@@ -503,7 +521,7 @@
new_state = old_state & (~req_state);
if (new_state < NUM_CLSH_STATES) {
if (!wcd_clsh_is_state_valid(old_state)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s:Invalid old state:%s\n",
__func__,
state_to_str(old_state, msg0,
@@ -511,19 +529,19 @@
return;
}
if (new_state == old_state) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H already in requested state: %s\n",
__func__,
state_to_str(new_state, msg0,
sizeof(msg0)));
return;
}
- (*clsh_state_fp[old_state]) (codec, cdc_clsh_d,
+ (*clsh_state_fp[old_state]) (component, cdc_clsh_d,
req_state, CLSH_REQ_DISABLE,
int_mode);
cdc_clsh_d->state = new_state;
wcd_clsh_set_int_mode(cdc_clsh_d, req_state, CLS_NONE);
- dev_dbg(codec->dev, "%s: ClassH state transition from %s to %s\n",
+ dev_dbg(component->dev, "%s: ClassH state transition from %s to %s\n",
__func__, state_to_str(old_state, msg0,
sizeof(msg0)),
state_to_str(cdc_clsh_d->state, msg1,
diff --git a/asoc/codecs/wcd-clsh.h b/asoc/codecs/wcd-clsh.h
index df305bc..1a7759e 100644
--- a/asoc/codecs/wcd-clsh.h
+++ b/asoc/codecs/wcd-clsh.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WCD_CLSH
@@ -82,14 +74,14 @@
};
#ifdef CONFIG_SND_SOC_WCD9XXX_V2
-extern void wcd_cls_h_fsm(struct snd_soc_codec *codec,
+extern void wcd_cls_h_fsm(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *cdc_clsh_d,
u8 clsh_event, u8 req_state,
int int_mode);
extern void wcd_cls_h_init(struct wcd_clsh_cdc_info *clsh);
#else
-extern void wcd_cls_h_fsm(struct snd_soc_codec *codec,
+extern void wcd_cls_h_fsm(struct snd_soc_component *component,
struct wcd_clsh_cdc_info *cdc_clsh_d,
u8 clsh_event, u8 req_state,
int int_mode)
diff --git a/asoc/codecs/wcd-dsp-mgr.c b/asoc/codecs/wcd-dsp-mgr.c
index b45a9b3..612161f 100644
--- a/asoc/codecs/wcd-dsp-mgr.c
+++ b/asoc/codecs/wcd-dsp-mgr.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/platform_device.h>
diff --git a/asoc/codecs/wcd-dsp-utils.c b/asoc/codecs/wcd-dsp-utils.c
index 1c95d48..2e24de9 100644
--- a/asoc/codecs/wcd-dsp-utils.c
+++ b/asoc/codecs/wcd-dsp-utils.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/device.h>
diff --git a/asoc/codecs/wcd-dsp-utils.h b/asoc/codecs/wcd-dsp-utils.h
index a530a1c..1016fc0 100644
--- a/asoc/codecs/wcd-dsp-utils.h
+++ b/asoc/codecs/wcd-dsp-utils.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD_DSP_UTILS_H__
diff --git a/asoc/codecs/wcd-irq.c b/asoc/codecs/wcd-irq.c
index 48495f5..d294d40 100644
--- a/asoc/codecs/wcd-irq.c
+++ b/asoc/codecs/wcd-irq.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
@@ -120,12 +112,14 @@
};
static struct lock_class_key wcd_irq_lock_class;
+static struct lock_class_key wcd_irq_lock_requested_class;
static int wcd_irq_chip_map(struct irq_domain *irqd, unsigned int virq,
irq_hw_number_t hw)
{
irq_set_chip_and_handler(virq, &wcd_irq_chip, handle_simple_irq);
- irq_set_lockdep_class(virq, &wcd_irq_lock_class);
+ irq_set_lockdep_class(virq, &wcd_irq_lock_class,
+ &wcd_irq_lock_requested_class);
irq_set_nested_thread(virq, 1);
irq_set_noprobe(virq);
diff --git a/asoc/codecs/wcd-mbhc-adc.c b/asoc/codecs/wcd-mbhc-adc.c
index 1f0c5ba..c7882d6 100644
--- a/asoc/codecs/wcd-mbhc-adc.c
+++ b/asoc/codecs/wcd-mbhc-adc.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -201,7 +193,7 @@
wcd_mbhc_hs_elec_irq(mbhc, WCD_MBHC_ELEC_HS_INS, false);
WCD_MBHC_REG_READ(WCD_MBHC_FSM_EN, fsm_en);
- mbhc->mbhc_cb->mbhc_micbias_control(mbhc->codec,
+ mbhc->mbhc_cb->mbhc_micbias_control(mbhc->component,
mbhc->mbhc_cfg->anc_micbias,
MICB_ENABLE);
@@ -262,7 +254,7 @@
/* Restore electrical detection */
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ELECT_SCHMT_ISRC, elect_ctl);
- mbhc->mbhc_cb->mbhc_micbias_control(mbhc->codec,
+ mbhc->mbhc_cb->mbhc_micbias_control(mbhc->component,
mbhc->mbhc_cfg->anc_micbias,
MICB_DISABLE);
pr_debug("%s: anc mic %sfound\n", __func__,
@@ -291,7 +283,7 @@
/* If PA is enabled, dont check for cross-connection */
if (mbhc->mbhc_cb->hph_pa_on_status)
- if (mbhc->mbhc_cb->hph_pa_on_status(mbhc->codec))
+ if (mbhc->mbhc_cb->hph_pa_on_status(mbhc->component))
return -EINVAL;
/* Read legacy electircal detection and disable */
@@ -357,15 +349,15 @@
bool spl_hs = false;
int output_mv = 0;
int adc_threshold = 0, adc_hph_threshold = 0;
- struct snd_soc_codec *codec = mbhc->codec;
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
+ struct snd_soc_component *component = mbhc->component;
+ struct wcd9xxx_pdata *pdata = dev_get_platdata(component->dev->parent);
pr_debug("%s: enter\n", __func__);
if (!mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
goto exit;
/* Bump up MB2 to 2.7V */
- mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->codec,
+ mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component,
mbhc->mbhc_cfg->mbhc_micbias, true);
usleep_range(10000, 10100);
@@ -399,7 +391,7 @@
/* MB2 back to 1.8v if the type is not special headset */
if (spl_hs_cnt && (*spl_hs_cnt != WCD_MBHC_SPL_HS_CNT)) {
- mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->codec,
+ mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component,
mbhc->mbhc_cfg->mbhc_micbias, false);
/* Add 10ms delay for micbias to settle */
usleep_range(10000, 10100);
@@ -420,8 +412,8 @@
bool is_spl_hs = false;
int output_mv = 0;
int adc_threshold = 0;
- struct snd_soc_codec *codec = mbhc->codec;
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
+ struct snd_soc_component *component = mbhc->component;
+ struct wcd9xxx_pdata *pdata = dev_get_platdata(component->dev->parent);
/*
* Increase micbias to 2.7V to detect headsets with
@@ -433,7 +425,7 @@
__func__);
return false;
} else if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic) {
- ret = mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->codec,
+ ret = mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component,
MIC_BIAS_2, true);
if (ret) {
pr_err("%s: mbhc_micb_ctrl_thr_mic failed, ret: %d\n",
@@ -478,7 +470,8 @@
}
if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic &&
!mbhc->micbias_enable)
- mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->codec, MIC_BIAS_2,
+ mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component,
+ MIC_BIAS_2,
false);
pr_debug("%s: leave, micb_enable: %d\n", __func__,
mbhc->micbias_enable);
@@ -538,18 +531,18 @@
/* called under codec_resource_lock acquisition */
static void wcd_mbhc_adc_detect_plug_type(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
pr_debug("%s: enter\n", __func__);
WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
if (mbhc->mbhc_cb->hph_pull_down_ctrl)
- mbhc->mbhc_cb->hph_pull_down_ctrl(codec, false);
+ mbhc->mbhc_cb->hph_pull_down_ctrl(component, false);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_DETECTION_DONE, 0);
if (mbhc->mbhc_cb->mbhc_micbias_control) {
- mbhc->mbhc_cb->mbhc_micbias_control(codec, MIC_BIAS_2,
+ mbhc->mbhc_cb->mbhc_micbias_control(component, MIC_BIAS_2,
MICB_ENABLE);
} else {
pr_err("%s: Mic Bias is not enabled\n", __func__);
@@ -566,10 +559,10 @@
{
if (mbhc->micbias_enable) {
mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(
- mbhc->codec, MIC_BIAS_2, false);
+ mbhc->component, MIC_BIAS_2, false);
if (mbhc->mbhc_cb->set_micbias_value)
mbhc->mbhc_cb->set_micbias_value(
- mbhc->codec);
+ mbhc->component);
mbhc->micbias_enable = false;
}
}
@@ -604,7 +597,7 @@
static void wcd_correct_swch_plug(struct work_struct *work)
{
struct wcd_mbhc *mbhc;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
enum wcd_mbhc_plug_type plug_type = MBHC_PLUG_TYPE_INVALID;
unsigned long timeout;
bool wrk_complete = false;
@@ -620,7 +613,7 @@
pr_debug("%s: enter\n", __func__);
mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch);
- codec = mbhc->codec;
+ component = mbhc->component;
WCD_MBHC_RSC_LOCK(mbhc);
/* Mask ADC COMPLETE interrupt */
@@ -711,7 +704,8 @@
}
if (mbhc->mbhc_cb->hph_pa_on_status)
- is_pa_on = mbhc->mbhc_cb->hph_pa_on_status(mbhc->codec);
+ is_pa_on = mbhc->mbhc_cb->hph_pa_on_status(
+ mbhc->component);
if ((output_mv <= WCD_MBHC_ADC_HS_THRESHOLD_MV) &&
(!is_pa_on)) {
@@ -758,7 +752,7 @@
* otherwise report unsupported plug
*/
if (mbhc->mbhc_cfg->swap_gnd_mic &&
- mbhc->mbhc_cfg->swap_gnd_mic(codec,
+ mbhc->mbhc_cfg->swap_gnd_mic(component,
true)) {
pr_debug("%s: US_EU gpio present,flip switch\n"
, __func__);
@@ -866,7 +860,7 @@
exit:
if (mbhc->mbhc_cb->mbhc_micbias_control &&
!mbhc->micbias_enable)
- mbhc->mbhc_cb->mbhc_micbias_control(codec, MIC_BIAS_2,
+ mbhc->mbhc_cb->mbhc_micbias_control(component, MIC_BIAS_2,
MICB_DISABLE);
/*
@@ -878,14 +872,14 @@
mbhc->micbias_enable) {
if (mbhc->mbhc_cb->mbhc_micbias_control)
mbhc->mbhc_cb->mbhc_micbias_control(
- codec, MIC_BIAS_2,
+ component, MIC_BIAS_2,
MICB_DISABLE);
if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(
- codec,
+ component,
MIC_BIAS_2, false);
if (mbhc->mbhc_cb->set_micbias_value) {
- mbhc->mbhc_cb->set_micbias_value(codec);
+ mbhc->mbhc_cb->set_micbias_value(component);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MICB_CTRL, 0);
}
mbhc->micbias_enable = false;
@@ -913,7 +907,7 @@
}
if (mbhc->mbhc_cb->hph_pull_down_ctrl)
- mbhc->mbhc_cb->hph_pull_down_ctrl(codec, true);
+ mbhc->mbhc_cb->hph_pull_down_ctrl(component, true);
mbhc->mbhc_cb->lock_sleep(mbhc, false);
pr_debug("%s: leave\n", __func__);
@@ -961,7 +955,7 @@
if (mbhc->mbhc_cfg->moisture_en) {
if (mbhc->mbhc_cb->hph_pa_on_status)
- if (mbhc->mbhc_cb->hph_pa_on_status(mbhc->codec)) {
+ if (mbhc->mbhc_cb->hph_pa_on_status(mbhc->component)) {
hphpa_on = true;
WCD_MBHC_REG_UPDATE_BITS(
WCD_MBHC_HPHL_PA_EN, 0);
diff --git a/asoc/codecs/wcd-mbhc-adc.h b/asoc/codecs/wcd-mbhc-adc.h
index 3116108..9383d1a 100644
--- a/asoc/codecs/wcd-mbhc-adc.h
+++ b/asoc/codecs/wcd-mbhc-adc.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD_MBHC_ADC_H__
#define __WCD_MBHC_ADC_H__
diff --git a/asoc/codecs/wcd-mbhc-legacy.c b/asoc/codecs/wcd-mbhc-legacy.c
index 9ebdeca..4b8917d 100644
--- a/asoc/codecs/wcd-mbhc-legacy.c
+++ b/asoc/codecs/wcd-mbhc-legacy.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -56,7 +48,7 @@
if (val)
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0);
- mbhc->mbhc_cb->mbhc_micbias_control(mbhc->codec,
+ mbhc->mbhc_cb->mbhc_micbias_control(mbhc->component,
mbhc->mbhc_cfg->anc_micbias,
MICB_ENABLE);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MUX_CTL, 0x2);
@@ -111,7 +103,7 @@
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ANC_DET_EN, 0);
- mbhc->mbhc_cb->mbhc_micbias_control(mbhc->codec,
+ mbhc->mbhc_cb->mbhc_micbias_control(mbhc->component,
mbhc->mbhc_cfg->anc_micbias,
MICB_DISABLE);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MUX_CTL, 0x0);
@@ -135,7 +127,7 @@
/* If PA is enabled, dont check for cross-connection */
if (mbhc->mbhc_cb->hph_pa_on_status)
- if (mbhc->mbhc_cb->hph_pa_on_status(mbhc->codec))
+ if (mbhc->mbhc_cb->hph_pa_on_status(mbhc->component))
return false;
WCD_MBHC_REG_READ(WCD_MBHC_ELECT_SCHMT_ISRC, reg1);
@@ -176,7 +168,7 @@
static bool wcd_is_special_headset(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
int delay = 0, rc;
bool ret = false;
u16 hs_comp_res;
@@ -192,7 +184,7 @@
__func__);
return false;
} else if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic) {
- rc = mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(codec,
+ rc = mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(component,
MIC_BIAS_2, true);
if (rc) {
pr_err("%s: Micbias control for thr mic failed, rc: %d\n",
@@ -214,17 +206,17 @@
}
delay = delay + 50;
if (mbhc->mbhc_cb->mbhc_common_micb_ctrl) {
- mbhc->mbhc_cb->mbhc_common_micb_ctrl(codec,
+ mbhc->mbhc_cb->mbhc_common_micb_ctrl(component,
MBHC_COMMON_MICB_PRECHARGE,
true);
- mbhc->mbhc_cb->mbhc_common_micb_ctrl(codec,
+ mbhc->mbhc_cb->mbhc_common_micb_ctrl(component,
MBHC_COMMON_MICB_SET_VAL,
true);
}
/* Wait for 50msec for MICBIAS to settle down */
msleep(50);
if (mbhc->mbhc_cb->set_auto_zeroing)
- mbhc->mbhc_cb->set_auto_zeroing(codec, true);
+ mbhc->mbhc_cb->set_auto_zeroing(component, true);
/* Wait for 50msec for FSM to update result values */
msleep(50);
WCD_MBHC_REG_READ(WCD_MBHC_HS_COMP_RESULT, hs_comp_res);
@@ -245,17 +237,17 @@
ret = true;
}
if (mbhc->mbhc_cb->mbhc_common_micb_ctrl)
- mbhc->mbhc_cb->mbhc_common_micb_ctrl(codec,
+ mbhc->mbhc_cb->mbhc_common_micb_ctrl(component,
MBHC_COMMON_MICB_PRECHARGE,
false);
if (mbhc->mbhc_cb->set_micbias_value && !mbhc->micbias_enable)
- mbhc->mbhc_cb->set_micbias_value(codec);
+ mbhc->mbhc_cb->set_micbias_value(component);
if (mbhc->mbhc_cb->set_auto_zeroing)
- mbhc->mbhc_cb->set_auto_zeroing(codec, false);
+ mbhc->mbhc_cb->set_auto_zeroing(component, false);
if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic &&
!mbhc->micbias_enable)
- mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(codec, MIC_BIAS_2,
+ mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(component, MIC_BIAS_2,
false);
pr_debug("%s: leave, micb_enable: %d\n", __func__,
@@ -290,7 +282,7 @@
enum wcd_mbhc_plug_type plug_type)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
/*
* Do not disable micbias if recording is going on or
@@ -302,7 +294,7 @@
*/
if (det_extn_cable_en && mbhc->is_extn_cable &&
mbhc->mbhc_cb && mbhc->mbhc_cb->extn_use_mb &&
- mbhc->mbhc_cb->extn_use_mb(codec)) {
+ mbhc->mbhc_cb->extn_use_mb(component)) {
if (plug_type == MBHC_PLUG_TYPE_HEADPHONE ||
plug_type == MBHC_PLUG_TYPE_HEADSET)
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_MB);
@@ -348,7 +340,7 @@
}
/* Bump up MB2 to 2.7v */
- mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->codec,
+ mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component,
mbhc->mbhc_cfg->mbhc_micbias, true);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 1);
@@ -364,7 +356,7 @@
/* MB2 back to 1.8v */
if (*spl_hs_cnt != WCD_MBHC_SPL_HS_CNT) {
- mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->codec,
+ mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component,
mbhc->mbhc_cfg->mbhc_micbias, false);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 1);
@@ -407,24 +399,24 @@
/* called under codec_resource_lock acquisition */
static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
bool micbias1 = false;
pr_debug("%s: enter\n", __func__);
WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
if (mbhc->mbhc_cb->hph_pull_down_ctrl)
- mbhc->mbhc_cb->hph_pull_down_ctrl(codec, false);
+ mbhc->mbhc_cb->hph_pull_down_ctrl(component, false);
if (mbhc->mbhc_cb->micbias_enable_status)
micbias1 = mbhc->mbhc_cb->micbias_enable_status(mbhc,
MIC_BIAS_1);
if (mbhc->mbhc_cb->set_cap_mode)
- mbhc->mbhc_cb->set_cap_mode(codec, micbias1, true);
+ mbhc->mbhc_cb->set_cap_mode(component, micbias1, true);
if (mbhc->mbhc_cb->mbhc_micbias_control)
- mbhc->mbhc_cb->mbhc_micbias_control(codec, MIC_BIAS_2,
+ mbhc->mbhc_cb->mbhc_micbias_control(component, MIC_BIAS_2,
MICB_ENABLE);
else
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_MB);
@@ -438,7 +430,7 @@
static void wcd_correct_swch_plug(struct work_struct *work)
{
struct wcd_mbhc *mbhc;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
enum wcd_mbhc_plug_type plug_type = MBHC_PLUG_TYPE_INVALID;
unsigned long timeout;
u16 hs_comp_res = 0, hphl_sch = 0, mic_sch = 0, btn_result = 0;
@@ -456,7 +448,7 @@
pr_debug("%s: enter\n", __func__);
mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch);
- codec = mbhc->codec;
+ component = mbhc->component;
/*
* Enable micbias/pullup for detection in correct work.
@@ -536,10 +528,10 @@
if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic &&
mbhc->micbias_enable) {
mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(
- mbhc->codec, MIC_BIAS_2, false);
+ mbhc->component, MIC_BIAS_2, false);
if (mbhc->mbhc_cb->set_micbias_value)
mbhc->mbhc_cb->set_micbias_value(
- mbhc->codec);
+ mbhc->component);
mbhc->micbias_enable = false;
}
goto exit;
@@ -562,10 +554,10 @@
if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic &&
mbhc->micbias_enable) {
mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(
- mbhc->codec, MIC_BIAS_2, false);
+ mbhc->component, MIC_BIAS_2, false);
if (mbhc->mbhc_cb->set_micbias_value)
mbhc->mbhc_cb->set_micbias_value(
- mbhc->codec);
+ mbhc->component);
mbhc->micbias_enable = false;
}
goto exit;
@@ -574,7 +566,7 @@
pr_debug("%s: hs_comp_res: %x\n", __func__, hs_comp_res);
if (mbhc->mbhc_cb->hph_pa_on_status)
- is_pa_on = mbhc->mbhc_cb->hph_pa_on_status(codec);
+ is_pa_on = mbhc->mbhc_cb->hph_pa_on_status(component);
/*
* instead of hogging system by contineous polling, wait for
@@ -635,7 +627,7 @@
* otherwise report unsupported plug
*/
if (mbhc->mbhc_cfg->swap_gnd_mic &&
- mbhc->mbhc_cfg->swap_gnd_mic(codec,
+ mbhc->mbhc_cfg->swap_gnd_mic(component,
true)) {
pr_debug("%s: US_EU gpio present,flip switch\n"
, __func__);
@@ -741,7 +733,7 @@
exit:
if (mbhc->mbhc_cb->mbhc_micbias_control &&
!mbhc->micbias_enable)
- mbhc->mbhc_cb->mbhc_micbias_control(codec, MIC_BIAS_2,
+ mbhc->mbhc_cb->mbhc_micbias_control(component, MIC_BIAS_2,
MICB_DISABLE);
/*
@@ -753,14 +745,14 @@
mbhc->micbias_enable) {
if (mbhc->mbhc_cb->mbhc_micbias_control)
mbhc->mbhc_cb->mbhc_micbias_control(
- codec, MIC_BIAS_2,
+ component, MIC_BIAS_2,
MICB_DISABLE);
if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(
- codec,
+ component,
MIC_BIAS_2, false);
if (mbhc->mbhc_cb->set_micbias_value) {
- mbhc->mbhc_cb->set_micbias_value(codec);
+ mbhc->mbhc_cb->set_micbias_value(component);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MICB_CTRL, 0);
}
mbhc->micbias_enable = false;
@@ -782,10 +774,10 @@
WCD_MBHC_RSC_UNLOCK(mbhc);
}
if (mbhc->mbhc_cb->set_cap_mode)
- mbhc->mbhc_cb->set_cap_mode(codec, micbias1, micbias2);
+ mbhc->mbhc_cb->set_cap_mode(component, micbias1, micbias2);
if (mbhc->mbhc_cb->hph_pull_down_ctrl)
- mbhc->mbhc_cb->hph_pull_down_ctrl(codec, true);
+ mbhc->mbhc_cb->hph_pull_down_ctrl(component, true);
mbhc->mbhc_cb->lock_sleep(mbhc, false);
pr_debug("%s: leave\n", __func__);
@@ -841,7 +833,8 @@
if (mbhc->mbhc_cfg->moisture_en) {
if (mbhc->mbhc_cb->hph_pa_on_status)
if (
- mbhc->mbhc_cb->hph_pa_on_status(mbhc->codec)) {
+ mbhc->mbhc_cb->hph_pa_on_status(
+ mbhc->component)) {
hphpa_on = true;
WCD_MBHC_REG_UPDATE_BITS(
WCD_MBHC_HPHL_PA_EN, 0);
diff --git a/asoc/codecs/wcd-mbhc-legacy.h b/asoc/codecs/wcd-mbhc-legacy.h
index af3a7dc..a79b673 100644
--- a/asoc/codecs/wcd-mbhc-legacy.h
+++ b/asoc/codecs/wcd-mbhc-legacy.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD_MBHC_LEGACY_H__
#define __WCD_MBHC_LEGACY_H__
diff --git a/asoc/codecs/wcd-mbhc-v2-api.h b/asoc/codecs/wcd-mbhc-v2-api.h
index 7b6e945..fc00e14 100644
--- a/asoc/codecs/wcd-mbhc-v2-api.h
+++ b/asoc/codecs/wcd-mbhc-v2-api.h
@@ -1,13 +1,5 @@
-/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __WCD_MBHC_V2_API_H__
#define __WCD_MBHC_V2_API_H__
@@ -18,7 +10,7 @@
int wcd_mbhc_start(struct wcd_mbhc *mbhc,
struct wcd_mbhc_config *mbhc_cfg);
void wcd_mbhc_stop(struct wcd_mbhc *mbhc);
-int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec,
+int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_component *component,
const struct wcd_mbhc_cb *mbhc_cb,
const struct wcd_mbhc_intr *mbhc_cdc_intr_ids,
struct wcd_mbhc_register *wcd_mbhc_regs,
@@ -31,7 +23,7 @@
static inline void wcd_mbhc_stop(struct wcd_mbhc *mbhc)
{
}
-int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec,
+int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_component *component,
const struct wcd_mbhc_cb *mbhc_cb,
const struct wcd_mbhc_intr *mbhc_cdc_intr_ids,
struct wcd_mbhc_register *wcd_mbhc_regs,
diff --git a/asoc/codecs/wcd-mbhc-v2.c b/asoc/codecs/wcd-mbhc-v2.c
index 1205765..971cf51 100644
--- a/asoc/codecs/wcd-mbhc-v2.c
+++ b/asoc/codecs/wcd-mbhc-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -44,9 +36,9 @@
static void __hphocp_off_report(struct wcd_mbhc *mbhc, u32 jack_status,
int irq)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
- dev_dbg(codec->dev, "%s: clear ocp status %x\n",
+ dev_dbg(component->dev, "%s: clear ocp status %x\n",
__func__, jack_status);
if (mbhc->hph_status & jack_status) {
@@ -63,7 +55,7 @@
mbhc->hphlocp_cnt = 0;
else
mbhc->hphrocp_cnt = 0;
- mbhc->mbhc_cb->irq_control(codec, irq, true);
+ mbhc->mbhc_cb->irq_control(component, irq, true);
}
}
@@ -82,21 +74,21 @@
static void wcd_program_hs_vref(struct wcd_mbhc *mbhc)
{
struct wcd_mbhc_plug_type_cfg *plug_type_cfg;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
u32 reg_val;
plug_type_cfg = WCD_MBHC_CAL_PLUG_TYPE_PTR(mbhc->mbhc_cfg->calibration);
reg_val = ((plug_type_cfg->v_hs_max - HS_VREF_MIN_VAL) / 100);
- dev_dbg(codec->dev, "%s: reg_val = %x\n", __func__, reg_val);
+ dev_dbg(component->dev, "%s: reg_val = %x\n", __func__, reg_val);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HS_VREF, reg_val);
}
static void wcd_program_btn_threshold(const struct wcd_mbhc *mbhc, bool micbias)
{
struct wcd_mbhc_btn_detect_cfg *btn_det;
- struct snd_soc_codec *codec = mbhc->codec;
- struct snd_soc_card *card = codec->component.card;
+ struct snd_soc_component *component = mbhc->component;
+ struct snd_soc_card *card = component->card;
s16 *btn_low, *btn_high;
if (mbhc->mbhc_cfg->calibration == NULL) {
@@ -109,8 +101,8 @@
btn_high = ((void *)&btn_det->_v_btn_low) +
(sizeof(btn_det->_v_btn_low[0]) * btn_det->num_btn);
- mbhc->mbhc_cb->set_btn_thr(codec, btn_low, btn_high, btn_det->num_btn,
- micbias);
+ mbhc->mbhc_cb->set_btn_thr(component, btn_low, btn_high,
+ btn_det->num_btn, micbias);
}
void wcd_enable_curr_micbias(const struct wcd_mbhc *mbhc,
@@ -211,7 +203,7 @@
{
struct wcd_mbhc *mbhc = (struct wcd_mbhc *)data;
enum wcd_notify_event event = (enum wcd_notify_event)val;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
bool micbias2 = false;
bool micbias1 = false;
u8 fsm_en = 0;
@@ -235,10 +227,10 @@
if (!mbhc->micbias_enable)
goto out_micb_en;
if (mbhc->mbhc_cb->mbhc_common_micb_ctrl) {
- mbhc->mbhc_cb->mbhc_common_micb_ctrl(codec,
+ mbhc->mbhc_cb->mbhc_common_micb_ctrl(component,
MBHC_COMMON_MICB_PRECHARGE,
true);
- mbhc->mbhc_cb->mbhc_common_micb_ctrl(codec,
+ mbhc->mbhc_cb->mbhc_common_micb_ctrl(component,
MBHC_COMMON_MICB_SET_VAL,
true);
/*
@@ -248,9 +240,9 @@
msleep(50);
}
if (mbhc->mbhc_cb->set_auto_zeroing)
- mbhc->mbhc_cb->set_auto_zeroing(codec, true);
+ mbhc->mbhc_cb->set_auto_zeroing(component, true);
if (mbhc->mbhc_cb->mbhc_common_micb_ctrl)
- mbhc->mbhc_cb->mbhc_common_micb_ctrl(codec,
+ mbhc->mbhc_cb->mbhc_common_micb_ctrl(component,
MBHC_COMMON_MICB_PRECHARGE,
false);
out_micb_en:
@@ -266,7 +258,7 @@
}
/* configure cap settings properly when micbias is enabled */
if (mbhc->mbhc_cb->set_cap_mode)
- mbhc->mbhc_cb->set_cap_mode(codec, micbias1, true);
+ mbhc->mbhc_cb->set_cap_mode(component, micbias1, true);
break;
case WCD_EVENT_PRE_MICBIAS_2_OFF:
/*
@@ -297,9 +289,9 @@
}
if (mbhc->mbhc_cb->set_auto_zeroing)
- mbhc->mbhc_cb->set_auto_zeroing(codec, false);
+ mbhc->mbhc_cb->set_auto_zeroing(component, false);
if (mbhc->mbhc_cb->set_micbias_value && !mbhc->micbias_enable)
- mbhc->mbhc_cb->set_micbias_value(codec);
+ mbhc->mbhc_cb->set_micbias_value(component);
/* Enable PULL UP if PA's are enabled */
if ((test_bit(WCD_MBHC_EVENT_PA_HPHL, &mbhc->event_state)) ||
(test_bit(WCD_MBHC_EVENT_PA_HPHR,
@@ -312,7 +304,7 @@
/* configure cap settings properly when micbias is disabled */
if (mbhc->mbhc_cb->set_cap_mode)
- mbhc->mbhc_cb->set_cap_mode(codec, micbias1, false);
+ mbhc->mbhc_cb->set_cap_mode(component, micbias1, false);
break;
case WCD_EVENT_PRE_HPHL_PA_OFF:
mutex_lock(&mbhc->hphl_pa_lock);
@@ -371,12 +363,12 @@
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_PULLUP);
break;
case WCD_EVENT_OCP_OFF:
- mbhc->mbhc_cb->irq_control(mbhc->codec,
+ mbhc->mbhc_cb->irq_control(mbhc->component,
mbhc->intr_ids->hph_left_ocp,
false);
break;
case WCD_EVENT_OCP_ON:
- mbhc->mbhc_cb->irq_control(mbhc->codec,
+ mbhc->mbhc_cb->irq_control(mbhc->component,
mbhc->intr_ids->hph_left_ocp,
true);
break;
@@ -449,7 +441,8 @@
pr_debug("%s: HPHL ANC clear flag and enable ANC_EN\n",
__func__);
if (mbhc->mbhc_cb->update_anc_state)
- mbhc->mbhc_cb->update_anc_state(mbhc->codec, true, 0);
+ mbhc->mbhc_cb->update_anc_state(mbhc->component,
+ true, 0);
}
if (test_and_clear_bit(WCD_MBHC_ANC1_OFF_ACK,
@@ -458,7 +451,8 @@
pr_debug("%s: HPHR ANC clear flag and enable ANC_EN\n",
__func__);
if (mbhc->mbhc_cb->update_anc_state)
- mbhc->mbhc_cb->update_anc_state(mbhc->codec, true, 1);
+ mbhc->mbhc_cb->update_anc_state(mbhc->component,
+ true, 1);
}
}
@@ -501,8 +495,10 @@
set_bit(WCD_MBHC_ANC0_OFF_ACK, &mbhc->hph_anc_state);
set_bit(WCD_MBHC_ANC1_OFF_ACK, &mbhc->hph_anc_state);
if (mbhc->mbhc_cb->update_anc_state) {
- mbhc->mbhc_cb->update_anc_state(mbhc->codec, false, 0);
- mbhc->mbhc_cb->update_anc_state(mbhc->codec, false, 1);
+ mbhc->mbhc_cb->update_anc_state(mbhc->component,
+ false, 0);
+ mbhc->mbhc_cb->update_anc_state(mbhc->component,
+ false, 1);
} else {
pr_debug("%s ANC is off\n", __func__);
}
@@ -542,7 +538,7 @@
pr_debug("%s: irq: %d, enable: %d, intr_status:%lu\n",
__func__, irq, enable, mbhc->intr_status);
if ((test_bit(irq_type, &mbhc->intr_status)) != enable) {
- mbhc->mbhc_cb->irq_control(mbhc->codec, irq, enable);
+ mbhc->mbhc_cb->irq_control(mbhc->component, irq, enable);
if (enable)
set_bit(irq_type, &mbhc->intr_status);
else
@@ -554,7 +550,7 @@
void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
enum snd_jack_types jack_type)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
bool is_pa_on = false;
u8 fsm_en = 0;
@@ -583,14 +579,14 @@
if (mbhc->micbias_enable) {
if (mbhc->mbhc_cb->mbhc_micbias_control)
mbhc->mbhc_cb->mbhc_micbias_control(
- codec, MIC_BIAS_2,
+ component, MIC_BIAS_2,
MICB_DISABLE);
if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(
- codec,
+ component,
MIC_BIAS_2, false);
if (mbhc->mbhc_cb->set_micbias_value) {
- mbhc->mbhc_cb->set_micbias_value(codec);
+ mbhc->mbhc_cb->set_micbias_value(component);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MICB_CTRL, 0);
}
mbhc->micbias_enable = false;
@@ -622,15 +618,15 @@
mbhc->hph_status == SND_JACK_HEADSET) {
if (mbhc->mbhc_cb->mbhc_micbias_control)
mbhc->mbhc_cb->mbhc_micbias_control(
- codec, MIC_BIAS_2,
+ component, MIC_BIAS_2,
MICB_DISABLE);
if (mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(
- codec,
+ component,
MIC_BIAS_2, false);
if (mbhc->mbhc_cb->set_micbias_value) {
mbhc->mbhc_cb->set_micbias_value(
- codec);
+ component);
WCD_MBHC_REG_UPDATE_BITS(
WCD_MBHC_MICB_CTRL, 0);
}
@@ -680,7 +676,7 @@
mbhc->current_plug = MBHC_PLUG_TYPE_ANC_HEADPHONE;
if (mbhc->mbhc_cb->hph_pa_on_status)
- is_pa_on = mbhc->mbhc_cb->hph_pa_on_status(codec);
+ is_pa_on = mbhc->mbhc_cb->hph_pa_on_status(component);
if (mbhc->impedance_detect &&
mbhc->mbhc_cb->compute_impedance &&
@@ -884,10 +880,10 @@
{
bool detection_type = 0;
bool micbias1 = false;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
enum snd_jack_types jack_type;
- dev_dbg(codec->dev, "%s: enter\n", __func__);
+ dev_dbg(component->dev, "%s: enter\n", __func__);
WCD_MBHC_RSC_LOCK(mbhc);
mbhc->in_swch_irq_handler = true;
@@ -923,10 +919,10 @@
goto done;
/* Make sure MASTER_BIAS_CTL is enabled */
- mbhc->mbhc_cb->mbhc_bias(codec, true);
+ mbhc->mbhc_cb->mbhc_bias(component, true);
if (mbhc->mbhc_cb->mbhc_common_micb_ctrl)
- mbhc->mbhc_cb->mbhc_common_micb_ctrl(codec,
+ mbhc->mbhc_cb->mbhc_common_micb_ctrl(component,
MBHC_COMMON_MICB_TAIL_CURR, true);
if (!mbhc->mbhc_cfg->hs_ext_micbias &&
@@ -935,13 +931,13 @@
* Enable Tx2 RBias if the headset
* is using internal micbias
*/
- mbhc->mbhc_cb->micb_internal(codec, 1, true);
+ mbhc->mbhc_cb->micb_internal(component, 1, true);
/* Remove micbias pulldown */
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_PULLDOWN_CTRL, 0);
/* Apply trim if needed on the device */
if (mbhc->mbhc_cb->trim_btn_reg)
- mbhc->mbhc_cb->trim_btn_reg(codec);
+ mbhc->mbhc_cb->trim_btn_reg(component);
/* Enable external voltage source to micbias if present */
if (mbhc->mbhc_cb->enable_mb_source)
mbhc->mbhc_cb->enable_mb_source(mbhc, true);
@@ -958,11 +954,11 @@
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_BTN_ISRC_CTL, 0);
if (mbhc->mbhc_cb->mbhc_common_micb_ctrl)
- mbhc->mbhc_cb->mbhc_common_micb_ctrl(codec,
+ mbhc->mbhc_cb->mbhc_common_micb_ctrl(component,
MBHC_COMMON_MICB_TAIL_CURR, false);
if (mbhc->mbhc_cb->set_cap_mode)
- mbhc->mbhc_cb->set_cap_mode(codec, micbias1, false);
+ mbhc->mbhc_cb->set_cap_mode(component, micbias1, false);
mbhc->btn_press_intr = false;
mbhc->is_btn_press = false;
@@ -976,7 +972,8 @@
case MBHC_PLUG_TYPE_HEADSET:
/* make sure to turn off Rbias */
if (mbhc->mbhc_cb->micb_internal)
- mbhc->mbhc_cb->micb_internal(codec, 1, false);
+ mbhc->mbhc_cb->micb_internal(component,
+ 1, false);
/* Pulldown micbias */
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_PULLDOWN_CTRL, 1);
jack_type = SND_JACK_HEADSET;
@@ -1006,7 +1003,8 @@
if (mbhc->mbhc_cfg->enable_usbc_analog) {
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_L_DET_EN, 0);
if (mbhc->mbhc_cb->clk_setup)
- mbhc->mbhc_cb->clk_setup(mbhc->codec, false);
+ mbhc->mbhc_cb->clk_setup(
+ mbhc->component, false);
}
if (mbhc->mbhc_cfg->moisture_en &&
@@ -1058,7 +1056,7 @@
int mask = 0;
int btn;
- btn = mbhc->mbhc_cb->map_btn_code_to_num(mbhc->codec);
+ btn = mbhc->mbhc_cb->map_btn_code_to_num(mbhc->component);
switch (btn) {
case 0:
@@ -1273,7 +1271,7 @@
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_OCP_FSM_EN, 0);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_OCP_FSM_EN, 1);
} else {
- mbhc->mbhc_cb->irq_control(mbhc->codec,
+ mbhc->mbhc_cb->irq_control(mbhc->component,
mbhc->intr_ids->hph_left_ocp,
false);
mbhc->hph_status |= SND_JACK_OC_HPHL;
@@ -1316,7 +1314,7 @@
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_OCP_FSM_EN, 0);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_OCP_FSM_EN, 1);
} else {
- mbhc->mbhc_cb->irq_control(mbhc->codec,
+ mbhc->mbhc_cb->irq_control(mbhc->component,
mbhc->intr_ids->hph_right_ocp,
false);
mbhc->hph_status |= SND_JACK_OC_HPHR;
@@ -1330,17 +1328,17 @@
static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc)
{
int ret = 0;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
pr_debug("%s: enter\n", __func__);
WCD_MBHC_RSC_LOCK(mbhc);
/* enable HS detection */
if (mbhc->mbhc_cb->hph_pull_up_control_v2)
- mbhc->mbhc_cb->hph_pull_up_control_v2(codec,
+ mbhc->mbhc_cb->hph_pull_up_control_v2(component,
HS_PULLUP_I_DEFAULT);
else if (mbhc->mbhc_cb->hph_pull_up_control)
- mbhc->mbhc_cb->hph_pull_up_control(codec, I_DEFAULT);
+ mbhc->mbhc_cb->hph_pull_up_control(component, I_DEFAULT);
else
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HS_L_DET_PULL_UP_CTRL, 3);
@@ -1358,10 +1356,10 @@
mbhc->gnd_swh = 0;
if (mbhc->mbhc_cb->hph_pull_up_control_v2)
- mbhc->mbhc_cb->hph_pull_up_control_v2(codec,
+ mbhc->mbhc_cb->hph_pull_up_control_v2(component,
HS_PULLUP_I_OFF);
else if (mbhc->mbhc_cb->hph_pull_up_control)
- mbhc->mbhc_cb->hph_pull_up_control(codec, I_OFF);
+ mbhc->mbhc_cb->hph_pull_up_control(component, I_OFF);
else
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HS_L_DET_PULL_UP_CTRL,
0);
@@ -1371,7 +1369,7 @@
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_GND_PLUG_TYPE, mbhc->gnd_swh);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_SW_HPH_LP_100K_TO_GND, 1);
if (mbhc->mbhc_cfg->gnd_det_en && mbhc->mbhc_cb->mbhc_gnd_det_ctrl)
- mbhc->mbhc_cb->mbhc_gnd_det_ctrl(codec, true);
+ mbhc->mbhc_cb->mbhc_gnd_det_ctrl(component, true);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HS_L_DET_PULL_UP_COMP_CTRL, 1);
/*
@@ -1397,15 +1395,15 @@
/* Enable micbias ramp */
if (mbhc->mbhc_cb->mbhc_micb_ramp_control)
- mbhc->mbhc_cb->mbhc_micb_ramp_control(codec, true);
+ mbhc->mbhc_cb->mbhc_micb_ramp_control(component, true);
/* enable bias */
- mbhc->mbhc_cb->mbhc_bias(codec, true);
+ mbhc->mbhc_cb->mbhc_bias(component, true);
/* enable MBHC clock */
if (mbhc->mbhc_cb->clk_setup) {
if (mbhc->mbhc_cfg->enable_usbc_analog)
- mbhc->mbhc_cb->clk_setup(codec, false);
+ mbhc->mbhc_cb->clk_setup(component, false);
else
- mbhc->mbhc_cb->clk_setup(codec, true);
+ mbhc->mbhc_cb->clk_setup(component, true);
}
/* program HS_VREF value */
@@ -1425,7 +1423,7 @@
{
struct delayed_work *dwork;
struct wcd_mbhc *mbhc;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
const struct firmware *fw;
struct firmware_cal *fw_data = NULL;
int ret = -1, retry = 0;
@@ -1433,7 +1431,7 @@
dwork = to_delayed_work(work);
mbhc = container_of(dwork, struct wcd_mbhc, mbhc_firmware_dwork);
- codec = mbhc->codec;
+ component = mbhc->component;
while (retry < FW_READ_ATTEMPTS) {
retry++;
@@ -1444,7 +1442,7 @@
WCD9XXX_MBHC_CAL);
if (!fw_data)
ret = request_firmware(&fw, "wcd9320/wcd9320_mbhc.bin",
- codec->dev);
+ component->dev);
/*
* if request_firmware and hwdep cal both fail then
* sleep for 4sec for the userspace to send data to kernel
@@ -1565,11 +1563,11 @@
if (!mbhc)
return -EINVAL;
- dev_dbg(mbhc->codec->dev, "%s: mode = %lu\n", __func__, mode);
+ dev_dbg(mbhc->component->dev, "%s: mode = %lu\n", __func__, mode);
if (mode == POWER_SUPPLY_TYPEC_SINK_AUDIO_ADAPTER) {
if (mbhc->mbhc_cb->clk_setup)
- mbhc->mbhc_cb->clk_setup(mbhc->codec, true);
+ mbhc->mbhc_cb->clk_setup(mbhc->component, true);
/* insertion detected, enable L_DET_EN */
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_L_DET_EN, 1);
}
@@ -1579,20 +1577,20 @@
int wcd_mbhc_start(struct wcd_mbhc *mbhc, struct wcd_mbhc_config *mbhc_cfg)
{
int rc = 0;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct snd_soc_card *card;
const char *usb_c_dt = "qcom,msm-mbhc-usbc-audio-supported";
if (!mbhc || !mbhc_cfg)
return -EINVAL;
- codec = mbhc->codec;
- card = codec->component.card;
+ component = mbhc->component;
+ card = component->card;
/* update the mbhc config */
mbhc->mbhc_cfg = mbhc_cfg;
- dev_dbg(mbhc->codec->dev, "%s: enter\n", __func__);
+ dev_dbg(mbhc->component->dev, "%s: enter\n", __func__);
/* check if USB C analog is defined on device tree */
mbhc_cfg->enable_usbc_analog = 0;
@@ -1610,7 +1608,7 @@
/* Parse fsa switch handle */
if (mbhc_cfg->enable_usbc_analog) {
- dev_dbg(mbhc->codec->dev, "%s: usbc analog enabled\n",
+ dev_dbg(mbhc->component->dev, "%s: usbc analog enabled\n",
__func__);
mbhc->swap_thr = GND_MIC_USBC_SWAP_THRESHOLD;
mbhc->fsa_np = of_parse_phandle(card->dev->of_node,
@@ -1653,7 +1651,7 @@
return rc;
err:
- dev_dbg(mbhc->codec->dev, "%s: leave %d\n", __func__, rc);
+ dev_dbg(mbhc->component->dev, "%s: leave %d\n", __func__, rc);
return rc;
}
EXPORT_SYMBOL(wcd_mbhc_start);
@@ -1664,15 +1662,15 @@
if (mbhc->current_plug != MBHC_PLUG_TYPE_NONE) {
if (mbhc->mbhc_cb && mbhc->mbhc_cb->skip_imped_detect)
- mbhc->mbhc_cb->skip_imped_detect(mbhc->codec);
+ mbhc->mbhc_cb->skip_imped_detect(mbhc->component);
}
mbhc->current_plug = MBHC_PLUG_TYPE_NONE;
mbhc->hph_status = 0;
if (mbhc->mbhc_cb && mbhc->mbhc_cb->irq_control) {
- mbhc->mbhc_cb->irq_control(mbhc->codec,
+ mbhc->mbhc_cb->irq_control(mbhc->component,
mbhc->intr_ids->hph_left_ocp,
false);
- mbhc->mbhc_cb->irq_control(mbhc->codec,
+ mbhc->mbhc_cb->irq_control(mbhc->component,
mbhc->intr_ids->hph_right_ocp,
false);
}
@@ -1696,7 +1694,7 @@
*
* NOTE: mbhc->mbhc_cfg is not YET configure so shouldn't be used
*/
-int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec,
+int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_component *component,
const struct wcd_mbhc_cb *mbhc_cb,
const struct wcd_mbhc_intr *mbhc_cdc_intr_ids,
struct wcd_mbhc_register *wcd_mbhc_regs,
@@ -1706,7 +1704,7 @@
int hph_swh = 0;
int gnd_swh = 0;
u32 hph_moist_config[3];
- struct snd_soc_card *card = codec->component.card;
+ struct snd_soc_card *card = component->card;
const char *hph_switch = "qcom,msm-mbhc-hphl-swh";
const char *gnd_switch = "qcom,msm-mbhc-gnd-swh";
const char *hs_thre = "qcom,msm-mbhc-hs-mic-max-threshold-mv";
@@ -1758,7 +1756,7 @@
mbhc->in_swch_irq_handler = false;
mbhc->current_plug = MBHC_PLUG_TYPE_NONE;
mbhc->is_btn_press = false;
- mbhc->codec = codec;
+ mbhc->component = component;
mbhc->intr_ids = mbhc_cdc_intr_ids;
mbhc->impedance_detect = impedance_det_en;
mbhc->hphl_swh = hph_swh;
@@ -1778,7 +1776,7 @@
return -EINVAL;
}
if (!mbhc->wcd_mbhc_regs) {
- dev_err(codec->dev, "%s: mbhc registers are not defined\n",
+ dev_err(component->dev, "%s: mbhc registers are not defined\n",
__func__);
return -EINVAL;
}
@@ -1788,14 +1786,14 @@
!mbhc_cb->free_irq || !mbhc_cb->map_btn_code_to_num ||
!mbhc_cb->lock_sleep || !mbhc_cb->mbhc_bias ||
!mbhc_cb->set_btn_thr) {
- dev_err(codec->dev, "%s: required mbhc callbacks are not defined\n",
+ dev_err(component->dev, "%s: required mbhc callbacks are not defined\n",
__func__);
return -EINVAL;
}
/* No need to create new sound card jacks if is is already created */
if (mbhc->headset_jack.jack == NULL) {
- ret = snd_soc_card_jack_new(codec->component.card,
+ ret = snd_soc_card_jack_new(component->card,
"Headset Jack", WCD_MBHC_JACK_MASK,
&mbhc->headset_jack, NULL, 0);
if (ret) {
@@ -1803,7 +1801,7 @@
return ret;
}
- ret = snd_soc_card_jack_new(codec->component.card,
+ ret = snd_soc_card_jack_new(component->card,
"Button Jack",
WCD_MBHC_JACK_BUTTON_MASK,
&mbhc->button_jack, NULL, 0);
@@ -1865,16 +1863,17 @@
pr_err("%s: mbhc function pointer is NULL\n", __func__);
goto err_mbhc_sw_irq;
}
- ret = mbhc->mbhc_cb->request_irq(codec, mbhc->intr_ids->mbhc_sw_intr,
- wcd_mbhc_mech_plug_detect_irq,
- "mbhc sw intr", mbhc);
+ ret = mbhc->mbhc_cb->request_irq(component,
+ mbhc->intr_ids->mbhc_sw_intr,
+ wcd_mbhc_mech_plug_detect_irq,
+ "mbhc sw intr", mbhc);
if (ret) {
pr_err("%s: Failed to request irq %d, ret = %d\n", __func__,
mbhc->intr_ids->mbhc_sw_intr, ret);
goto err_mbhc_sw_irq;
}
- ret = mbhc->mbhc_cb->request_irq(codec,
+ ret = mbhc->mbhc_cb->request_irq(component,
mbhc->intr_ids->mbhc_btn_press_intr,
wcd_mbhc_btn_press_handler,
"Button Press detect", mbhc);
@@ -1884,7 +1883,7 @@
goto err_btn_press_irq;
}
- ret = mbhc->mbhc_cb->request_irq(codec,
+ ret = mbhc->mbhc_cb->request_irq(component,
mbhc->intr_ids->mbhc_btn_release_intr,
wcd_mbhc_release_handler,
"Button Release detect", mbhc);
@@ -1894,7 +1893,7 @@
goto err_btn_release_irq;
}
- ret = mbhc->mbhc_cb->request_irq(codec,
+ ret = mbhc->mbhc_cb->request_irq(component,
mbhc->intr_ids->mbhc_hs_ins_intr,
mbhc->mbhc_fn->wcd_mbhc_hs_ins_irq,
"Elect Insert", mbhc);
@@ -1903,11 +1902,11 @@
mbhc->intr_ids->mbhc_hs_ins_intr);
goto err_mbhc_hs_ins_irq;
}
- mbhc->mbhc_cb->irq_control(codec, mbhc->intr_ids->mbhc_hs_ins_intr,
+ mbhc->mbhc_cb->irq_control(component, mbhc->intr_ids->mbhc_hs_ins_intr,
false);
clear_bit(WCD_MBHC_ELEC_HS_INS, &mbhc->intr_status);
- ret = mbhc->mbhc_cb->request_irq(codec,
+ ret = mbhc->mbhc_cb->request_irq(component,
mbhc->intr_ids->mbhc_hs_rem_intr,
mbhc->mbhc_fn->wcd_mbhc_hs_rem_irq,
"Elect Remove", mbhc);
@@ -1916,22 +1915,24 @@
mbhc->intr_ids->mbhc_hs_rem_intr);
goto err_mbhc_hs_rem_irq;
}
- mbhc->mbhc_cb->irq_control(codec, mbhc->intr_ids->mbhc_hs_rem_intr,
+ mbhc->mbhc_cb->irq_control(component, mbhc->intr_ids->mbhc_hs_rem_intr,
false);
clear_bit(WCD_MBHC_ELEC_HS_REM, &mbhc->intr_status);
- ret = mbhc->mbhc_cb->request_irq(codec, mbhc->intr_ids->hph_left_ocp,
- wcd_mbhc_hphl_ocp_irq, "HPH_L OCP detect",
- mbhc);
+ ret = mbhc->mbhc_cb->request_irq(component,
+ mbhc->intr_ids->hph_left_ocp,
+ wcd_mbhc_hphl_ocp_irq, "HPH_L OCP detect",
+ mbhc);
if (ret) {
pr_err("%s: Failed to request irq %d\n", __func__,
mbhc->intr_ids->hph_left_ocp);
goto err_hphl_ocp_irq;
}
- ret = mbhc->mbhc_cb->request_irq(codec, mbhc->intr_ids->hph_right_ocp,
- wcd_mbhc_hphr_ocp_irq, "HPH_R OCP detect",
- mbhc);
+ ret = mbhc->mbhc_cb->request_irq(component,
+ mbhc->intr_ids->hph_right_ocp,
+ wcd_mbhc_hphr_ocp_irq, "HPH_R OCP detect",
+ mbhc);
if (ret) {
pr_err("%s: Failed to request irq %d\n", __func__,
mbhc->intr_ids->hph_right_ocp);
@@ -1943,19 +1944,22 @@
return ret;
err_hphr_ocp_irq:
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->hph_left_ocp, mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->hph_left_ocp, mbhc);
err_hphl_ocp_irq:
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_hs_rem_intr, mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_hs_rem_intr,
+ mbhc);
err_mbhc_hs_rem_irq:
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_hs_ins_intr, mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_hs_ins_intr,
+ mbhc);
err_mbhc_hs_ins_irq:
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_btn_release_intr,
+ mbhc->mbhc_cb->free_irq(component,
+ mbhc->intr_ids->mbhc_btn_release_intr,
mbhc);
err_btn_release_irq:
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_btn_press_intr,
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_btn_press_intr,
mbhc);
err_btn_press_irq:
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_sw_intr, mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_sw_intr, mbhc);
err_mbhc_sw_irq:
if (mbhc->mbhc_cb->register_notifier)
mbhc->mbhc_cb->register_notifier(mbhc, &mbhc->nblock, false);
@@ -1968,17 +1972,20 @@
void wcd_mbhc_deinit(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_sw_intr, mbhc);
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_btn_press_intr,
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_sw_intr, mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_btn_press_intr,
mbhc);
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_btn_release_intr,
+ mbhc->mbhc_cb->free_irq(component,
+ mbhc->intr_ids->mbhc_btn_release_intr,
mbhc);
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_hs_ins_intr, mbhc);
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_hs_rem_intr, mbhc);
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->hph_left_ocp, mbhc);
- mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->hph_right_ocp, mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_hs_ins_intr,
+ mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_hs_rem_intr,
+ mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->hph_left_ocp, mbhc);
+ mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->hph_right_ocp, mbhc);
if (mbhc->mbhc_cb && mbhc->mbhc_cb->register_notifier)
mbhc->mbhc_cb->register_notifier(mbhc, &mbhc->nblock, false);
if (mbhc->mbhc_fn->wcd_cancel_hs_detect_plug) {
diff --git a/asoc/codecs/wcd-mbhc-v2.h b/asoc/codecs/wcd-mbhc-v2.h
index fafac14..451ca91 100644
--- a/asoc/codecs/wcd-mbhc-v2.h
+++ b/asoc/codecs/wcd-mbhc-v2.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD_MBHC_V2_H__
#define __WCD_MBHC_V2_H__
@@ -59,7 +51,7 @@
#define WCD_MBHC_REG_UPDATE_BITS(function, val) \
do { \
if (mbhc->wcd_mbhc_regs[function].reg) { \
- snd_soc_update_bits(mbhc->codec, \
+ snd_soc_component_update_bits(mbhc->component, \
mbhc->wcd_mbhc_regs[function].reg, \
mbhc->wcd_mbhc_regs[function].mask, \
val << (mbhc->wcd_mbhc_regs[function].offset)); \
@@ -69,7 +61,7 @@
#define WCD_MBHC_REG_READ(function, val) \
do { \
if (mbhc->wcd_mbhc_regs[function].reg) { \
- val = (((snd_soc_read(mbhc->codec, \
+ val = (((snd_soc_component_read32(mbhc->component, \
mbhc->wcd_mbhc_regs[function].reg)) & \
(mbhc->wcd_mbhc_regs[function].mask)) >> \
(mbhc->wcd_mbhc_regs[function].offset)); \
@@ -428,7 +420,7 @@
void *calibration;
bool detect_extn_cable;
bool mono_stero_detection;
- bool (*swap_gnd_mic)(struct snd_soc_codec *codec, bool active);
+ bool (*swap_gnd_mic)(struct snd_soc_component *component, bool active);
bool hs_ext_micbias;
bool gnd_det_en;
int key_code[WCD_MBHC_KEYCODE_NUM];
@@ -460,53 +452,64 @@
};
struct wcd_mbhc_cb {
- int (*enable_mb_source)(struct wcd_mbhc *, bool);
- void (*trim_btn_reg)(struct snd_soc_codec *);
- void (*compute_impedance)(struct wcd_mbhc *, uint32_t *, uint32_t *);
- void (*set_micbias_value)(struct snd_soc_codec *);
- void (*set_auto_zeroing)(struct snd_soc_codec *, bool);
- struct firmware_cal * (*get_hwdep_fw_cal)(struct wcd_mbhc *,
+ int (*enable_mb_source)(struct wcd_mbhc *mbhc, bool turn_on);
+ void (*trim_btn_reg)(struct snd_soc_component *component);
+ void (*compute_impedance)(struct wcd_mbhc *mbhc,
+ uint32_t *zl, uint32_t *zr);
+ void (*set_micbias_value)(struct snd_soc_component *component);
+ void (*set_auto_zeroing)(struct snd_soc_component *component,
+ bool enable);
+ struct firmware_cal * (*get_hwdep_fw_cal)(struct wcd_mbhc *mbhc,
enum wcd_cal_type);
- void (*set_cap_mode)(struct snd_soc_codec *, bool, bool);
- int (*register_notifier)(struct wcd_mbhc *,
+ void (*set_cap_mode)(struct snd_soc_component *component,
+ bool micbias1, bool micbias2);
+ int (*register_notifier)(struct wcd_mbhc *mbhc,
struct notifier_block *nblock,
bool enable);
- int (*request_irq)(struct snd_soc_codec *,
- int, irq_handler_t, const char *, void *);
- void (*irq_control)(struct snd_soc_codec *,
+ int (*request_irq)(struct snd_soc_component *component,
+ int irq, irq_handler_t handler,
+ const char *name, void *data);
+ void (*irq_control)(struct snd_soc_component *component,
int irq, bool enable);
- int (*free_irq)(struct snd_soc_codec *,
- int irq, void *);
- void (*clk_setup)(struct snd_soc_codec *, bool);
- int (*map_btn_code_to_num)(struct snd_soc_codec *);
- bool (*lock_sleep)(struct wcd_mbhc *, bool);
- bool (*micbias_enable_status)(struct wcd_mbhc *, int);
- void (*mbhc_bias)(struct snd_soc_codec *, bool);
- void (*mbhc_common_micb_ctrl)(struct snd_soc_codec *,
- int event, bool);
- void (*micb_internal)(struct snd_soc_codec *,
- int micb_num, bool);
- bool (*hph_pa_on_status)(struct snd_soc_codec *);
- void (*set_btn_thr)(struct snd_soc_codec *, s16 *, s16 *,
- int num_btn, bool);
- void (*hph_pull_up_control)(struct snd_soc_codec *,
+ int (*free_irq)(struct snd_soc_component *component,
+ int irq, void *data);
+ void (*clk_setup)(struct snd_soc_component *component, bool enable);
+ int (*map_btn_code_to_num)(struct snd_soc_component *component);
+ bool (*lock_sleep)(struct wcd_mbhc *mbhc, bool lock);
+ bool (*micbias_enable_status)(struct wcd_mbhc *mbhc, int micb_num);
+ void (*mbhc_bias)(struct snd_soc_component *component, bool enable);
+ void (*mbhc_common_micb_ctrl)(struct snd_soc_component *component,
+ int event, bool enable);
+ void (*micb_internal)(struct snd_soc_component *component,
+ int micb_num, bool enable);
+ bool (*hph_pa_on_status)(struct snd_soc_component *component);
+ void (*set_btn_thr)(struct snd_soc_component *component,
+ s16 *btn_low, s16 *btn_high,
+ int num_btn, bool is_micbias);
+ void (*hph_pull_up_control)(struct snd_soc_component *component,
enum mbhc_hs_pullup_iref);
- int (*mbhc_micbias_control)(struct snd_soc_codec *, int, int req);
- void (*mbhc_micb_ramp_control)(struct snd_soc_codec *, bool);
- void (*skip_imped_detect)(struct snd_soc_codec *);
- bool (*extn_use_mb)(struct snd_soc_codec *);
- int (*mbhc_micb_ctrl_thr_mic)(struct snd_soc_codec *, int, bool);
- void (*mbhc_gnd_det_ctrl)(struct snd_soc_codec *, bool);
- void (*hph_pull_down_ctrl)(struct snd_soc_codec *, bool);
- void (*mbhc_moisture_config)(struct wcd_mbhc *);
- bool (*hph_register_recovery)(struct wcd_mbhc *);
- void (*update_anc_state)(struct snd_soc_codec *codec,
- bool enable, int anc_num);
+ int (*mbhc_micbias_control)(struct snd_soc_component *component,
+ int micb_num, int req);
+ void (*mbhc_micb_ramp_control)(struct snd_soc_component *component,
+ bool enable);
+ void (*skip_imped_detect)(struct snd_soc_component *component);
+ bool (*extn_use_mb)(struct snd_soc_component *component);
+ int (*mbhc_micb_ctrl_thr_mic)(struct snd_soc_component *component,
+ int micb_num, bool req_en);
+ void (*mbhc_gnd_det_ctrl)(struct snd_soc_component *component,
+ bool enable);
+ void (*hph_pull_down_ctrl)(struct snd_soc_component *component,
+ bool enable);
+ void (*mbhc_moisture_config)(struct wcd_mbhc *mbhc);
+ bool (*hph_register_recovery)(struct wcd_mbhc *mbhc);
+ void (*update_anc_state)(struct snd_soc_component *component,
+ bool enable, int anc_num);
bool (*is_anc_on)(struct wcd_mbhc *mbhc);
- void (*hph_pull_up_control_v2)(struct snd_soc_codec *, int);
- bool (*mbhc_get_moisture_status)(struct wcd_mbhc *);
- void (*mbhc_moisture_polling_ctrl)(struct wcd_mbhc *, bool);
- void (*mbhc_moisture_detect_en)(struct wcd_mbhc *, bool);
+ void (*hph_pull_up_control_v2)(struct snd_soc_component *component,
+ int pull_up_cur);
+ bool (*mbhc_get_moisture_status)(struct wcd_mbhc *mbhc);
+ void (*mbhc_moisture_polling_ctrl)(struct wcd_mbhc *mbhc, bool enable);
+ void (*mbhc_moisture_detect_en)(struct wcd_mbhc *mbhc, bool enable);
};
struct wcd_mbhc_fn {
@@ -552,7 +555,7 @@
bool is_btn_already_regd;
bool extn_cable_hph_rem;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
/* Work to perform MBHC Firmware Read */
struct delayed_work mbhc_firmware_dwork;
const struct firmware *mbhc_fw;
diff --git a/asoc/codecs/wcd-spi-registers.h b/asoc/codecs/wcd-spi-registers.h
index 4e57969..df48cd0 100644
--- a/asoc/codecs/wcd-spi-registers.h
+++ b/asoc/codecs/wcd-spi-registers.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD_SPI_REGISTERS_H__
diff --git a/asoc/codecs/wcd-spi.c b/asoc/codecs/wcd-spi.c
index bb93334..9acf24a 100644
--- a/asoc/codecs/wcd-spi.c
+++ b/asoc/codecs/wcd-spi.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
diff --git a/asoc/codecs/wcd9335-regmap.c b/asoc/codecs/wcd9335-regmap.c
index a21257c..9d1ccb8 100644
--- a/asoc/codecs/wcd9335-regmap.c
+++ b/asoc/codecs/wcd9335-regmap.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/regmap.h>
diff --git a/asoc/codecs/wcd9335-tables.c b/asoc/codecs/wcd9335-tables.c
index 7df2778..cd223c9 100644
--- a/asoc/codecs/wcd9335-tables.c
+++ b/asoc/codecs/wcd9335-tables.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/types.h>
diff --git a/asoc/codecs/wcd9335.c b/asoc/codecs/wcd9335.c
index d7db8ee..740f232 100644
--- a/asoc/codecs/wcd9335.c
+++ b/asoc/codecs/wcd9335.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -49,6 +41,8 @@
#include "wcdcal-hwdep.h"
#include "wcd-mbhc-v2-api.h"
+#define DRV_NAME "tasha_codec"
+
#define TASHA_RX_PORT_START_NUMBER 16
#define WCD9335_RATES_MASK (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
@@ -555,9 +549,9 @@
static struct snd_soc_dai_driver tasha_dai[];
static int wcd9335_get_micb_vout_ctl_val(u32 micb_mv);
-static int tasha_config_compander(struct snd_soc_codec *, int, int);
-static void tasha_codec_set_tx_hold(struct snd_soc_codec *, u16, bool);
-static int tasha_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
+static int tasha_config_compander(struct snd_soc_component *, int, int);
+static void tasha_codec_set_tx_hold(struct snd_soc_component *, u16, bool);
+static int tasha_codec_internal_rco_ctrl(struct snd_soc_component *component,
bool enable);
/* Hold instance to soundwire platform device */
@@ -707,7 +701,7 @@
struct device *dev;
struct wcd9xxx *wcd9xxx;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u32 adc_count;
u32 rx_bias_count;
s32 dmic_0_1_clk_cnt;
@@ -805,7 +799,7 @@
struct mutex swr_clk_lock;
int swr_clk_users;
int native_clk_users;
- int (*zdet_gpio_cb)(struct snd_soc_codec *codec, bool high);
+ int (*zdet_gpio_cb)(struct snd_soc_component *component, bool high);
struct snd_info_entry *entry;
struct snd_info_entry *version_entry;
@@ -813,7 +807,7 @@
struct on_demand_supply on_demand_list[ON_DEMAND_SUPPLIES_MAX];
- int (*machine_codec_event_cb)(struct snd_soc_codec *codec,
+ int (*machine_codec_event_cb)(struct snd_soc_component *component,
enum wcd9335_codec_event);
int spkr_gain_offset;
int spkr_mode;
@@ -840,7 +834,7 @@
int child_count;
};
-static int tasha_codec_vote_max_bw(struct snd_soc_codec *codec,
+static int tasha_codec_vote_max_bw(struct snd_soc_component *component,
bool vote);
static const struct tasha_reg_mask_val tasha_spkr_default[] = {
@@ -865,14 +859,14 @@
* tasha_set_spkr_gain_offset - offset the speaker path
* gain with the given offset value.
*
- * @codec: codec instance
+ * @component: codec component instance
* @offset: Indicates speaker path gain offset value.
*
* Returns 0 on success or -EINVAL on error.
*/
-int tasha_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset)
+int tasha_set_spkr_gain_offset(struct snd_soc_component *component, int offset)
{
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
if (!priv)
return -EINVAL;
@@ -886,14 +880,14 @@
* tasha_set_spkr_mode - Configures speaker compander and smartboost
* settings based on speaker mode.
*
- * @codec: codec instance
+ * @component: codec component instance
* @mode: Indicates speaker configuration mode.
*
* Returns 0 on success or -EINVAL on error.
*/
-int tasha_set_spkr_mode(struct snd_soc_codec *codec, int mode)
+int tasha_set_spkr_mode(struct snd_soc_component *component, int mode)
{
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
int i;
const struct tasha_reg_mask_val *regs;
int size;
@@ -914,21 +908,23 @@
priv->spkr_mode = mode;
for (i = 0; i < size; i++)
- snd_soc_update_bits(codec, regs[i].reg,
+ snd_soc_component_update_bits(component, regs[i].reg,
regs[i].mask, regs[i].val);
return 0;
}
EXPORT_SYMBOL(tasha_set_spkr_mode);
-static void tasha_enable_sido_buck(struct snd_soc_codec *codec)
+static void tasha_enable_sido_buck(struct snd_soc_component *component)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
- snd_soc_update_bits(codec, WCD9335_ANA_RCO, 0x80, 0x80);
- snd_soc_update_bits(codec, WCD9335_ANA_BUCK_CTL, 0x02, 0x02);
+ snd_soc_component_update_bits(component, WCD9335_ANA_RCO, 0x80, 0x80);
+ snd_soc_component_update_bits(component, WCD9335_ANA_BUCK_CTL,
+ 0x02, 0x02);
/* 100us sleep needed after IREF settings */
usleep_range(100, 110);
- snd_soc_update_bits(codec, WCD9335_ANA_BUCK_CTL, 0x04, 0x04);
+ snd_soc_component_update_bits(component, WCD9335_ANA_BUCK_CTL,
+ 0x04, 0x04);
/* 100us sleep needed after VREF settings */
usleep_range(100, 110);
tasha->resmgr->sido_input_src = SIDO_SOURCE_RCO_BG;
@@ -936,30 +932,30 @@
static void tasha_cdc_sido_ccl_enable(struct tasha_priv *tasha, bool ccl_flag)
{
- struct snd_soc_codec *codec = tasha->codec;
+ struct snd_soc_component *component = tasha->component;
- if (!codec)
+ if (!component)
return;
if (!TASHA_IS_2_0(tasha->wcd9xxx)) {
- dev_dbg(codec->dev, "%s: tasha version < 2p0, return\n",
+ dev_dbg(component->dev, "%s: tasha version < 2p0, return\n",
__func__);
return;
}
- dev_dbg(codec->dev, "%s: sido_ccl_cnt=%d, ccl_flag:%d\n",
+ dev_dbg(component->dev, "%s: sido_ccl_cnt=%d, ccl_flag:%d\n",
__func__, tasha->sido_ccl_cnt, ccl_flag);
if (ccl_flag) {
if (++tasha->sido_ccl_cnt == 1)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_SIDO_SIDO_CCL_10, 0xFF, 0x6E);
} else {
if (tasha->sido_ccl_cnt == 0) {
- dev_dbg(codec->dev, "%s: sido_ccl already disabled\n",
+ dev_dbg(component->dev, "%s: sido_ccl already disabled\n",
__func__);
return;
}
if (--tasha->sido_ccl_cnt == 0)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_SIDO_SIDO_CCL_10, 0xFF, 0x02);
}
}
@@ -1018,10 +1014,10 @@
enum tasha_sido_voltage req_mv)
{
u32 vout_d_val;
- struct snd_soc_codec *codec = tasha->codec;
+ struct snd_soc_component *component = tasha->component;
int ret;
- if (!codec)
+ if (!component)
return;
if (!tasha_cdc_is_svs_enabled(tasha))
@@ -1033,19 +1029,19 @@
ret = tasha_cdc_check_sido_value(req_mv);
if (ret < 0) {
- dev_dbg(codec->dev, "%s: requested mv=%d not in range\n",
+ dev_dbg(component->dev, "%s: requested mv=%d not in range\n",
__func__, req_mv);
return;
}
if (req_mv == tasha->sido_voltage) {
- dev_dbg(codec->dev, "%s: Already at requested mv=%d\n",
+ dev_dbg(component->dev, "%s: Already at requested mv=%d\n",
__func__, req_mv);
return;
}
if (req_mv == sido_buck_svs_voltage) {
if (test_bit(AUDIO_NOMINAL, &tasha->status_mask) ||
test_bit(CPE_NOMINAL, &tasha->status_mask)) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: nominal client running, status_mask=%lu\n",
__func__, tasha->status_mask);
return;
@@ -1053,17 +1049,19 @@
}
/* compute the vout_d step value */
vout_d_val = CALCULATE_VOUT_D(req_mv);
- snd_soc_write(codec, WCD9335_ANA_BUCK_VOUT_D, vout_d_val & 0xFF);
- snd_soc_update_bits(codec, WCD9335_ANA_BUCK_CTL, 0x80, 0x80);
+ snd_soc_component_write(component, WCD9335_ANA_BUCK_VOUT_D,
+ vout_d_val & 0xFF);
+ snd_soc_component_update_bits(component, WCD9335_ANA_BUCK_CTL,
+ 0x80, 0x80);
/* 1 msec sleep required after SIDO Vout_D voltage change */
usleep_range(1000, 1100);
tasha->sido_voltage = req_mv;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: updated SIDO buck Vout_D to %d, vout_d step = %u\n",
__func__, tasha->sido_voltage, vout_d_val);
- snd_soc_update_bits(codec, WCD9335_ANA_BUCK_CTL,
+ snd_soc_component_update_bits(component, WCD9335_ANA_BUCK_CTL,
0x80, 0x00);
}
@@ -1092,43 +1090,47 @@
return ret;
}
-int tasha_enable_efuse_sensing(struct snd_soc_codec *codec)
+int tasha_enable_efuse_sensing(struct snd_soc_component *component)
{
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
- tasha_cdc_mclk_enable(codec, true, false);
+ tasha_cdc_mclk_enable(component, true, false);
if (!TASHA_IS_2_0(priv->wcd9xxx))
- snd_soc_update_bits(codec, WCD9335_CHIP_TIER_CTRL_EFUSE_CTL,
- 0x1E, 0x02);
- snd_soc_update_bits(codec, WCD9335_CHIP_TIER_CTRL_EFUSE_CTL,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CHIP_TIER_CTRL_EFUSE_CTL,
+ 0x1E, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD9335_CHIP_TIER_CTRL_EFUSE_CTL,
+ 0x01, 0x01);
/*
* 5ms sleep required after enabling efuse control
* before checking the status.
*/
usleep_range(5000, 5500);
- if (!(snd_soc_read(codec, WCD9335_CHIP_TIER_CTRL_EFUSE_STATUS) & 0x01))
+ if (!(snd_soc_component_read32(
+ component, WCD9335_CHIP_TIER_CTRL_EFUSE_STATUS) & 0x01))
WARN(1, "%s: Efuse sense is not complete\n", __func__);
if (TASHA_IS_2_0(priv->wcd9xxx)) {
- if (!(snd_soc_read(codec,
+ if (!(snd_soc_component_read32(component,
WCD9335_CHIP_TIER_CTRL_EFUSE_VAL_OUT0) & 0x40))
- snd_soc_update_bits(codec, WCD9335_HPH_R_ATEST,
- 0x04, 0x00);
- tasha_enable_sido_buck(codec);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_R_ATEST,
+ 0x04, 0x00);
+ tasha_enable_sido_buck(component);
}
- tasha_cdc_mclk_enable(codec, false, false);
+ tasha_cdc_mclk_enable(component, false, false);
return 0;
}
EXPORT_SYMBOL(tasha_enable_efuse_sensing);
-void *tasha_get_afe_config(struct snd_soc_codec *codec,
+void *tasha_get_afe_config(struct snd_soc_component *component,
enum afe_config_type config_type)
{
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
switch (config_type) {
case AFE_SLIMBUS_SLAVE_CONFIG:
@@ -1146,7 +1148,7 @@
case AFE_CDC_REGISTER_PAGE_CONFIG:
return &tasha_cdc_reg_page_cfg;
default:
- dev_err(codec->dev, "%s: Unknown config_type 0x%x\n",
+ dev_err(component->dev, "%s: Unknown config_type 0x%x\n",
__func__, config_type);
return NULL;
}
@@ -1160,29 +1162,30 @@
* codec driver once codec comes out of reset after ADSP SSR.
*
* @machine_event_cb: callback function from machine driver
- * @codec: Codec instance
+ * @component: Codec component instance
*
* Return: none
*/
void tasha_event_register(
- int (*machine_event_cb)(struct snd_soc_codec *codec,
+ int (*machine_event_cb)(struct snd_soc_component *component,
enum wcd9335_codec_event),
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
if (tasha)
tasha->machine_codec_event_cb = machine_event_cb;
else
- dev_dbg(codec->dev, "%s: Invalid tasha_priv data\n", __func__);
+ dev_dbg(component->dev, "%s: Invalid tasha_priv data\n",
+ __func__);
}
EXPORT_SYMBOL(tasha_event_register);
-static int tasha_mbhc_request_irq(struct snd_soc_codec *codec,
+static int tasha_mbhc_request_irq(struct snd_soc_component *component,
int irq, irq_handler_t handler,
const char *name, void *data)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct wcd9xxx *wcd9xxx = tasha->wcd9xxx;
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
@@ -1190,10 +1193,10 @@
return wcd9xxx_request_irq(core_res, irq, handler, name, data);
}
-static void tasha_mbhc_irq_control(struct snd_soc_codec *codec,
+static void tasha_mbhc_irq_control(struct snd_soc_component *component,
int irq, bool enable)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct wcd9xxx *wcd9xxx = tasha->wcd9xxx;
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
@@ -1203,10 +1206,10 @@
wcd9xxx_disable_irq(core_res, irq);
}
-static int tasha_mbhc_free_irq(struct snd_soc_codec *codec,
+static int tasha_mbhc_free_irq(struct snd_soc_component *component,
int irq, void *data)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct wcd9xxx *wcd9xxx = tasha->wcd9xxx;
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
@@ -1215,34 +1218,35 @@
return 0;
}
-static void tasha_mbhc_clk_setup(struct snd_soc_codec *codec,
+static void tasha_mbhc_clk_setup(struct snd_soc_component *component,
bool enable)
{
if (enable)
- snd_soc_update_bits(codec, WCD9335_MBHC_CTL_1,
+ snd_soc_component_update_bits(component, WCD9335_MBHC_CTL_1,
0x80, 0x80);
else
- snd_soc_update_bits(codec, WCD9335_MBHC_CTL_1,
+ snd_soc_component_update_bits(component, WCD9335_MBHC_CTL_1,
0x80, 0x00);
}
-static int tasha_mbhc_btn_to_num(struct snd_soc_codec *codec)
+static int tasha_mbhc_btn_to_num(struct snd_soc_component *component)
{
- return snd_soc_read(codec, WCD9335_ANA_MBHC_RESULT_3) & 0x7;
+ return snd_soc_component_read32(
+ component, WCD9335_ANA_MBHC_RESULT_3) & 0x7;
}
-static void tasha_mbhc_mbhc_bias_control(struct snd_soc_codec *codec,
+static void tasha_mbhc_mbhc_bias_control(struct snd_soc_component *component,
bool enable)
{
if (enable)
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_ELECT,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_ELECT,
0x01, 0x01);
else
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_ELECT,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_ELECT,
0x01, 0x00);
}
-static void tasha_mbhc_program_btn_thr(struct snd_soc_codec *codec,
+static void tasha_mbhc_program_btn_thr(struct snd_soc_component *component,
s16 *btn_low, s16 *btn_high,
int num_btn, bool is_micbias)
{
@@ -1250,7 +1254,7 @@
int vth;
if (num_btn > WCD_MBHC_DEF_BUTTONS) {
- dev_err(codec->dev, "%s: invalid number of buttons: %d\n",
+ dev_err(component->dev, "%s: invalid number of buttons: %d\n",
__func__, num_btn);
return;
}
@@ -1262,17 +1266,18 @@
*/
for (i = 0; i < num_btn; i++) {
vth = ((btn_high[i] * 2) / 25) & 0x3F;
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_BTN0 + i,
- 0xFC, vth << 2);
- dev_dbg(codec->dev, "%s: btn_high[%d]: %d, vth: %d\n",
+ snd_soc_component_update_bits(
+ component, WCD9335_ANA_MBHC_BTN0 + i,
+ 0xFC, vth << 2);
+ dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n",
__func__, i, btn_high[i], vth);
}
}
static bool tasha_mbhc_lock_sleep(struct wcd_mbhc *mbhc, bool lock)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = mbhc->component;
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct wcd9xxx *wcd9xxx = tasha->wcd9xxx;
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
@@ -1288,8 +1293,8 @@
struct notifier_block *nblock,
bool enable)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = mbhc->component;
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
if (enable)
return blocking_notifier_chain_register(&tasha->notifier,
@@ -1304,22 +1309,25 @@
u8 val;
if (micb_num == MIC_BIAS_2) {
- val = (snd_soc_read(mbhc->codec, WCD9335_ANA_MICB2) >> 6);
+ val = (snd_soc_component_read32(
+ mbhc->component, WCD9335_ANA_MICB2) >> 6);
if (val == 0x01)
return true;
}
return false;
}
-static bool tasha_mbhc_hph_pa_on_status(struct snd_soc_codec *codec)
+static bool tasha_mbhc_hph_pa_on_status(struct snd_soc_component *component)
{
- return (snd_soc_read(codec, WCD9335_ANA_HPH) & 0xC0) ? true : false;
+ return (snd_soc_component_read32(component, WCD9335_ANA_HPH) & 0xC0) ?
+ true : false;
}
-static void tasha_mbhc_hph_l_pull_up_control(struct snd_soc_codec *codec,
- enum mbhc_hs_pullup_iref pull_up_cur)
+static void tasha_mbhc_hph_l_pull_up_control(
+ struct snd_soc_component *component,
+ enum mbhc_hs_pullup_iref pull_up_cur)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
if (!tasha)
return;
@@ -1329,22 +1337,24 @@
pull_up_cur == I_DEFAULT)
pull_up_cur = I_2P0_UA;
- dev_dbg(codec->dev, "%s: HS pull up current:%d\n",
+ dev_dbg(component->dev, "%s: HS pull up current:%d\n",
__func__, pull_up_cur);
if (TASHA_IS_2_0(tasha->wcd9xxx))
- snd_soc_update_bits(codec, WCD9335_MBHC_PLUG_DETECT_CTL,
- 0xC0, pull_up_cur << 6);
+ snd_soc_component_update_bits(component,
+ WCD9335_MBHC_PLUG_DETECT_CTL,
+ 0xC0, pull_up_cur << 6);
else
- snd_soc_update_bits(codec, WCD9335_MBHC_PLUG_DETECT_CTL,
- 0xC0, 0x40);
+ snd_soc_component_update_bits(component,
+ WCD9335_MBHC_PLUG_DETECT_CTL,
+ 0xC0, 0x40);
}
static int tasha_enable_ext_mb_source(struct wcd_mbhc *mbhc,
bool turn_on)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = mbhc->component;
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int ret = 0;
struct on_demand_supply *supply;
@@ -1353,20 +1363,21 @@
supply = &tasha->on_demand_list[ON_DEMAND_MICBIAS];
if (!supply->supply) {
- dev_dbg(codec->dev, "%s: warning supply not present ond for %s\n",
+ dev_dbg(component->dev, "%s: warning supply not present ond for %s\n",
__func__, "onDemand Micbias");
return ret;
}
- dev_dbg(codec->dev, "%s turn_on: %d count: %d\n", __func__, turn_on,
+ dev_dbg(component->dev, "%s turn_on: %d count: %d\n", __func__, turn_on,
supply->ondemand_supply_count);
if (turn_on) {
if (!(supply->ondemand_supply_count)) {
ret = snd_soc_dapm_force_enable_pin(
- snd_soc_codec_get_dapm(codec),
+ snd_soc_component_get_dapm(component),
"MICBIAS_REGULATOR");
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(
+ snd_soc_component_get_dapm(component));
}
supply->ondemand_supply_count++;
} else {
@@ -1374,27 +1385,27 @@
supply->ondemand_supply_count--;
if (!(supply->ondemand_supply_count)) {
ret = snd_soc_dapm_disable_pin(
- snd_soc_codec_get_dapm(codec),
+ snd_soc_component_get_dapm(component),
"MICBIAS_REGULATOR");
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(snd_soc_component_get_dapm(component));
}
}
if (ret)
- dev_err(codec->dev, "%s: Failed to %s external micbias source\n",
+ dev_err(component->dev, "%s: Failed to %s external micbias source\n",
__func__, turn_on ? "enable" : "disabled");
else
- dev_dbg(codec->dev, "%s: %s external micbias source\n",
+ dev_dbg(component->dev, "%s: %s external micbias source\n",
__func__, turn_on ? "Enabled" : "Disabled");
return ret;
}
-static int tasha_micbias_control(struct snd_soc_codec *codec,
+static int tasha_micbias_control(struct snd_soc_component *component,
int micb_num,
int req, bool is_dapm)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int micb_index = micb_num - 1;
u16 micb_reg;
int pre_off_event = 0, post_off_event = 0;
@@ -1402,7 +1413,7 @@
int post_dapm_on = 0;
if ((micb_index < 0) || (micb_index > TASHA_MAX_MICBIAS - 1)) {
- dev_err(codec->dev, "%s: Invalid micbias index, micb_ind:%d\n",
+ dev_err(component->dev, "%s: Invalid micbias index, micb_ind:%d\n",
__func__, micb_index);
return -EINVAL;
}
@@ -1425,7 +1436,7 @@
micb_reg = WCD9335_ANA_MICB4;
break;
default:
- dev_err(codec->dev, "%s: Invalid micbias number: %d\n",
+ dev_err(component->dev, "%s: Invalid micbias number: %d\n",
__func__, micb_num);
return -EINVAL;
}
@@ -1436,19 +1447,22 @@
tasha->pullup_ref[micb_index]++;
if ((tasha->pullup_ref[micb_index] == 1) &&
(tasha->micb_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x80);
break;
case MICB_PULLUP_DISABLE:
if (tasha->pullup_ref[micb_index] > 0)
tasha->pullup_ref[micb_index]--;
if ((tasha->pullup_ref[micb_index] == 0) &&
(tasha->micb_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x00);
break;
case MICB_ENABLE:
tasha->micb_ref[micb_index]++;
if (tasha->micb_ref[micb_index] == 1) {
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x40);
if (post_on_event)
blocking_notifier_call_chain(&tasha->notifier,
post_on_event, &tasha->mbhc);
@@ -1462,13 +1476,15 @@
tasha->micb_ref[micb_index]--;
if ((tasha->micb_ref[micb_index] == 0) &&
(tasha->pullup_ref[micb_index] > 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x80);
else if ((tasha->micb_ref[micb_index] == 0) &&
(tasha->pullup_ref[micb_index] == 0)) {
if (pre_off_event)
blocking_notifier_call_chain(&tasha->notifier,
pre_off_event, &tasha->mbhc);
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x00);
if (post_off_event)
blocking_notifier_call_chain(&tasha->notifier,
post_off_event, &tasha->mbhc);
@@ -1479,7 +1495,7 @@
break;
};
- dev_dbg(codec->dev, "%s: micb_num:%d, micb_ref: %d, pullup_ref: %d\n",
+ dev_dbg(component->dev, "%s: micb_num:%d, micb_ref: %d, pullup_ref: %d\n",
__func__, micb_num, tasha->micb_ref[micb_index],
tasha->pullup_ref[micb_index]);
@@ -1488,7 +1504,7 @@
return 0;
}
-static int tasha_mbhc_request_micbias(struct snd_soc_codec *codec,
+static int tasha_mbhc_request_micbias(struct snd_soc_component *component,
int micb_num, int req)
{
int ret;
@@ -1498,32 +1514,32 @@
* is vote to enable mclk
*/
if (req == MICB_ENABLE)
- tasha_cdc_mclk_enable(codec, true, false);
+ tasha_cdc_mclk_enable(component, true, false);
- ret = tasha_micbias_control(codec, micb_num, req, false);
+ ret = tasha_micbias_control(component, micb_num, req, false);
/*
* Release vote for mclk while requesting for
* micbias disable
*/
if (req == MICB_DISABLE)
- tasha_cdc_mclk_enable(codec, false, false);
+ tasha_cdc_mclk_enable(component, false, false);
return ret;
}
-static void tasha_mbhc_micb_ramp_control(struct snd_soc_codec *codec,
+static void tasha_mbhc_micb_ramp_control(struct snd_soc_component *component,
bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD9335_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MICB2_RAMP,
0x1C, 0x0C);
- snd_soc_update_bits(codec, WCD9335_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MICB2_RAMP,
0x80, 0x80);
} else {
- snd_soc_update_bits(codec, WCD9335_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MICB2_RAMP,
0x80, 0x00);
- snd_soc_update_bits(codec, WCD9335_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MICB2_RAMP,
0x1C, 0x00);
}
}
@@ -1533,22 +1549,22 @@
{
struct tasha_priv *tasha;
struct firmware_cal *hwdep_cal;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
- if (!codec) {
- pr_err("%s: NULL codec pointer\n", __func__);
+ if (!component) {
+ pr_err("%s: NULL component pointer\n", __func__);
return NULL;
}
- tasha = snd_soc_codec_get_drvdata(codec);
+ tasha = snd_soc_component_get_drvdata(component);
hwdep_cal = wcdcal_get_fw_cal(tasha->fw_data, type);
if (!hwdep_cal)
- dev_err(codec->dev, "%s: cal not sent by %d\n",
+ dev_err(component->dev, "%s: cal not sent by %d\n",
__func__, type);
return hwdep_cal;
}
-static int tasha_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
+static int tasha_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int req_volt,
int micb_num)
{
@@ -1580,7 +1596,7 @@
* momentarily, change the micbias value and then re-enable
* micbias.
*/
- micb_val = snd_soc_read(codec, micb_reg);
+ micb_val = snd_soc_component_read32(component, micb_reg);
micb_en = (micb_val & 0xC0) >> 6;
cur_vout_ctl = micb_val & 0x3F;
@@ -1590,17 +1606,17 @@
if (cur_vout_ctl == req_vout_ctl)
return 0;
- dev_dbg(codec->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n",
+ dev_dbg(component->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n",
__func__, micb_num, WCD_VOUT_CTL_TO_MICB(cur_vout_ctl),
req_volt, micb_en);
if (micb_en == 0x1)
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg, 0xC0, 0x80);
- snd_soc_update_bits(codec, micb_reg, 0x3F, req_vout_ctl);
+ snd_soc_component_update_bits(component, micb_reg, 0x3F, req_vout_ctl);
if (micb_en == 0x1) {
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
+ snd_soc_component_update_bits(component, micb_reg, 0xC0, 0x40);
/*
* Add 2ms delay as per HW requirement after enabling
* micbias
@@ -1611,11 +1627,12 @@
return 0;
}
-static int tasha_mbhc_micb_ctrl_threshold_mic(struct snd_soc_codec *codec,
- int micb_num, bool req_en)
+static int tasha_mbhc_micb_ctrl_threshold_mic(
+ struct snd_soc_component *component,
+ int micb_num, bool req_en)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx_pdata *pdata = dev_get_platdata(component->dev->parent);
int rc, micb_mv;
if (micb_num != MIC_BIAS_2)
@@ -1632,7 +1649,7 @@
micb_mv = req_en ? WCD_MBHC_THR_HS_MICB_MV : pdata->micbias.micb2_mv;
mutex_lock(&tasha->micb_lock);
- rc = tasha_mbhc_micb_adjust_voltage(codec, micb_mv, MIC_BIAS_2);
+ rc = tasha_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2);
mutex_unlock(&tasha->micb_lock);
return rc;
@@ -1702,39 +1719,40 @@
* to make the switch open.
*
* @zdet_gpio_cb: callback function from machine driver
- * @codec: Codec instance
+ * @component: Codec instance
*
* Return: none
*/
void tasha_mbhc_zdet_gpio_ctrl(
- int (*zdet_gpio_cb)(struct snd_soc_codec *codec, bool high),
- struct snd_soc_codec *codec)
+ int (*zdet_gpio_cb)(
+ struct snd_soc_component *component, bool high),
+ struct snd_soc_component *component)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
tasha->zdet_gpio_cb = zdet_gpio_cb;
}
EXPORT_SYMBOL(tasha_mbhc_zdet_gpio_ctrl);
-static void tasha_mbhc_zdet_ramp(struct snd_soc_codec *codec,
+static void tasha_mbhc_zdet_ramp(struct snd_soc_component *component,
struct tasha_mbhc_zdet_param *zdet_param,
int32_t *zl, int32_t *zr, s16 *d1_a)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
int32_t zdet = 0;
- snd_soc_update_bits(codec, WCD9335_MBHC_ZDET_ANA_CTL, 0x70,
- zdet_param->ldo_ctl << 4);
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_BTN5, 0xFC,
- zdet_param->btn5);
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_BTN6, 0xFC,
- zdet_param->btn6);
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_BTN7, 0xFC,
- zdet_param->btn7);
- snd_soc_update_bits(codec, WCD9335_MBHC_ZDET_ANA_CTL, 0x0F,
- zdet_param->noff);
- snd_soc_update_bits(codec, WCD9335_MBHC_ZDET_RAMP_CTL, 0x0F,
- zdet_param->nshift);
+ snd_soc_component_update_bits(component, WCD9335_MBHC_ZDET_ANA_CTL,
+ 0x70, zdet_param->ldo_ctl << 4);
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_BTN5, 0xFC,
+ zdet_param->btn5);
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_BTN6, 0xFC,
+ zdet_param->btn6);
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_BTN7, 0xFC,
+ zdet_param->btn7);
+ snd_soc_component_update_bits(component, WCD9335_MBHC_ZDET_ANA_CTL,
+ 0x0F, zdet_param->noff);
+ snd_soc_component_update_bits(component, WCD9335_MBHC_ZDET_RAMP_CTL,
+ 0x0F, zdet_param->nshift);
if (!zl)
goto z_right;
@@ -1764,17 +1782,17 @@
*zr = zdet;
}
-static inline void tasha_wcd_mbhc_qfuse_cal(struct snd_soc_codec *codec,
+static inline void tasha_wcd_mbhc_qfuse_cal(struct snd_soc_component *component,
int32_t *z_val, int flag_l_r)
{
s16 q1;
int q1_cal;
if (*z_val < (TASHA_ZDET_VAL_400/1000))
- q1 = snd_soc_read(codec,
+ q1 = snd_soc_component_read32(component,
WCD9335_CHIP_TIER_CTRL_EFUSE_VAL_OUT1 + (2 * flag_l_r));
else
- q1 = snd_soc_read(codec,
+ q1 = snd_soc_component_read32(component,
WCD9335_CHIP_TIER_CTRL_EFUSE_VAL_OUT2 + (2 * flag_l_r));
if (q1 & 0x80)
q1_cal = (10000 - ((q1 & 0x7F) * 25));
@@ -1787,8 +1805,8 @@
static void tasha_wcd_mbhc_calc_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
uint32_t *zr)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = mbhc->component;
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct wcd9xxx *wcd9xxx = tasha->wcd9xxx;
s16 reg0, reg1, reg2, reg3, reg4;
int32_t z1L, z1R, z1Ls;
@@ -1811,7 +1829,7 @@
s16 *d1 = NULL;
if (!TASHA_IS_2_0(wcd9xxx)) {
- dev_dbg(codec->dev, "%s: Z-det is not supported for this codec version\n",
+ dev_dbg(component->dev, "%s: Z-det is not supported for this codec version\n",
__func__);
*zl = 0;
*zr = 0;
@@ -1820,15 +1838,16 @@
WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
if (tasha->zdet_gpio_cb)
- is_change = tasha->zdet_gpio_cb(codec, true);
+ is_change = tasha->zdet_gpio_cb(component, true);
- reg0 = snd_soc_read(codec, WCD9335_ANA_MBHC_BTN5);
- reg1 = snd_soc_read(codec, WCD9335_ANA_MBHC_BTN6);
- reg2 = snd_soc_read(codec, WCD9335_ANA_MBHC_BTN7);
- reg3 = snd_soc_read(codec, WCD9335_MBHC_CTL_1);
- reg4 = snd_soc_read(codec, WCD9335_MBHC_ZDET_ANA_CTL);
+ reg0 = snd_soc_component_read32(component, WCD9335_ANA_MBHC_BTN5);
+ reg1 = snd_soc_component_read32(component, WCD9335_ANA_MBHC_BTN6);
+ reg2 = snd_soc_component_read32(component, WCD9335_ANA_MBHC_BTN7);
+ reg3 = snd_soc_component_read32(component, WCD9335_MBHC_CTL_1);
+ reg4 = snd_soc_component_read32(component, WCD9335_MBHC_ZDET_ANA_CTL);
- if (snd_soc_read(codec, WCD9335_ANA_MBHC_ELECT) & 0x80) {
+ if (snd_soc_component_read32(
+ component, WCD9335_ANA_MBHC_ELECT) & 0x80) {
is_fsm_disable = true;
regmap_update_bits(wcd9xxx->regmap,
WCD9335_ANA_MBHC_ELECT, 0x80, 0x00);
@@ -1840,7 +1859,8 @@
WCD9335_ANA_MBHC_MECH, 0x80, 0x00);
/* Enable AZ */
- snd_soc_update_bits(codec, WCD9335_MBHC_CTL_1, 0x0C, 0x04);
+ snd_soc_component_update_bits(component, WCD9335_MBHC_CTL_1,
+ 0x0C, 0x04);
/* Turn off 100k pull down on HPHL */
regmap_update_bits(wcd9xxx->regmap,
WCD9335_ANA_MBHC_MECH, 0x01, 0x00);
@@ -1848,7 +1868,7 @@
/* First get impedance on Left */
d1 = d1_a[1];
zdet_param_ptr = &zdet_param[1];
- tasha_mbhc_zdet_ramp(codec, zdet_param_ptr, &z1L, NULL, d1);
+ tasha_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1);
if (!TASHA_MBHC_IS_SECOND_RAMP_REQUIRED(z1L))
goto left_ch_impedance;
@@ -1864,7 +1884,7 @@
zdet_param_ptr = &zdet_param[3];
d1 = d1_a[3];
}
- tasha_mbhc_zdet_ramp(codec, zdet_param_ptr, &z1L, NULL, d1);
+ tasha_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1);
left_ch_impedance:
if ((z1L == TASHA_ZDET_FLOATING_IMPEDANCE) ||
@@ -1874,13 +1894,13 @@
d1 = d1_a[1];
} else {
*zl = z1L/1000;
- tasha_wcd_mbhc_qfuse_cal(codec, zl, 0);
+ tasha_wcd_mbhc_qfuse_cal(component, zl, 0);
}
- dev_dbg(codec->dev, "%s: impedance on HPH_L = %d(ohms)\n",
+ dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n",
__func__, *zl);
/* start of right impedance ramp and calculation */
- tasha_mbhc_zdet_ramp(codec, zdet_param_ptr, NULL, &z1R, d1);
+ tasha_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1);
if (TASHA_MBHC_IS_SECOND_RAMP_REQUIRED(z1R)) {
if (((z1R > TASHA_ZDET_VAL_1200) &&
(zdet_param_ptr->noff == 0x6)) ||
@@ -1898,7 +1918,7 @@
zdet_param_ptr = &zdet_param[3];
d1 = d1_a[3];
}
- tasha_mbhc_zdet_ramp(codec, zdet_param_ptr, NULL, &z1R, d1);
+ tasha_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1);
}
right_ch_impedance:
if ((z1R == TASHA_ZDET_FLOATING_IMPEDANCE) ||
@@ -1906,15 +1926,15 @@
*zr = TASHA_ZDET_FLOATING_IMPEDANCE;
} else {
*zr = z1R/1000;
- tasha_wcd_mbhc_qfuse_cal(codec, zr, 1);
+ tasha_wcd_mbhc_qfuse_cal(component, zr, 1);
}
- dev_dbg(codec->dev, "%s: impedance on HPH_R = %d(ohms)\n",
+ dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n",
__func__, *zr);
/* mono/stereo detection */
if ((*zl == TASHA_ZDET_FLOATING_IMPEDANCE) &&
(*zr == TASHA_ZDET_FLOATING_IMPEDANCE)) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: plug type is invalid or extension cable\n",
__func__);
goto zdet_complete;
@@ -1923,40 +1943,46 @@
(*zr == TASHA_ZDET_FLOATING_IMPEDANCE) ||
((*zl < WCD_MONO_HS_MIN_THR) && (*zr > WCD_MONO_HS_MIN_THR)) ||
((*zl > WCD_MONO_HS_MIN_THR) && (*zr < WCD_MONO_HS_MIN_THR))) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: Mono plug type with one ch floating or shorted to GND\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_MONO;
goto zdet_complete;
}
- snd_soc_update_bits(codec, WCD9335_HPH_R_ATEST, 0x02, 0x02);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x40, 0x01);
+ snd_soc_component_update_bits(component, WCD9335_HPH_R_ATEST,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, WCD9335_HPH_PA_CTL2,
+ 0x40, 0x01);
if (*zl < (TASHA_ZDET_VAL_32/1000))
- tasha_mbhc_zdet_ramp(codec, &zdet_param[0], &z1Ls, NULL, d1);
+ tasha_mbhc_zdet_ramp(component, &zdet_param[0],
+ &z1Ls, NULL, d1);
else
- tasha_mbhc_zdet_ramp(codec, &zdet_param[1], &z1Ls, NULL, d1);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x40, 0x00);
- snd_soc_update_bits(codec, WCD9335_HPH_R_ATEST, 0x02, 0x00);
+ tasha_mbhc_zdet_ramp(component, &zdet_param[1],
+ &z1Ls, NULL, d1);
+ snd_soc_component_update_bits(component, WCD9335_HPH_PA_CTL2,
+ 0x40, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_HPH_R_ATEST,
+ 0x02, 0x00);
z1Ls /= 1000;
- tasha_wcd_mbhc_qfuse_cal(codec, &z1Ls, 0);
+ tasha_wcd_mbhc_qfuse_cal(component, &z1Ls, 0);
/* parallel of left Z and 9 ohm pull down resistor */
zMono = ((*zl) * 9) / ((*zl) + 9);
z_diff1 = (z1Ls > zMono) ? (z1Ls - zMono) : (zMono - z1Ls);
z_diff2 = ((*zl) > z1Ls) ? ((*zl) - z1Ls) : (z1Ls - (*zl));
if ((z_diff1 * (*zl + z1Ls)) > (z_diff2 * (z1Ls + zMono))) {
- dev_dbg(codec->dev, "%s: stereo plug type detected\n",
+ dev_dbg(component->dev, "%s: stereo plug type detected\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_STEREO;
} else {
- dev_dbg(codec->dev, "%s: MONO plug type detected\n",
+ dev_dbg(component->dev, "%s: MONO plug type detected\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_MONO;
}
zdet_complete:
- snd_soc_write(codec, WCD9335_ANA_MBHC_BTN5, reg0);
- snd_soc_write(codec, WCD9335_ANA_MBHC_BTN6, reg1);
- snd_soc_write(codec, WCD9335_ANA_MBHC_BTN7, reg2);
+ snd_soc_component_write(component, WCD9335_ANA_MBHC_BTN5, reg0);
+ snd_soc_component_write(component, WCD9335_ANA_MBHC_BTN6, reg1);
+ snd_soc_component_write(component, WCD9335_ANA_MBHC_BTN7, reg2);
/* Turn on 100k pull down on HPHL */
regmap_update_bits(wcd9xxx->regmap,
WCD9335_ANA_MBHC_MECH, 0x01, 0x01);
@@ -1966,78 +1992,83 @@
regmap_update_bits(wcd9xxx->regmap,
WCD9335_ANA_MBHC_MECH, 0x80, 0x80);
- snd_soc_write(codec, WCD9335_MBHC_ZDET_ANA_CTL, reg4);
- snd_soc_write(codec, WCD9335_MBHC_CTL_1, reg3);
+ snd_soc_component_write(component, WCD9335_MBHC_ZDET_ANA_CTL, reg4);
+ snd_soc_component_write(component, WCD9335_MBHC_CTL_1, reg3);
if (is_fsm_disable)
regmap_update_bits(wcd9xxx->regmap,
WCD9335_ANA_MBHC_ELECT, 0x80, 0x80);
if (tasha->zdet_gpio_cb && is_change)
- tasha->zdet_gpio_cb(codec, false);
+ tasha->zdet_gpio_cb(component, false);
}
-static void tasha_mbhc_gnd_det_ctrl(struct snd_soc_codec *codec, bool enable)
+static void tasha_mbhc_gnd_det_ctrl(
+ struct snd_soc_component *component, bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_MECH,
0x02, 0x02);
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_MECH,
0x40, 0x40);
} else {
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_MECH,
0x40, 0x00);
- snd_soc_update_bits(codec, WCD9335_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MBHC_MECH,
0x02, 0x00);
}
}
-static void tasha_mbhc_hph_pull_down_ctrl(struct snd_soc_codec *codec,
+static void tasha_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component,
bool enable)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
if (enable) {
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD9335_HPH_PA_CTL2,
0x40, 0x40);
if (TASHA_IS_2_0(tasha->wcd9xxx))
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2,
- 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2,
+ 0x10, 0x10);
} else {
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2,
- 0x40, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_HPH_PA_CTL2,
+ 0x40, 0x00);
if (TASHA_IS_2_0(tasha->wcd9xxx))
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2,
+ 0x10, 0x00);
}
}
static void tasha_mbhc_moisture_config(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
if (mbhc->moist_vref == V_OFF)
return;
/* Donot enable moisture detection if jack type is NC */
if (!mbhc->hphl_swh) {
- dev_dbg(codec->dev, "%s: disable moisture detection for NC\n",
+ dev_dbg(component->dev, "%s: disable moisture detection for NC\n",
__func__);
return;
}
- snd_soc_update_bits(codec, WCD9335_MBHC_CTL_2,
+ snd_soc_component_update_bits(component, WCD9335_MBHC_CTL_2,
0x0C, mbhc->moist_vref << 2);
- tasha_mbhc_hph_l_pull_up_control(codec, mbhc->moist_iref);
+ tasha_mbhc_hph_l_pull_up_control(component, mbhc->moist_iref);
}
-static void tasha_update_anc_state(struct snd_soc_codec *codec, bool enable,
- int anc_num)
+static void tasha_update_anc_state(struct snd_soc_component *component,
+ bool enable, int anc_num)
{
if (enable)
- snd_soc_update_bits(codec, WCD9335_CDC_RX1_RX_PATH_CFG0 +
- (20 * anc_num), 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX1_RX_PATH_CFG0 + (20 * anc_num),
+ 0x10, 0x10);
else
- snd_soc_update_bits(codec, WCD9335_CDC_RX1_RX_PATH_CFG0 +
- (20 * anc_num), 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX1_RX_PATH_CFG0 + (20 * anc_num),
+ 0x10, 0x00);
}
static bool tasha_is_anc_on(struct wcd_mbhc *mbhc)
@@ -2046,9 +2077,11 @@
u16 ancl, ancr;
ancl =
- (snd_soc_read(mbhc->codec, WCD9335_CDC_RX1_RX_PATH_CFG0)) & 0x10;
+ (snd_soc_component_read32(
+ mbhc->component, WCD9335_CDC_RX1_RX_PATH_CFG0)) & 0x10;
ancr =
- (snd_soc_read(mbhc->codec, WCD9335_CDC_RX2_RX_PATH_CFG0)) & 0x10;
+ (snd_soc_component_read32(
+ mbhc->component, WCD9335_CDC_RX2_RX_PATH_CFG0)) & 0x10;
anc_on = !!(ancl | ancr);
@@ -2084,8 +2117,9 @@
static int tasha_get_anc_slot(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tasha->anc_slot;
return 0;
@@ -2094,8 +2128,9 @@
static int tasha_put_anc_slot(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
tasha->anc_slot = ucontrol->value.integer.value[0];
return 0;
@@ -2104,8 +2139,9 @@
static int tasha_get_anc_func(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = (tasha->anc_func == true ? 1 : 0);
return 0;
@@ -2114,14 +2150,16 @@
static int tasha_put_anc_func(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
mutex_lock(&tasha->codec_mutex);
tasha->anc_func = (!ucontrol->value.integer.value[0] ? false : true);
- dev_dbg(codec->dev, "%s: anc_func %x", __func__, tasha->anc_func);
+ dev_dbg(component->dev, "%s: anc_func %x", __func__, tasha->anc_func);
if (tasha->anc_func == true) {
snd_soc_dapm_enable_pin(dapm, "ANC LINEOUT2 PA");
@@ -2176,11 +2214,13 @@
static int tasha_get_clkmode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
ucontrol->value.enumerated.item[0] = tasha->clk_mode;
- dev_dbg(codec->dev, "%s: clk_mode: %d\n", __func__, tasha->clk_mode);
+ dev_dbg(component->dev, "%s: clk_mode: %d\n", __func__,
+ tasha->clk_mode);
return 0;
}
@@ -2188,11 +2228,13 @@
static int tasha_put_clkmode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
tasha->clk_mode = ucontrol->value.enumerated.item[0];
- dev_dbg(codec->dev, "%s: clk_mode: %d\n", __func__, tasha->clk_mode);
+ dev_dbg(component->dev, "%s: clk_mode: %d\n", __func__,
+ tasha->clk_mode);
return 0;
}
@@ -2201,7 +2243,8 @@
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -2209,10 +2252,11 @@
/* IIR filter band registers are at integer multiples of 16 */
u16 iir_reg = WCD9335_CDC_SIDETONE_IIR0_IIR_CTL + 16 * iir_idx;
- ucontrol->value.integer.value[0] = (snd_soc_read(codec, iir_reg) &
- (1 << band_idx)) != 0;
+ ucontrol->value.integer.value[0] = (
+ snd_soc_component_read32(component, iir_reg) &
+ (1 << band_idx)) != 0;
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
+ dev_dbg(component->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
iir_idx, band_idx,
(uint32_t)ucontrol->value.integer.value[0]);
return 0;
@@ -2224,13 +2268,15 @@
uint32_t zl, zr;
bool hphr;
struct soc_multi_mixer_control *mc;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
mc = (struct soc_multi_mixer_control *)(kcontrol->private_value);
hphr = mc->shift;
wcd_mbhc_get_impedance(&priv->mbhc, &zl, &zr);
- dev_dbg(codec->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr);
+ dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__,
+ zl, zr);
ucontrol->value.integer.value[0] = hphr ? zr : zl;
return 0;
@@ -2246,24 +2292,26 @@
static int tasha_get_hph_type(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
struct wcd_mbhc *mbhc;
if (!priv) {
- dev_dbg(codec->dev, "%s: wcd9335 private data is NULL\n",
+ dev_dbg(component->dev, "%s: wcd9335 private data is NULL\n",
__func__);
return 0;
}
mbhc = &priv->mbhc;
if (!mbhc) {
- dev_dbg(codec->dev, "%s: mbhc not initialized\n", __func__);
+ dev_dbg(component->dev, "%s: mbhc not initialized\n", __func__);
return 0;
}
ucontrol->value.integer.value[0] = (u32) mbhc->hph_type;
- dev_dbg(codec->dev, "%s: hph_type = %u\n", __func__, mbhc->hph_type);
+ dev_dbg(component->dev, "%s: hph_type = %u\n", __func__,
+ mbhc->hph_type);
return 0;
}
@@ -2277,9 +2325,10 @@
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tasha_p->vi_feed_value;
@@ -2290,9 +2339,10 @@
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
struct wcd9xxx *core = tasha_p->wcd9xxx;
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
@@ -2300,7 +2350,7 @@
u32 port_id = mixer->shift;
u32 enable = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: enable: %d, port_id:%d, dai_id: %d\n",
+ dev_dbg(component->dev, "%s: enable: %d, port_id:%d, dai_id: %d\n",
__func__, enable, port_id, dai_id);
tasha_p->vi_feed_value = ucontrol->value.integer.value[0];
@@ -2343,8 +2393,9 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tasha_p->tx_port_value;
return 0;
@@ -2354,10 +2405,11 @@
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
+ snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx *core = dev_get_drvdata(component->dev->parent);
struct snd_soc_dapm_update *update = NULL;
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
@@ -2367,7 +2419,7 @@
u32 vtable;
- dev_dbg(codec->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
+ dev_dbg(component->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
__func__,
widget->name, ucontrol->id.name, tasha_p->tx_port_value,
widget->shift, ucontrol->value.integer.value[0]);
@@ -2375,16 +2427,16 @@
mutex_lock(&tasha_p->codec_mutex);
if (tasha_p->intf_type == WCD9XXX_INTERFACE_TYPE_SLIMBUS) {
- if (dai_id >= ARRAY_SIZE(vport_slim_check_table)) {
- dev_err(codec->dev, "%s: dai_id: %d, out of bounds\n",
- __func__, dai_id);
+ if (dai_id != AIF1_CAP) {
+ dev_err(component->dev, "%s: invalid AIF for I2C mode\n",
+ __func__);
mutex_unlock(&tasha_p->codec_mutex);
return -EINVAL;
}
vtable = vport_slim_check_table[dai_id];
} else {
if (dai_id >= ARRAY_SIZE(vport_i2s_check_table)) {
- dev_err(codec->dev, "%s: dai_id: %d, out of bounds\n",
+ dev_err(component->dev, "%s: dai_id: %d, out of bounds\n",
__func__, dai_id);
return -EINVAL;
}
@@ -2399,7 +2451,7 @@
if (wcd9xxx_tx_vport_validation(vtable, port_id,
tasha_p->dai, NUM_CODEC_DAIS)) {
- dev_dbg(codec->dev, "%s: TX%u is used by other virtual port\n",
+ dev_dbg(component->dev, "%s: TX%u is used by other virtual port\n",
__func__, port_id);
mutex_unlock(&tasha_p->codec_mutex);
return 0;
@@ -2414,11 +2466,11 @@
list_del_init(&core->tx_chs[port_id].list);
} else {
if (enable)
- dev_dbg(codec->dev, "%s: TX%u port is used by\n"
+ dev_dbg(component->dev, "%s: TX%u port is used by\n"
"this virtual port\n",
__func__, port_id);
else
- dev_dbg(codec->dev, "%s: TX%u port is not used by\n"
+ dev_dbg(component->dev, "%s: TX%u port is not used by\n"
"this virtual port\n",
__func__, port_id);
/* avoid update power function */
@@ -2449,8 +2501,9 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
ucontrol->value.enumerated.item[0] =
tasha_p->rx_port_value[widget->shift];
@@ -2466,9 +2519,10 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx *core = dev_get_drvdata(component->dev->parent);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
struct snd_soc_dapm_update *update = NULL;
unsigned int rx_port_value;
@@ -2485,7 +2539,7 @@
if (tasha_p->intf_type != WCD9XXX_INTERFACE_TYPE_SLIMBUS) {
if (rx_port_value > 2) {
- dev_err(codec->dev, "%s: invalid AIF for I2C mode\n",
+ dev_err(component->dev, "%s: invalid AIF for I2C mode\n",
__func__);
goto err;
}
@@ -2499,7 +2553,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
TASHA_RX_PORT_START_NUMBER,
&tasha_p->dai[AIF1_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -2510,7 +2564,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
TASHA_RX_PORT_START_NUMBER,
&tasha_p->dai[AIF2_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -2521,7 +2575,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
TASHA_RX_PORT_START_NUMBER,
&tasha_p->dai[AIF3_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -2532,7 +2586,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
TASHA_RX_PORT_START_NUMBER,
&tasha_p->dai[AIF4_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -2543,7 +2597,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
TASHA_RX_PORT_START_NUMBER,
&tasha_p->dai[AIF_MIX1_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -2749,7 +2803,8 @@
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -2759,56 +2814,56 @@
u16 iir_reg = WCD9335_CDC_SIDETONE_IIR0_IIR_CTL + 16 * iir_idx;
/* Mask first 5 bits, 6-8 are reserved */
- snd_soc_update_bits(codec, iir_reg, (1 << band_idx),
+ snd_soc_component_update_bits(component, iir_reg, (1 << band_idx),
(value << band_idx));
- iir_band_en_status = ((snd_soc_read(codec, iir_reg) &
+ iir_band_en_status = ((snd_soc_component_read32(component, iir_reg) &
(1 << band_idx)) != 0);
pr_debug("%s: IIR #%d band #%d enable %d\n", __func__,
iir_idx, band_idx, iir_band_en_status);
return 0;
}
-static uint32_t get_iir_band_coeff(struct snd_soc_codec *codec,
+static uint32_t get_iir_band_coeff(struct snd_soc_component *component,
int iir_idx, int band_idx,
int coeff_idx)
{
uint32_t value = 0;
/* Address does not automatically update if reading */
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t)) & 0x7F);
- value |= snd_soc_read(codec,
+ value |= snd_soc_component_read32(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 1) & 0x7F);
- value |= (snd_soc_read(codec,
+ value |= (snd_soc_component_read32(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
16 * iir_idx)) << 8);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 2) & 0x7F);
- value |= (snd_soc_read(codec,
+ value |= (snd_soc_component_read32(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
16 * iir_idx)) << 16);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 3) & 0x7F);
/* Mask bits top 2 bits since they are reserved */
- value |= ((snd_soc_read(codec,
+ value |= ((snd_soc_component_read32(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
16 * iir_idx)) & 0x3F) << 24);
@@ -2819,22 +2874,23 @@
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
ucontrol->value.integer.value[0] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 0);
+ get_iir_band_coeff(component, iir_idx, band_idx, 0);
ucontrol->value.integer.value[1] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 1);
+ get_iir_band_coeff(component, iir_idx, band_idx, 1);
ucontrol->value.integer.value[2] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 2);
+ get_iir_band_coeff(component, iir_idx, band_idx, 2);
ucontrol->value.integer.value[3] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 3);
+ get_iir_band_coeff(component, iir_idx, band_idx, 3);
ucontrol->value.integer.value[4] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 4);
+ get_iir_band_coeff(component, iir_idx, band_idx, 4);
pr_debug("%s: IIR #%d band #%d b0 = 0x%x\n"
"%s: IIR #%d band #%d b1 = 0x%x\n"
@@ -2854,30 +2910,30 @@
return 0;
}
-static void set_iir_band_coeff(struct snd_soc_codec *codec,
+static void set_iir_band_coeff(struct snd_soc_component *component,
int iir_idx, int band_idx,
uint32_t value)
{
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
(value & 0xFF));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
(value >> 8) & 0xFF);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
(value >> 16) & 0xFF);
/* Mask top 2 bits, 7-8 are reserved */
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
(value >> 24) & 0x3F);
}
static void tasha_codec_enable_int_port(struct wcd9xxx_codec_dai_data *dai,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct wcd9xxx_ch *ch;
int port_num = 0;
@@ -2885,12 +2941,12 @@
u8 val = 0;
struct tasha_priv *tasha_p;
- if (!dai || !codec) {
+ if (!dai || !component) {
pr_err("%s: Invalid params\n", __func__);
return;
}
- tasha_p = snd_soc_codec_get_drvdata(codec);
+ tasha_p = snd_soc_component_get_drvdata(component);
list_for_each_entry(ch, &dai->wcd9xxx_ch_list, list) {
if (ch->port >= TASHA_RX_PORT_START_NUMBER) {
port_num = ch->port - TASHA_RX_PORT_START_NUMBER;
@@ -2957,48 +3013,49 @@
int event)
{
struct wcd9xxx *core;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
int ret = 0;
struct wcd9xxx_codec_dai_data *dai;
- core = dev_get_drvdata(codec->dev->parent);
+ core = dev_get_drvdata(component->dev->parent);
- dev_dbg(codec->dev, "%s: event called! codec name %s num_dai %d\n"
+ dev_dbg(component->dev, "%s: event called! component name %s num_dai %d\n"
"stream name %s event %d\n",
- __func__, codec->component.name,
- codec->component.num_dai, w->sname, event);
+ __func__, component->name,
+ component->num_dai, w->sname, event);
/* Execute the callback only if interface type is slimbus */
if (tasha_p->intf_type != WCD9XXX_INTERFACE_TYPE_SLIMBUS)
return 0;
dai = &tasha_p->dai[w->shift];
- dev_dbg(codec->dev, "%s: w->name %s w->shift %d event %d\n",
+ dev_dbg(component->dev, "%s: w->name %s w->shift %d event %d\n",
__func__, w->name, w->shift, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
dai->bus_down_in_recovery = false;
- tasha_codec_enable_int_port(dai, codec);
+ tasha_codec_enable_int_port(dai, component);
(void) tasha_codec_enable_slim_chmask(dai, true);
ret = wcd9xxx_cfg_slim_sch_rx(core, &dai->wcd9xxx_ch_list,
dai->rate, dai->bit_width,
&dai->grph);
break;
case SND_SOC_DAPM_PRE_PMD:
- tasha_codec_vote_max_bw(codec, true);
+ tasha_codec_vote_max_bw(component, true);
break;
case SND_SOC_DAPM_POST_PMD:
ret = wcd9xxx_disconnect_port(core, &dai->wcd9xxx_ch_list,
dai->grph);
- dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
+ dev_dbg(component->dev, "%s: Disconnect RX port, ret = %d\n",
__func__, ret);
if (!dai->bus_down_in_recovery)
ret = tasha_codec_enable_slim_chmask(dai, false);
else
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: bus in recovery skip enable slim_chmask",
__func__);
ret = wcd9xxx_close_slim_sch_rx(core, &dai->wcd9xxx_ch_list,
@@ -3013,7 +3070,7 @@
int event)
{
struct wcd9xxx *core = NULL;
- struct snd_soc_codec *codec = NULL;
+ struct snd_soc_component *component = NULL;
struct tasha_priv *tasha_p = NULL;
int ret = 0;
struct wcd9xxx_codec_dai_data *dai = NULL;
@@ -3022,20 +3079,21 @@
pr_err("%s invalid params\n", __func__);
return -EINVAL;
}
- codec = snd_soc_dapm_to_codec(w->dapm);
- tasha_p = snd_soc_codec_get_drvdata(codec);
+ component = snd_soc_dapm_to_component(w->dapm);
+ tasha_p = snd_soc_component_get_drvdata(component);
core = tasha_p->wcd9xxx;
- dev_dbg(codec->dev, "%s: num_dai %d stream name %s\n",
- __func__, codec->component.num_dai, w->sname);
+ dev_dbg(component->dev, "%s: num_dai %d stream name %s\n",
+ __func__, component->num_dai, w->sname);
/* Execute the callback only if interface type is slimbus */
if (tasha_p->intf_type != WCD9XXX_INTERFACE_TYPE_SLIMBUS) {
- dev_err(codec->dev, "%s Interface is not correct", __func__);
+ dev_err(component->dev, "%s Interface is not correct",
+ __func__);
return 0;
}
- dev_dbg(codec->dev, "%s(): w->name %s event %d w->shift %d\n",
+ dev_dbg(component->dev, "%s(): w->name %s event %d w->shift %d\n",
__func__, w->name, event, w->shift);
if (w->shift != AIF4_VIFEED) {
pr_err("%s Error in enabling the tx path\n", __func__);
@@ -3046,59 +3104,60 @@
switch (event) {
case SND_SOC_DAPM_POST_PMU:
if (test_bit(VI_SENSE_1, &tasha_p->status_mask)) {
- dev_dbg(codec->dev, "%s: spkr1 enabled\n", __func__);
+ dev_dbg(component->dev, "%s: spkr1 enabled\n",
+ __func__);
/* Enable V&I sensing */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX9_SPKR_PROT_PATH_CTL, 0x0F, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX10_SPKR_PROT_PATH_CTL, 0x0F,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX9_SPKR_PROT_PATH_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX10_SPKR_PROT_PATH_CTL, 0x10,
0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
0x00);
}
if (test_bit(VI_SENSE_2, &tasha_p->status_mask)) {
pr_debug("%s: spkr2 enabled\n", __func__);
/* Enable V&I sensing */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX11_SPKR_PROT_PATH_CTL, 0x0F,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX12_SPKR_PROT_PATH_CTL, 0x0F,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX11_SPKR_PROT_PATH_CTL, 0x10,
0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX12_SPKR_PROT_PATH_CTL, 0x10,
0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
0x00);
}
dai->bus_down_in_recovery = false;
- tasha_codec_enable_int_port(dai, codec);
+ tasha_codec_enable_int_port(dai, component);
(void) tasha_codec_enable_slim_chmask(dai, true);
ret = wcd9xxx_cfg_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
dai->rate, dai->bit_width,
@@ -3108,7 +3167,7 @@
ret = wcd9xxx_close_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
dai->grph);
if (ret)
- dev_err(codec->dev, "%s error in close_slim_sch_tx %d\n",
+ dev_err(component->dev, "%s error in close_slim_sch_tx %d\n",
__func__, ret);
if (!dai->bus_down_in_recovery)
ret = tasha_codec_enable_slim_chmask(dai, false);
@@ -3116,36 +3175,38 @@
ret = wcd9xxx_disconnect_port(core,
&dai->wcd9xxx_ch_list,
dai->grph);
- dev_dbg(codec->dev, "%s: Disconnect TX port, ret = %d\n",
+ dev_dbg(component->dev, "%s: Disconnect TX port, ret = %d\n",
__func__, ret);
}
if (test_bit(VI_SENSE_1, &tasha_p->status_mask)) {
/* Disable V&I sensing */
- dev_dbg(codec->dev, "%s: spkr1 disabled\n", __func__);
- snd_soc_update_bits(codec,
+ dev_dbg(component->dev, "%s: spkr1 disabled\n",
+ __func__);
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX9_SPKR_PROT_PATH_CTL, 0x10, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX10_SPKR_PROT_PATH_CTL, 0x10,
0x00);
}
if (test_bit(VI_SENSE_2, &tasha_p->status_mask)) {
/* Disable V&I sensing */
- dev_dbg(codec->dev, "%s: spkr2 disabled\n", __func__);
- snd_soc_update_bits(codec,
+ dev_dbg(component->dev, "%s: spkr2 disabled\n",
+ __func__);
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX11_SPKR_PROT_PATH_CTL, 0x10,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_TX12_SPKR_PROT_PATH_CTL, 0x10,
0x00);
}
@@ -3158,29 +3219,29 @@
/*
* __tasha_codec_enable_slimtx: Enable the slimbus slave port
* for TX path
- * @codec: Handle to the codec for which the slave port is to be
+ * @component: Handle to the codec for which the slave port is to be
* enabled.
* @dai_data: The dai specific data for dai which is enabled.
*/
-static int __tasha_codec_enable_slimtx(struct snd_soc_codec *codec,
+static int __tasha_codec_enable_slimtx(struct snd_soc_component *component,
int event, struct wcd9xxx_codec_dai_data *dai)
{
struct wcd9xxx *core;
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
int ret = 0;
/* Execute the callback only if interface type is slimbus */
if (tasha_p->intf_type != WCD9XXX_INTERFACE_TYPE_SLIMBUS)
return 0;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: event = %d\n", __func__, event);
- core = dev_get_drvdata(codec->dev->parent);
+ core = dev_get_drvdata(component->dev->parent);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
dai->bus_down_in_recovery = false;
- tasha_codec_enable_int_port(dai, codec);
+ tasha_codec_enable_int_port(dai, component);
(void) tasha_codec_enable_slim_chmask(dai, true);
ret = wcd9xxx_cfg_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
dai->rate, dai->bit_width,
@@ -3209,22 +3270,24 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
struct wcd9xxx_codec_dai_data *dai;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: w->name %s, w->shift = %d, num_dai %d stream name %s\n",
__func__, w->name, w->shift,
- codec->component.num_dai, w->sname);
+ component->num_dai, w->sname);
dai = &tasha_p->dai[w->shift];
- return __tasha_codec_enable_slimtx(codec, event, dai);
+ return __tasha_codec_enable_slimtx(component, event, dai);
}
-static void tasha_codec_cpe_pp_set_cfg(struct snd_soc_codec *codec, int event)
+static void tasha_codec_cpe_pp_set_cfg(struct snd_soc_component *component,
+ int event)
{
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
struct wcd9xxx_codec_dai_data *dai;
u8 bit_width, rate, buf_period;
@@ -3246,8 +3309,8 @@
bit_width = 0x0;
break;
}
- snd_soc_update_bits(codec, WCD9335_CPE_SS_TX_PP_CFG, 0x0F,
- bit_width);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_SS_TX_PP_CFG, 0x0F, bit_width);
switch (dai->rate) {
case 384000:
@@ -3264,19 +3327,23 @@
rate = 0x00;
break;
}
- snd_soc_update_bits(codec, WCD9335_CPE_SS_TX_PP_CFG, 0x70,
- rate);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_SS_TX_PP_CFG, 0x70, rate);
buf_period = (dai->rate * (dai->bit_width/8)) / (16*1000);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_TX_PP_BUF_INT_PERIOD,
- 0xFF, buf_period);
- dev_dbg(codec->dev, "%s: PP buffer period= 0x%x\n",
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_SS_TX_PP_BUF_INT_PERIOD,
+ 0xFF, buf_period);
+ dev_dbg(component->dev, "%s: PP buffer period= 0x%x\n",
__func__, buf_period);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_write(codec, WCD9335_CPE_SS_TX_PP_CFG, 0x3C);
- snd_soc_write(codec, WCD9335_CPE_SS_TX_PP_BUF_INT_PERIOD, 0x60);
+ snd_soc_component_write(component, WCD9335_CPE_SS_TX_PP_CFG,
+ 0x3C);
+ snd_soc_component_write(component,
+ WCD9335_CPE_SS_TX_PP_BUF_INT_PERIOD,
+ 0x60);
break;
default:
@@ -3287,20 +3354,20 @@
/*
* tasha_codec_get_mad_port_id: Callback function that will be invoked
* to get the port ID for MAD.
- * @codec: Handle to the codec
+ * @component: Handle to the codec
* @port_id: cpe port_id needs to enable
*/
-static int tasha_codec_get_mad_port_id(struct snd_soc_codec *codec,
+static int tasha_codec_get_mad_port_id(struct snd_soc_component *component,
u16 *port_id)
{
struct tasha_priv *tasha_p;
struct wcd9xxx_codec_dai_data *dai;
struct wcd9xxx_ch *ch;
- if (!port_id || !codec)
+ if (!port_id || !component)
return -EINVAL;
- tasha_p = snd_soc_codec_get_drvdata(codec);
+ tasha_p = snd_soc_component_get_drvdata(component);
if (!tasha_p)
return -EINVAL;
@@ -3311,12 +3378,12 @@
else if (ch->port == TASHA_TX13)
*port_id = WCD_CPE_AFE_OUT_PORT_4;
else {
- dev_err(codec->dev, "%s: invalid mad_port = %d\n",
+ dev_err(component->dev, "%s: invalid mad_port = %d\n",
__func__, ch->port);
return -EINVAL;
}
}
- dev_dbg(codec->dev, "%s: port_id = %d\n", __func__, *port_id);
+ dev_dbg(component->dev, "%s: port_id = %d\n", __func__, *port_id);
return 0;
}
@@ -3324,13 +3391,13 @@
/*
* tasha_codec_enable_slimtx_mad: Callback function that will be invoked
* to setup the slave port for MAD.
- * @codec: Handle to the codec
+ * @component: Handle to the codec
* @event: Indicates whether to enable or disable the slave port
*/
-static int tasha_codec_enable_slimtx_mad(struct snd_soc_codec *codec,
+static int tasha_codec_enable_slimtx_mad(struct snd_soc_component *component,
u8 event)
{
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
struct wcd9xxx_codec_dai_data *dai;
struct wcd9xxx_ch *ch;
int dapm_event = SND_SOC_DAPM_POST_PMU;
@@ -3342,43 +3409,45 @@
if (event == 0)
dapm_event = SND_SOC_DAPM_POST_PMD;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: mad_channel, event = 0x%x\n",
__func__, event);
list_for_each_entry(ch, &dai->wcd9xxx_ch_list, list) {
- dev_dbg(codec->dev, "%s: mad_port = %d, event = 0x%x\n",
+ dev_dbg(component->dev, "%s: mad_port = %d, event = 0x%x\n",
__func__, ch->port, event);
if (ch->port == TASHA_TX13) {
- tasha_codec_cpe_pp_set_cfg(codec, dapm_event);
+ tasha_codec_cpe_pp_set_cfg(component, dapm_event);
port = TASHA_TX13;
break;
}
}
- ret = __tasha_codec_enable_slimtx(codec, dapm_event, dai);
+ ret = __tasha_codec_enable_slimtx(component, dapm_event, dai);
if (port == TASHA_TX13) {
switch (dapm_event) {
case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CODEC_RPM_PWR_CPE_DRAM1_SHUTDOWN,
0x20, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_SB_TX13_INP_CFG,
0x03, 0x02);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_CFG,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_SS_CFG,
+ 0x80, 0x80);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CODEC_RPM_PWR_CPE_DRAM1_SHUTDOWN,
0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_SB_TX13_INP_CFG,
0x03, 0x00);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_CFG,
- 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_SS_CFG,
+ 0x80, 0x00);
break;
}
}
@@ -3390,7 +3459,8 @@
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -3400,19 +3470,19 @@
* Mask top bit it is reserved
* Updates addr automatically for each B2 write
*/
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD9335_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
(band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F);
- set_iir_band_coeff(codec, iir_idx, band_idx,
+ set_iir_band_coeff(component, iir_idx, band_idx,
ucontrol->value.integer.value[0]);
- set_iir_band_coeff(codec, iir_idx, band_idx,
+ set_iir_band_coeff(component, iir_idx, band_idx,
ucontrol->value.integer.value[1]);
- set_iir_band_coeff(codec, iir_idx, band_idx,
+ set_iir_band_coeff(component, iir_idx, band_idx,
ucontrol->value.integer.value[2]);
- set_iir_band_coeff(codec, iir_idx, band_idx,
+ set_iir_band_coeff(component, iir_idx, band_idx,
ucontrol->value.integer.value[3]);
- set_iir_band_coeff(codec, iir_idx, band_idx,
+ set_iir_band_coeff(component, iir_idx, band_idx,
ucontrol->value.integer.value[4]);
pr_debug("%s: IIR #%d band #%d b0 = 0x%x\n"
@@ -3421,15 +3491,15 @@
"%s: IIR #%d band #%d a1 = 0x%x\n"
"%s: IIR #%d band #%d a2 = 0x%x\n",
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 0),
+ get_iir_band_coeff(component, iir_idx, band_idx, 0),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 1),
+ get_iir_band_coeff(component, iir_idx, band_idx, 1),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 2),
+ get_iir_band_coeff(component, iir_idx, band_idx, 2),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 3),
+ get_iir_band_coeff(component, iir_idx, band_idx, 3),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 4));
+ get_iir_band_coeff(component, iir_idx, band_idx, 4));
return 0;
}
@@ -3437,10 +3507,11 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tasha->comp_enabled[comp];
return 0;
@@ -3449,8 +3520,9 @@
static int tasha_set_compander(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
int value = ucontrol->value.integer.value[0];
@@ -3463,11 +3535,11 @@
switch (comp) {
case COMPANDER_1:
/* Set Gain Source Select based on compander enable/disable */
- snd_soc_update_bits(codec, WCD9335_HPH_L_EN, 0x20,
+ snd_soc_component_update_bits(component, WCD9335_HPH_L_EN, 0x20,
(value ? 0x00:0x20));
break;
case COMPANDER_2:
- snd_soc_update_bits(codec, WCD9335_HPH_R_EN, 0x20,
+ snd_soc_component_update_bits(component, WCD9335_HPH_R_EN, 0x20,
(value ? 0x00:0x20));
break;
case COMPANDER_3:
@@ -3475,12 +3547,12 @@
case COMPANDER_4:
break;
case COMPANDER_5:
- snd_soc_update_bits(codec, WCD9335_SE_LO_LO3_GAIN, 0x20,
- (value ? 0x00:0x20));
+ snd_soc_component_update_bits(component, WCD9335_SE_LO_LO3_GAIN,
+ 0x20, (value ? 0x00:0x20));
break;
case COMPANDER_6:
- snd_soc_update_bits(codec, WCD9335_SE_LO_LO4_GAIN, 0x20,
- (value ? 0x00:0x20));
+ snd_soc_component_update_bits(component, WCD9335_SE_LO_LO4_GAIN,
+ 0x20, (value ? 0x00:0x20));
break;
case COMPANDER_7:
break;
@@ -3492,85 +3564,90 @@
* it does not cause any audio failure, so do not
* return error in this case, but just print a log
*/
- dev_warn(codec->dev, "%s: unknown compander: %d\n",
+ dev_warn(component->dev, "%s: unknown compander: %d\n",
__func__, comp);
};
return 0;
}
-static void tasha_codec_init_flyback(struct snd_soc_codec *codec)
+static void tasha_codec_init_flyback(struct snd_soc_component *component)
{
- snd_soc_update_bits(codec, WCD9335_HPH_L_EN, 0xC0, 0x00);
- snd_soc_update_bits(codec, WCD9335_HPH_R_EN, 0xC0, 0x00);
- snd_soc_update_bits(codec, WCD9335_RX_BIAS_FLYB_BUFF, 0x0F, 0x00);
- snd_soc_update_bits(codec, WCD9335_RX_BIAS_FLYB_BUFF, 0xF0, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_HPH_L_EN, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_HPH_R_EN, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_RX_BIAS_FLYB_BUFF,
+ 0x0F, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_RX_BIAS_FLYB_BUFF,
+ 0xF0, 0x00);
}
static int tasha_codec_enable_rx_bias(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
tasha->rx_bias_count++;
if (tasha->rx_bias_count == 1) {
if (TASHA_IS_2_0(tasha->wcd9xxx))
- tasha_codec_init_flyback(codec);
- snd_soc_update_bits(codec, WCD9335_ANA_RX_SUPPLIES,
- 0x01, 0x01);
+ tasha_codec_init_flyback(component);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_RX_SUPPLIES,
+ 0x01, 0x01);
}
break;
case SND_SOC_DAPM_POST_PMD:
tasha->rx_bias_count--;
if (!tasha->rx_bias_count)
- snd_soc_update_bits(codec, WCD9335_ANA_RX_SUPPLIES,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_RX_SUPPLIES,
+ 0x01, 0x00);
break;
};
- dev_dbg(codec->dev, "%s: Current RX BIAS user count: %d\n", __func__,
- tasha->rx_bias_count);
+ dev_dbg(component->dev, "%s: Current RX BIAS user count: %d\n",
+ __func__, tasha->rx_bias_count);
return 0;
}
-static void tasha_realign_anc_coeff(struct snd_soc_codec *codec,
+static void tasha_realign_anc_coeff(struct snd_soc_component *component,
u16 reg1, u16 reg2)
{
u8 val1, val2, tmpval1, tmpval2;
- snd_soc_write(codec, reg1, 0x00);
- tmpval1 = snd_soc_read(codec, reg2);
- tmpval2 = snd_soc_read(codec, reg2);
- snd_soc_write(codec, reg1, 0x00);
- snd_soc_write(codec, reg2, 0xFF);
- snd_soc_write(codec, reg1, 0x01);
- snd_soc_write(codec, reg2, 0xFF);
+ snd_soc_component_write(component, reg1, 0x00);
+ tmpval1 = snd_soc_component_read32(component, reg2);
+ tmpval2 = snd_soc_component_read32(component, reg2);
+ snd_soc_component_write(component, reg1, 0x00);
+ snd_soc_component_write(component, reg2, 0xFF);
+ snd_soc_component_write(component, reg1, 0x01);
+ snd_soc_component_write(component, reg2, 0xFF);
- snd_soc_write(codec, reg1, 0x00);
- val1 = snd_soc_read(codec, reg2);
- val2 = snd_soc_read(codec, reg2);
+ snd_soc_component_write(component, reg1, 0x00);
+ val1 = snd_soc_component_read32(component, reg2);
+ val2 = snd_soc_component_read32(component, reg2);
if (val1 == 0x0F && val2 == 0xFF) {
- dev_dbg(codec->dev, "%s: ANC0 co-eff index re-aligned\n",
+ dev_dbg(component->dev, "%s: ANC0 co-eff index re-aligned\n",
__func__);
- snd_soc_read(codec, reg2);
- snd_soc_write(codec, reg1, 0x00);
- snd_soc_write(codec, reg2, tmpval2);
- snd_soc_write(codec, reg1, 0x01);
- snd_soc_write(codec, reg2, tmpval1);
+ snd_soc_component_read32(component, reg2);
+ snd_soc_component_write(component, reg1, 0x00);
+ snd_soc_component_write(component, reg2, tmpval2);
+ snd_soc_component_write(component, reg1, 0x01);
+ snd_soc_component_write(component, reg2, tmpval1);
} else if (val1 == 0xFF && val2 == 0x0F) {
- dev_dbg(codec->dev, "%s: ANC1 co-eff index already aligned\n",
+ dev_dbg(component->dev, "%s: ANC1 co-eff index already aligned\n",
__func__);
- snd_soc_write(codec, reg1, 0x00);
- snd_soc_write(codec, reg2, tmpval1);
- snd_soc_write(codec, reg1, 0x01);
- snd_soc_write(codec, reg2, tmpval2);
+ snd_soc_component_write(component, reg1, 0x00);
+ snd_soc_component_write(component, reg2, tmpval1);
+ snd_soc_component_write(component, reg1, 0x01);
+ snd_soc_component_write(component, reg2, tmpval2);
} else {
- dev_err(codec->dev, "%s: ANC0 co-eff index not aligned\n",
+ dev_err(component->dev, "%s: ANC0 co-eff index not aligned\n",
__func__);
}
}
@@ -3578,8 +3655,9 @@
static int tasha_codec_enable_anc(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
const char *filename;
const struct firmware *fw;
int i;
@@ -3605,27 +3683,27 @@
if (hwdep_cal) {
data = hwdep_cal->data;
cal_size = hwdep_cal->size;
- dev_dbg(codec->dev, "%s: using hwdep calibration\n",
+ dev_dbg(component->dev, "%s: using hwdep calibration\n",
__func__);
} else {
filename = "wcd9335/wcd9335_anc.bin";
- ret = request_firmware(&fw, filename, codec->dev);
+ ret = request_firmware(&fw, filename, component->dev);
if (ret != 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to acquire ANC data: %d\n", ret);
return -ENODEV;
}
if (!fw) {
- dev_err(codec->dev, "failed to get anc fw");
+ dev_err(component->dev, "failed to get anc fw");
return -ENODEV;
}
data = fw->data;
cal_size = fw->size;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: using request_firmware calibration\n", __func__);
}
if (cal_size < sizeof(struct wcd9xxx_anc_header)) {
- dev_err(codec->dev, "Not enough data\n");
+ dev_err(component->dev, "Not enough data\n");
ret = -ENOMEM;
goto err;
}
@@ -3638,13 +3716,13 @@
num_anc_slots = anc_head->num_anc_slots;
if (tasha->anc_slot >= num_anc_slots) {
- dev_err(codec->dev, "Invalid ANC slot selected\n");
+ dev_err(component->dev, "Invalid ANC slot selected\n");
ret = -EINVAL;
goto err;
}
for (i = 0; i < num_anc_slots; i++) {
if (anc_size_remaining < TASHA_PACKED_REG_SIZE) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Invalid register format\n");
ret = -EINVAL;
goto err;
@@ -3655,7 +3733,7 @@
if (anc_writes_size * TASHA_PACKED_REG_SIZE
> anc_size_remaining) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Invalid register format\n");
ret = -EINVAL;
goto err;
@@ -3669,7 +3747,7 @@
anc_ptr += anc_writes_size;
}
if (i == num_anc_slots) {
- dev_err(codec->dev, "Selected ANC slot not present\n");
+ dev_err(component->dev, "Selected ANC slot not present\n");
ret = -EINVAL;
goto err;
}
@@ -3679,39 +3757,39 @@
if (!strcmp(w->name, "RX INT0 DAC") ||
!strcmp(w->name, "ANC SPK1 PA"))
- tasha_realign_anc_coeff(codec,
+ tasha_realign_anc_coeff(component,
WCD9335_CDC_ANC0_IIR_COEFF_1_CTL,
WCD9335_CDC_ANC0_IIR_COEFF_2_CTL);
if (!strcmp(w->name, "RX INT1 DAC") ||
!strcmp(w->name, "RX INT3 DAC")) {
- tasha_realign_anc_coeff(codec,
+ tasha_realign_anc_coeff(component,
WCD9335_CDC_ANC0_IIR_COEFF_1_CTL,
WCD9335_CDC_ANC0_IIR_COEFF_2_CTL);
anc_writes_size = anc_cal_size / 2;
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC0_CLK_RESET_CTL, 0x39, 0x39);
} else if (!strcmp(w->name, "RX INT2 DAC") ||
!strcmp(w->name, "RX INT4 DAC")) {
- tasha_realign_anc_coeff(codec,
+ tasha_realign_anc_coeff(component,
WCD9335_CDC_ANC1_IIR_COEFF_1_CTL,
WCD9335_CDC_ANC1_IIR_COEFF_2_CTL);
i = anc_cal_size / 2;
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC1_CLK_RESET_CTL, 0x39, 0x39);
}
for (; i < anc_writes_size; i++) {
TASHA_CODEC_UNPACK_ENTRY(anc_ptr[i], reg, mask, val);
- snd_soc_write(codec, reg, (val & mask));
+ snd_soc_component_write(component, reg, (val & mask));
}
if (!strcmp(w->name, "RX INT1 DAC") ||
!strcmp(w->name, "RX INT3 DAC")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC0_CLK_RESET_CTL, 0x08, 0x08);
} else if (!strcmp(w->name, "RX INT2 DAC") ||
!strcmp(w->name, "RX INT4 DAC")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC1_CLK_RESET_CTL, 0x08, 0x08);
}
@@ -3720,39 +3798,41 @@
break;
case SND_SOC_DAPM_POST_PMU:
/* Remove ANC Rx from reset */
- snd_soc_update_bits(codec, WCD9335_CDC_ANC0_CLK_RESET_CTL,
- 0x08, 0x00);
- snd_soc_update_bits(codec, WCD9335_CDC_ANC1_CLK_RESET_CTL,
- 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_ANC0_CLK_RESET_CTL,
+ 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_ANC1_CLK_RESET_CTL,
+ 0x08, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
if (!strcmp(w->name, "ANC HPHL PA") ||
!strcmp(w->name, "ANC EAR PA") ||
!strcmp(w->name, "ANC SPK1 PA") ||
!strcmp(w->name, "ANC LINEOUT1 PA")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC0_MODE_1_CTL, 0x30, 0x00);
msleep(50);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC0_MODE_1_CTL, 0x01, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC0_CLK_RESET_CTL, 0x38, 0x38);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC0_CLK_RESET_CTL, 0x07, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC0_CLK_RESET_CTL, 0x38, 0x00);
} else if (!strcmp(w->name, "ANC HPHR PA") ||
!strcmp(w->name, "ANC LINEOUT2 PA")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC1_MODE_1_CTL, 0x30, 0x00);
msleep(50);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC1_MODE_1_CTL, 0x01, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC1_CLK_RESET_CTL, 0x38, 0x38);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC1_CLK_RESET_CTL, 0x07, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_ANC1_CLK_RESET_CTL, 0x38, 0x00);
}
break;
@@ -3768,17 +3848,23 @@
static void tasha_codec_clear_anc_tx_hold(struct tasha_priv *tasha)
{
if (test_and_clear_bit(ANC_MIC_AMIC1, &tasha->status_mask))
- tasha_codec_set_tx_hold(tasha->codec, WCD9335_ANA_AMIC1, false);
+ tasha_codec_set_tx_hold(tasha->component,
+ WCD9335_ANA_AMIC1, false);
if (test_and_clear_bit(ANC_MIC_AMIC2, &tasha->status_mask))
- tasha_codec_set_tx_hold(tasha->codec, WCD9335_ANA_AMIC2, false);
+ tasha_codec_set_tx_hold(tasha->component,
+ WCD9335_ANA_AMIC2, false);
if (test_and_clear_bit(ANC_MIC_AMIC3, &tasha->status_mask))
- tasha_codec_set_tx_hold(tasha->codec, WCD9335_ANA_AMIC3, false);
+ tasha_codec_set_tx_hold(tasha->component,
+ WCD9335_ANA_AMIC3, false);
if (test_and_clear_bit(ANC_MIC_AMIC4, &tasha->status_mask))
- tasha_codec_set_tx_hold(tasha->codec, WCD9335_ANA_AMIC4, false);
+ tasha_codec_set_tx_hold(tasha->component,
+ WCD9335_ANA_AMIC4, false);
if (test_and_clear_bit(ANC_MIC_AMIC5, &tasha->status_mask))
- tasha_codec_set_tx_hold(tasha->codec, WCD9335_ANA_AMIC5, false);
+ tasha_codec_set_tx_hold(tasha->component,
+ WCD9335_ANA_AMIC5, false);
if (test_and_clear_bit(ANC_MIC_AMIC6, &tasha->status_mask))
- tasha_codec_set_tx_hold(tasha->codec, WCD9335_ANA_AMIC6, false);
+ tasha_codec_set_tx_hold(tasha->component,
+ WCD9335_ANA_AMIC6, false);
}
static void tasha_codec_hph_post_pa_config(struct tasha_priv *tasha,
@@ -3801,8 +3887,9 @@
}
if (tasha->anc_func) {
/* Clear Tx FE HOLD if both PAs are enabled */
- if ((snd_soc_read(tasha->codec, WCD9335_ANA_HPH) &
- 0xC0) == 0xC0) {
+ if ((snd_soc_component_read32(
+ tasha->component, WCD9335_ANA_HPH) &
+ 0xC0) == 0xC0) {
tasha_codec_clear_anc_tx_hold(tasha);
}
}
@@ -3813,46 +3900,53 @@
}
if (scale_val)
- snd_soc_update_bits(tasha->codec, WCD9335_HPH_PA_CTL1, 0x0E,
- scale_val << 1);
+ snd_soc_component_update_bits(tasha->component,
+ WCD9335_HPH_PA_CTL1, 0x0E,
+ scale_val << 1);
if (SND_SOC_DAPM_EVENT_ON(event)) {
if (tasha->comp_enabled[COMPANDER_1] ||
tasha->comp_enabled[COMPANDER_2]) {
- snd_soc_update_bits(tasha->codec, WCD9335_HPH_L_EN,
- 0x20, 0x00);
- snd_soc_update_bits(tasha->codec, WCD9335_HPH_R_EN,
- 0x20, 0x00);
- snd_soc_update_bits(tasha->codec, WCD9335_HPH_AUTO_CHOP,
- 0x20, 0x20);
+ snd_soc_component_update_bits(tasha->component,
+ WCD9335_HPH_L_EN,
+ 0x20, 0x00);
+ snd_soc_component_update_bits(tasha->component,
+ WCD9335_HPH_R_EN,
+ 0x20, 0x00);
+ snd_soc_component_update_bits(tasha->component,
+ WCD9335_HPH_AUTO_CHOP,
+ 0x20, 0x20);
}
- snd_soc_update_bits(tasha->codec, WCD9335_HPH_L_EN, 0x1F,
- tasha->hph_l_gain);
- snd_soc_update_bits(tasha->codec, WCD9335_HPH_R_EN, 0x1F,
- tasha->hph_r_gain);
+ snd_soc_component_update_bits(tasha->component,
+ WCD9335_HPH_L_EN, 0x1F,
+ tasha->hph_l_gain);
+ snd_soc_component_update_bits(tasha->component,
+ WCD9335_HPH_R_EN, 0x1F,
+ tasha->hph_r_gain);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(tasha->codec, WCD9335_HPH_AUTO_CHOP, 0x20,
- 0x00);
+ snd_soc_component_update_bits(tasha->component,
+ WCD9335_HPH_AUTO_CHOP, 0x20,
+ 0x00);
}
}
-static void tasha_codec_override(struct snd_soc_codec *codec,
+static void tasha_codec_override(struct snd_soc_component *component,
int mode,
int event)
{
if (mode == CLS_AB) {
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- if (!(snd_soc_read(codec,
+ if (!(snd_soc_component_read32(component,
WCD9335_CDC_RX2_RX_PATH_CTL) & 0x10) &&
- (!(snd_soc_read(codec,
+ (!(snd_soc_component_read32(component,
WCD9335_CDC_RX1_RX_PATH_CTL) & 0x10)))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_ANA_RX_SUPPLIES, 0x02, 0x02);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_ANA_RX_SUPPLIES, 0x02, 0x00);
break;
}
@@ -3863,27 +3957,30 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int hph_mode = tasha->hph_mode;
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if ((!(strcmp(w->name, "ANC HPHR PA"))) &&
(test_bit(HPH_PA_DELAY, &tasha->status_mask))) {
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0xC0, 0xC0);
+ snd_soc_component_update_bits(
+ component, WCD9335_ANA_HPH, 0xC0, 0xC0);
}
set_bit(HPH_PA_DELAY, &tasha->status_mask);
if (!(strcmp(w->name, "HPHR PA")))
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x40, 0x40);
+ snd_soc_component_update_bits(
+ component, WCD9335_ANA_HPH, 0x40, 0x40);
break;
case SND_SOC_DAPM_POST_PMU:
if (!(strcmp(w->name, "ANC HPHR PA"))) {
- if ((snd_soc_read(codec, WCD9335_ANA_HPH) & 0xC0)
- != 0xC0)
+ if ((snd_soc_component_read32(
+ component, WCD9335_ANA_HPH) & 0xC0) != 0xC0)
/*
* If PA_EN is not set (potentially in ANC case)
* then do nothing for POST_PMU and let left
@@ -3900,30 +3997,32 @@
clear_bit(HPH_PA_DELAY, &tasha->status_mask);
}
tasha_codec_hph_post_pa_config(tasha, hph_mode, event);
- snd_soc_update_bits(codec, WCD9335_CDC_RX2_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX2_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, WCD9335_CDC_RX2_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(
+ component, WCD9335_CDC_RX2_RX_PATH_MIX_CTL)) & 0x10)
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX2_RX_PATH_MIX_CTL,
0x10, 0x00);
if (!(strcmp(w->name, "ANC HPHR PA"))) {
/* Do everything needed for left channel */
- snd_soc_update_bits(codec, WCD9335_CDC_RX1_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX1_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec,
+ if ((snd_soc_component_read32(component,
WCD9335_CDC_RX1_RX_PATH_MIX_CTL)) &
0x10)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX1_RX_PATH_MIX_CTL,
0x10, 0x00);
/* Remove ANC Rx from reset */
ret = tasha_codec_enable_anc(w, kcontrol, event);
}
- tasha_codec_override(codec, hph_mode, event);
+ tasha_codec_override(component, hph_mode, event);
break;
case SND_SOC_DAPM_PRE_PMD:
@@ -3933,21 +4032,22 @@
tasha_codec_hph_post_pa_config(tasha, hph_mode, event);
if (!(strcmp(w->name, "ANC HPHR PA")) ||
!(strcmp(w->name, "HPHR PA")))
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x40, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_HPH, 0x40, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
/* 5ms sleep is required after PA is disabled as per
* HW requirement
*/
usleep_range(5000, 5500);
- tasha_codec_override(codec, hph_mode, event);
+ tasha_codec_override(component, hph_mode, event);
blocking_notifier_call_chain(&tasha->notifier,
WCD_EVENT_POST_HPHR_PA_OFF,
&tasha->mbhc);
if (!(strcmp(w->name, "ANC HPHR PA"))) {
ret = tasha_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX2_RX_PATH_CFG0, 0x10, 0x00);
}
break;
@@ -3960,27 +4060,30 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int hph_mode = tasha->hph_mode;
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if ((!(strcmp(w->name, "ANC HPHL PA"))) &&
(test_bit(HPH_PA_DELAY, &tasha->status_mask))) {
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0xC0, 0xC0);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_HPH, 0xC0, 0xC0);
}
if (!(strcmp(w->name, "HPHL PA")))
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_HPH, 0x80, 0x80);
set_bit(HPH_PA_DELAY, &tasha->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if (!(strcmp(w->name, "ANC HPHL PA"))) {
- if ((snd_soc_read(codec, WCD9335_ANA_HPH) & 0xC0)
- != 0xC0)
+ if ((snd_soc_component_read32(
+ component, WCD9335_ANA_HPH) & 0xC0) != 0xC0)
/*
* If PA_EN is not set (potentially in ANC case)
* then do nothing for POST_PMU and let right
@@ -3998,31 +4101,33 @@
}
tasha_codec_hph_post_pa_config(tasha, hph_mode, event);
- snd_soc_update_bits(codec, WCD9335_CDC_RX1_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX1_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, WCD9335_CDC_RX1_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(
+ component, WCD9335_CDC_RX1_RX_PATH_MIX_CTL)) & 0x10)
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX1_RX_PATH_MIX_CTL,
0x10, 0x00);
if (!(strcmp(w->name, "ANC HPHL PA"))) {
/* Do everything needed for right channel */
- snd_soc_update_bits(codec, WCD9335_CDC_RX2_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX2_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec,
+ if ((snd_soc_component_read32(component,
WCD9335_CDC_RX2_RX_PATH_MIX_CTL)) &
0x10)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX2_RX_PATH_MIX_CTL,
0x10, 0x00);
/* Remove ANC Rx from reset */
ret = tasha_codec_enable_anc(w, kcontrol, event);
}
- tasha_codec_override(codec, hph_mode, event);
+ tasha_codec_override(component, hph_mode, event);
break;
case SND_SOC_DAPM_PRE_PMD:
blocking_notifier_call_chain(&tasha->notifier,
@@ -4031,21 +4136,22 @@
tasha_codec_hph_post_pa_config(tasha, hph_mode, event);
if (!(strcmp(w->name, "ANC HPHL PA")) ||
!(strcmp(w->name, "HPHL PA")))
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_HPH, 0x80, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
/* 5ms sleep is required after PA is disabled as per
* HW requirement
*/
usleep_range(5000, 5500);
- tasha_codec_override(codec, hph_mode, event);
+ tasha_codec_override(component, hph_mode, event);
blocking_notifier_call_chain(&tasha->notifier,
WCD_EVENT_POST_HPHL_PA_OFF,
&tasha->mbhc);
if (!(strcmp(w->name, "ANC HPHL PA"))) {
ret = tasha_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX1_RX_PATH_CFG0, 0x10, 0x00);
}
break;
@@ -4058,11 +4164,12 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 lineout_vol_reg = 0, lineout_mix_vol_reg = 0;
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
if (w->reg == WCD9335_ANA_LO_1_2) {
if (w->shift == 7) {
@@ -4081,7 +4188,7 @@
lineout_mix_vol_reg = WCD9335_CDC_RX6_RX_PATH_MIX_CTL;
}
} else {
- dev_err(codec->dev, "%s: Error enabling lineout PA\n",
+ dev_err(component->dev, "%s: Error enabling lineout PA\n",
__func__);
return -EINVAL;
}
@@ -4092,32 +4199,33 @@
* HW requirement
*/
usleep_range(5000, 5500);
- snd_soc_update_bits(codec, lineout_vol_reg,
+ snd_soc_component_update_bits(component, lineout_vol_reg,
0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, lineout_mix_vol_reg)) & 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(
+ component, lineout_mix_vol_reg)) & 0x10)
+ snd_soc_component_update_bits(component,
lineout_mix_vol_reg,
0x10, 0x00);
if (!(strcmp(w->name, "ANC LINEOUT1 PA")) ||
!(strcmp(w->name, "ANC LINEOUT2 PA")))
ret = tasha_codec_enable_anc(w, kcontrol, event);
- tasha_codec_override(codec, CLS_AB, event);
+ tasha_codec_override(component, CLS_AB, event);
break;
case SND_SOC_DAPM_POST_PMD:
/* 5ms sleep is required after PA is disabled as per
* HW requirement
*/
usleep_range(5000, 5500);
- tasha_codec_override(codec, CLS_AB, event);
+ tasha_codec_override(component, CLS_AB, event);
if (!(strcmp(w->name, "ANC LINEOUT1 PA")) ||
!(strcmp(w->name, "ANC LINEOUT2 PA"))) {
ret = tasha_codec_enable_anc(w, kcontrol, event);
if (!(strcmp(w->name, "ANC LINEOUT1 PA")))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX3_RX_PATH_CFG0, 0x10, 0x10);
else
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX4_RX_PATH_CFG0, 0x10, 0x10);
}
break;
@@ -4131,14 +4239,15 @@
struct spk_anc_work *spk_anc_dwork;
struct tasha_priv *tasha;
struct delayed_work *delayed_work;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
delayed_work = to_delayed_work(work);
spk_anc_dwork = container_of(delayed_work, struct spk_anc_work, dwork);
tasha = spk_anc_dwork->tasha;
- codec = tasha->codec;
+ component = tasha->component;
- snd_soc_update_bits(codec, WCD9335_CDC_RX7_RX_PATH_CFG0, 0x10, 0x10);
+ snd_soc_component_update_bits(component, WCD9335_CDC_RX7_RX_PATH_CFG0,
+ 0x10, 0x10);
}
static int tasha_codec_enable_spk_anc(struct snd_soc_dapm_widget *w,
@@ -4146,10 +4255,11 @@
int event)
{
int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s %s %d %d\n", __func__, w->name, event,
+ dev_dbg(component->dev, "%s %s %d %d\n", __func__, w->name, event,
tasha->anc_func);
if (!tasha->anc_func)
@@ -4163,8 +4273,9 @@
break;
case SND_SOC_DAPM_POST_PMD:
cancel_delayed_work_sync(&tasha->spk_anc_dwork.dwork);
- snd_soc_update_bits(codec, WCD9335_CDC_RX7_RX_PATH_CFG0,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_CFG0,
+ 0x10, 0x00);
ret = tasha_codec_enable_anc(w, kcontrol, event);
break;
}
@@ -4175,10 +4286,11 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
@@ -4186,12 +4298,13 @@
* HW requirement
*/
usleep_range(5000, 5500);
- snd_soc_update_bits(codec, WCD9335_CDC_RX0_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX0_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, WCD9335_CDC_RX0_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(
+ component, WCD9335_CDC_RX0_RX_PATH_MIX_CTL)) & 0x10)
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX0_RX_PATH_MIX_CTL,
0x10, 0x00);
break;
@@ -4203,7 +4316,7 @@
if (!(strcmp(w->name, "ANC EAR PA"))) {
ret = tasha_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX0_RX_PATH_CFG0, 0x10, 0x00);
}
break;
@@ -4212,21 +4325,21 @@
return ret;
}
-static void tasha_codec_hph_mode_gain_opt(struct snd_soc_codec *codec,
+static void tasha_codec_hph_mode_gain_opt(struct snd_soc_component *component,
u8 gain)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u8 hph_l_en, hph_r_en;
u8 l_val, r_val;
u8 hph_pa_status;
bool is_hphl_pa, is_hphr_pa;
- hph_pa_status = snd_soc_read(codec, WCD9335_ANA_HPH);
+ hph_pa_status = snd_soc_component_read32(component, WCD9335_ANA_HPH);
is_hphl_pa = hph_pa_status >> 7;
is_hphr_pa = (hph_pa_status & 0x40) >> 6;
- hph_l_en = snd_soc_read(codec, WCD9335_HPH_L_EN);
- hph_r_en = snd_soc_read(codec, WCD9335_HPH_R_EN);
+ hph_l_en = snd_soc_component_read32(component, WCD9335_HPH_L_EN);
+ hph_r_en = snd_soc_component_read32(component, WCD9335_HPH_R_EN);
l_val = (hph_l_en & 0xC0) | 0x20 | gain;
r_val = (hph_r_en & 0xC0) | 0x20 | gain;
@@ -4238,102 +4351,135 @@
* PA gains to be applied after PAs are enabled
*/
if ((l_val != hph_l_en) && !is_hphl_pa) {
- snd_soc_write(codec, WCD9335_HPH_L_EN, l_val);
+ snd_soc_component_write(component, WCD9335_HPH_L_EN, l_val);
tasha->hph_l_gain = hph_l_en & 0x1F;
}
if ((r_val != hph_r_en) && !is_hphr_pa) {
- snd_soc_write(codec, WCD9335_HPH_R_EN, r_val);
+ snd_soc_component_write(component, WCD9335_HPH_R_EN, r_val);
tasha->hph_r_gain = hph_r_en & 0x1F;
}
}
-static void tasha_codec_hph_lohifi_config(struct snd_soc_codec *codec,
+static void tasha_codec_hph_lohifi_config(struct snd_soc_component *component,
int event)
{
if (SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, WCD9335_RX_BIAS_HPH_PA, 0x0F, 0x06);
- snd_soc_update_bits(codec, WCD9335_RX_BIAS_HPH_RDACBUFF_CNP2,
- 0xF0, 0x40);
- snd_soc_update_bits(codec, WCD9335_HPH_CNP_WG_CTL, 0x07, 0x03);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x08, 0x08);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL1, 0x0E, 0x0C);
- tasha_codec_hph_mode_gain_opt(codec, 0x11);
+ snd_soc_component_update_bits(component,
+ WCD9335_RX_BIAS_HPH_PA,
+ 0x0F, 0x06);
+ snd_soc_component_update_bits(component,
+ WCD9335_RX_BIAS_HPH_RDACBUFF_CNP2,
+ 0xF0, 0x40);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_CNP_WG_CTL,
+ 0x07, 0x03);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2,
+ 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL1,
+ 0x0E, 0x0C);
+ tasha_codec_hph_mode_gain_opt(component, 0x11);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x08, 0x00);
- snd_soc_update_bits(codec, WCD9335_HPH_CNP_WG_CTL, 0x07, 0x02);
- snd_soc_write(codec, WCD9335_RX_BIAS_HPH_RDACBUFF_CNP2, 0x8A);
- snd_soc_update_bits(codec, WCD9335_RX_BIAS_HPH_PA, 0x0F, 0x0A);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2,
+ 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_CNP_WG_CTL, 0x07, 0x02);
+ snd_soc_component_write(component,
+ WCD9335_RX_BIAS_HPH_RDACBUFF_CNP2, 0x8A);
+ snd_soc_component_update_bits(component,
+ WCD9335_RX_BIAS_HPH_PA,
+ 0x0F, 0x0A);
}
}
-static void tasha_codec_hph_lp_config(struct snd_soc_codec *codec,
+static void tasha_codec_hph_lp_config(struct snd_soc_component *component,
int event)
{
if (SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL1, 0x0E, 0x0C);
- tasha_codec_hph_mode_gain_opt(codec, 0x10);
- snd_soc_update_bits(codec, WCD9335_HPH_CNP_WG_CTL, 0x07, 0x03);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x08, 0x08);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x04, 0x04);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x20, 0x20);
- snd_soc_update_bits(codec, WCD9335_HPH_RDAC_LDO_CTL, 0x07,
- 0x01);
- snd_soc_update_bits(codec, WCD9335_HPH_RDAC_LDO_CTL, 0x70,
- 0x10);
- snd_soc_update_bits(codec, WCD9335_RX_BIAS_HPH_RDAC_LDO,
- 0x0F, 0x01);
- snd_soc_update_bits(codec, WCD9335_RX_BIAS_HPH_RDAC_LDO,
- 0xF0, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL1, 0x0E, 0x0C);
+ tasha_codec_hph_mode_gain_opt(component, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_CNP_WG_CTL, 0x07, 0x03);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2, 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2, 0x20, 0x20);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_RDAC_LDO_CTL, 0x07, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_RDAC_LDO_CTL, 0x70, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_RX_BIAS_HPH_RDAC_LDO, 0x0F, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_RX_BIAS_HPH_RDAC_LDO, 0xF0, 0x10);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_write(codec, WCD9335_RX_BIAS_HPH_RDAC_LDO, 0x88);
- snd_soc_write(codec, WCD9335_HPH_RDAC_LDO_CTL, 0x33);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x20, 0x00);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x04, 0x00);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x08, 0x00);
- snd_soc_update_bits(codec, WCD9335_HPH_CNP_WG_CTL, 0x07, 0x02);
- snd_soc_update_bits(codec, WCD9335_HPH_R_EN, 0xC0, 0x80);
- snd_soc_update_bits(codec, WCD9335_HPH_L_EN, 0xC0, 0x80);
+ snd_soc_component_write(component,
+ WCD9335_RX_BIAS_HPH_RDAC_LDO, 0x88);
+ snd_soc_component_write(component,
+ WCD9335_HPH_RDAC_LDO_CTL, 0x33);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2, 0x20, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2, 0x04, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2, 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_CNP_WG_CTL, 0x07, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_R_EN, 0xC0, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_L_EN, 0xC0, 0x80);
}
}
-static void tasha_codec_hph_hifi_config(struct snd_soc_codec *codec,
+static void tasha_codec_hph_hifi_config(struct snd_soc_component *component,
int event)
{
if (SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, WCD9335_HPH_CNP_WG_CTL, 0x07, 0x03);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x08, 0x08);
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL1, 0x0E, 0x0C);
- tasha_codec_hph_mode_gain_opt(codec, 0x11);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_CNP_WG_CTL, 0x07, 0x03);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL1, 0x0E, 0x0C);
+ tasha_codec_hph_mode_gain_opt(component, 0x11);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2, 0x08, 0x00);
- snd_soc_update_bits(codec, WCD9335_HPH_CNP_WG_CTL, 0x07, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_PA_CTL2, 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_CNP_WG_CTL, 0x07, 0x02);
}
}
-static void tasha_codec_hph_mode_config(struct snd_soc_codec *codec,
+static void tasha_codec_hph_mode_config(struct snd_soc_component *component,
int event, int mode)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
if (!TASHA_IS_2_0(tasha->wcd9xxx))
return;
switch (mode) {
case CLS_H_LP:
- tasha_codec_hph_lp_config(codec, event);
+ tasha_codec_hph_lp_config(component, event);
break;
case CLS_H_LOHIFI:
- tasha_codec_hph_lohifi_config(codec, event);
+ tasha_codec_hph_lohifi_config(component, event);
break;
case CLS_H_HIFI:
- tasha_codec_hph_hifi_config(codec, event);
+ tasha_codec_hph_hifi_config(component, event);
break;
}
}
@@ -4342,15 +4488,16 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
int hph_mode = tasha->hph_mode;
u8 dem_inp;
int ret = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d hph_mode: %d\n", __func__,
- w->name, event, hph_mode);
+ dev_dbg(component->dev, "%s wname: %s event: %d hph_mode: %d\n",
+ __func__, w->name, event, hph_mode);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
@@ -4361,27 +4508,29 @@
}
/* Read DEM INP Select */
- dem_inp = snd_soc_read(codec, WCD9335_CDC_RX2_RX_PATH_SEC0) &
- 0x03;
+ dem_inp = snd_soc_component_read32(
+ component, WCD9335_CDC_RX2_RX_PATH_SEC0) &
+ 0x03;
if (((hph_mode == CLS_H_HIFI) || (hph_mode == CLS_H_LOHIFI) ||
(hph_mode == CLS_H_LP)) && (dem_inp != 0x01)) {
- dev_err(codec->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
+ dev_err(component->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
__func__, hph_mode);
return -EINVAL;
}
- wcd_clsh_fsm(codec, &tasha->clsh_d,
+ wcd_clsh_fsm(component, &tasha->clsh_d,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_HPHR,
((hph_mode == CLS_H_LOHIFI) ?
CLS_H_HIFI : hph_mode));
if (!(strcmp(w->name, "RX INT2 DAC")))
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_HPH, 0x10, 0x10);
- tasha_codec_hph_mode_config(codec, event, hph_mode);
+ tasha_codec_hph_mode_config(component, event, hph_mode);
if (tasha->anc_func)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX2_RX_PATH_CFG0, 0x10, 0x10);
break;
@@ -4390,18 +4539,20 @@
usleep_range(1000, 1100);
if ((hph_mode == CLS_H_LP) &&
(TASHA_IS_1_1(wcd9xxx))) {
- snd_soc_update_bits(codec, WCD9335_HPH_L_DAC_CTL,
- 0x03, 0x03);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_L_DAC_CTL, 0x03, 0x03);
}
break;
case SND_SOC_DAPM_PRE_PMD:
if ((hph_mode == CLS_H_LP) &&
(TASHA_IS_1_1(wcd9xxx))) {
- snd_soc_update_bits(codec, WCD9335_HPH_L_DAC_CTL,
- 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_L_DAC_CTL,
+ 0x03, 0x00);
}
if (!(strcmp(w->name, "RX INT2 DAC")))
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_HPH, 0x10, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
/* 1000us required as per HW requirement */
@@ -4409,9 +4560,9 @@
if (!(wcd_clsh_get_clsh_state(&tasha->clsh_d) &
WCD_CLSH_STATE_HPHL))
- tasha_codec_hph_mode_config(codec, event, hph_mode);
+ tasha_codec_hph_mode_config(component, event, hph_mode);
- wcd_clsh_fsm(codec, &tasha->clsh_d,
+ wcd_clsh_fsm(component, &tasha->clsh_d,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_HPHR,
((hph_mode == CLS_H_LOHIFI) ?
@@ -4426,16 +4577,17 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
int hph_mode = tasha->hph_mode;
u8 dem_inp;
int ret = 0;
uint32_t impedl = 0, impedr = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d hph_mode: %d\n", __func__,
- w->name, event, hph_mode);
+ dev_dbg(component->dev, "%s wname: %s event: %d hph_mode: %d\n",
+ __func__, w->name, event, hph_mode);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
@@ -4446,36 +4598,38 @@
}
/* Read DEM INP Select */
- dem_inp = snd_soc_read(codec, WCD9335_CDC_RX1_RX_PATH_SEC0) &
- 0x03;
+ dem_inp = snd_soc_component_read32(
+ component, WCD9335_CDC_RX1_RX_PATH_SEC0) &
+ 0x03;
if (((hph_mode == CLS_H_HIFI) || (hph_mode == CLS_H_LOHIFI) ||
(hph_mode == CLS_H_LP)) && (dem_inp != 0x01)) {
- dev_err(codec->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
+ dev_err(component->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
__func__, hph_mode);
return -EINVAL;
}
- wcd_clsh_fsm(codec, &tasha->clsh_d,
+ wcd_clsh_fsm(component, &tasha->clsh_d,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_HPHL,
((hph_mode == CLS_H_LOHIFI) ?
CLS_H_HIFI : hph_mode));
if (!(strcmp(w->name, "RX INT1 DAC")))
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x20, 0x20);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_HPH, 0x20, 0x20);
- tasha_codec_hph_mode_config(codec, event, hph_mode);
+ tasha_codec_hph_mode_config(component, event, hph_mode);
if (tasha->anc_func)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX1_RX_PATH_CFG0, 0x10, 0x10);
ret = wcd_mbhc_get_impedance(&tasha->mbhc,
&impedl, &impedr);
if (!ret) {
- wcd_clsh_imped_config(codec, impedl, false);
+ wcd_clsh_imped_config(component, impedl, false);
set_bit(CLASSH_CONFIG, &tasha->status_mask);
} else {
- dev_dbg(codec->dev, "%s: Failed to get mbhc impedance %d\n",
+ dev_dbg(component->dev, "%s: Failed to get mbhc impedance %d\n",
__func__, ret);
ret = 0;
}
@@ -4487,17 +4641,20 @@
usleep_range(1000, 1100);
if ((hph_mode == CLS_H_LP) &&
(TASHA_IS_1_1(wcd9xxx))) {
- snd_soc_update_bits(codec, WCD9335_HPH_L_DAC_CTL,
- 0x03, 0x03);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_L_DAC_CTL,
+ 0x03, 0x03);
}
break;
case SND_SOC_DAPM_PRE_PMD:
if (!(strcmp(w->name, "RX INT1 DAC")))
- snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x20, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_ANA_HPH, 0x20, 0x00);
if ((hph_mode == CLS_H_LP) &&
(TASHA_IS_1_1(wcd9xxx))) {
- snd_soc_update_bits(codec, WCD9335_HPH_L_DAC_CTL,
- 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_HPH_L_DAC_CTL,
+ 0x03, 0x00);
}
break;
case SND_SOC_DAPM_POST_PMD:
@@ -4506,18 +4663,18 @@
if (!(wcd_clsh_get_clsh_state(&tasha->clsh_d) &
WCD_CLSH_STATE_HPHR))
- tasha_codec_hph_mode_config(codec, event, hph_mode);
- wcd_clsh_fsm(codec, &tasha->clsh_d,
+ tasha_codec_hph_mode_config(component, event, hph_mode);
+ wcd_clsh_fsm(component, &tasha->clsh_d,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_HPHL,
((hph_mode == CLS_H_LOHIFI) ?
CLS_H_HIFI : hph_mode));
if (test_bit(CLASSH_CONFIG, &tasha->status_mask)) {
- wcd_clsh_imped_config(codec, impedl, true);
+ wcd_clsh_imped_config(component, impedl, true);
clear_bit(CLASSH_CONFIG, &tasha->status_mask);
} else
- dev_dbg(codec->dev, "%s: Failed to get mbhc impedance %d\n",
+ dev_dbg(component->dev, "%s: Failed to get mbhc impedance %d\n",
__func__, ret);
@@ -4531,11 +4688,12 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
@@ -4544,22 +4702,22 @@
!strcmp(w->name, "RX INT4 DAC")))
ret = tasha_codec_enable_anc(w, kcontrol, event);
- wcd_clsh_fsm(codec, &tasha->clsh_d,
+ wcd_clsh_fsm(component, &tasha->clsh_d,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_LO,
CLS_AB);
if (tasha->anc_func) {
if (!strcmp(w->name, "RX INT3 DAC"))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX3_RX_PATH_CFG0, 0x10, 0x10);
else if (!strcmp(w->name, "RX INT4 DAC"))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX4_RX_PATH_CFG0, 0x10, 0x10);
}
break;
case SND_SOC_DAPM_POST_PMD:
- wcd_clsh_fsm(codec, &tasha->clsh_d,
+ wcd_clsh_fsm(component, &tasha->clsh_d,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_LO,
CLS_AB);
@@ -4580,23 +4738,24 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (tasha->anc_func)
ret = tasha_codec_enable_anc(w, kcontrol, event);
- wcd_clsh_fsm(codec, &tasha->clsh_d,
+ wcd_clsh_fsm(component, &tasha->clsh_d,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_EAR,
CLS_H_NORMAL);
if (tasha->anc_func)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_RX0_RX_PATH_CFG0, 0x10, 0x10);
break;
@@ -4605,7 +4764,7 @@
case SND_SOC_DAPM_PRE_PMD:
break;
case SND_SOC_DAPM_POST_PMD:
- wcd_clsh_fsm(codec, &tasha->clsh_d,
+ wcd_clsh_fsm(component, &tasha->clsh_d,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_EAR,
CLS_H_NORMAL);
@@ -4619,11 +4778,12 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 boost_path_ctl, boost_path_cfg1;
u16 reg, reg_mix;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
if (!strcmp(w->name, "RX INT7 CHAIN")) {
boost_path_ctl = WCD9335_CDC_BOOST0_BOOST_PATH_CTL;
@@ -4636,22 +4796,27 @@
reg = WCD9335_CDC_RX8_RX_PATH_CTL;
reg_mix = WCD9335_CDC_RX8_RX_PATH_MIX_CTL;
} else {
- dev_err(codec->dev, "%s: unknown widget: %s\n",
+ dev_err(component->dev, "%s: unknown widget: %s\n",
__func__, w->name);
return -EINVAL;
}
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x10);
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x01);
- snd_soc_update_bits(codec, reg, 0x10, 0x00);
- if ((snd_soc_read(codec, reg_mix)) & 0x10)
- snd_soc_update_bits(codec, reg_mix, 0x10, 0x00);
+ snd_soc_component_update_bits(component, boost_path_ctl,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component, boost_path_cfg1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, reg, 0x10, 0x00);
+ if ((snd_soc_component_read32(component, reg_mix)) & 0x10)
+ snd_soc_component_update_bits(component, reg_mix,
+ 0x10, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x00);
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x00);
+ snd_soc_component_update_bits(component, boost_path_cfg1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component, boost_path_ctl,
+ 0x10, 0x00);
break;
};
@@ -4713,10 +4878,10 @@
return prim_int_reg;
}
-static void tasha_codec_hd2_control(struct snd_soc_codec *codec,
+static void tasha_codec_hd2_control(struct snd_soc_component *component,
u16 prim_int_reg, int event)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u16 hd2_scale_reg;
u16 hd2_enable_reg = 0;
@@ -4733,23 +4898,29 @@
}
if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x10);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x03, 0x01);
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x04);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x3C, 0x10);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x03, 0x01);
+ snd_soc_component_update_bits(component, hd2_enable_reg,
+ 0x04, 0x04);
}
if (hd2_enable_reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x00);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x03, 0x00);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x00);
+ snd_soc_component_update_bits(component, hd2_enable_reg,
+ 0x04, 0x00);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x03, 0x00);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x3C, 0x00);
}
}
static int tasha_codec_enable_prim_interpolator(
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
u16 reg, int event)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u16 prim_int_reg;
u16 ind = 0;
@@ -4759,36 +4930,38 @@
case SND_SOC_DAPM_PRE_PMU:
tasha->prim_int_users[ind]++;
if (tasha->prim_int_users[ind] == 1) {
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
0x10, 0x10);
- tasha_codec_hd2_control(codec, prim_int_reg, event);
- snd_soc_update_bits(codec, prim_int_reg,
+ tasha_codec_hd2_control(component, prim_int_reg, event);
+ snd_soc_component_update_bits(component, prim_int_reg,
1 << 0x5, 1 << 0x5);
}
if ((reg != prim_int_reg) &&
- ((snd_soc_read(codec, prim_int_reg)) & 0x10))
- snd_soc_update_bits(codec, reg, 0x10, 0x10);
+ ((snd_soc_component_read32(
+ component, prim_int_reg)) & 0x10))
+ snd_soc_component_update_bits(component, reg,
+ 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMD:
tasha->prim_int_users[ind]--;
if (tasha->prim_int_users[ind] == 0) {
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
1 << 0x5, 0 << 0x5);
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
0x40, 0x40);
- snd_soc_update_bits(codec, prim_int_reg,
+ snd_soc_component_update_bits(component, prim_int_reg,
0x40, 0x00);
- tasha_codec_hd2_control(codec, prim_int_reg, event);
+ tasha_codec_hd2_control(component, prim_int_reg, event);
}
break;
};
- dev_dbg(codec->dev, "%s: primary interpolator: INT%d, users: %d\n",
+ dev_dbg(component->dev, "%s: primary interpolator: INT%d, users: %d\n",
__func__, ind, tasha->prim_int_users[ind]);
return 0;
}
-static int tasha_codec_enable_spline_src(struct snd_soc_codec *codec,
+static int tasha_codec_enable_spline_src(struct snd_soc_component *component,
int src_num,
int event)
{
@@ -4799,7 +4972,7 @@
int *src_users, count, spl_src = SPLINE_SRC0;
u16 src_clk_reg = WCD9335_SPLINE_SRC0_CLK_RST_CTL_0;
- tasha = snd_soc_codec_get_drvdata(codec);
+ tasha = snd_soc_component_get_drvdata(component);
switch (src_num) {
case SRC_IN_HPHL:
@@ -4867,16 +5040,19 @@
count = *src_users;
count++;
if (count == 1) {
- if ((snd_soc_read(codec, src_clk_reg) & 0x02) ||
- (snd_soc_read(codec, src_paired_reg) & 0x02)) {
- snd_soc_update_bits(codec, src_clk_reg, 0x02,
- 0x00);
- snd_soc_update_bits(codec, src_paired_reg,
- 0x02, 0x00);
+ if ((snd_soc_component_read32(
+ component, src_clk_reg) & 0x02) ||
+ (snd_soc_component_read32(
+ component, src_paired_reg) & 0x02)) {
+ snd_soc_component_update_bits(component,
+ src_clk_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ src_paired_reg, 0x02, 0x00);
}
- snd_soc_update_bits(codec, src_clk_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, rx_path_cfg_reg, 0x80,
- 0x80);
+ snd_soc_component_update_bits(component, src_clk_reg,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ rx_path_cfg_reg, 0x80, 0x80);
}
*src_users = count;
break;
@@ -4884,18 +5060,19 @@
count = *src_users;
count--;
if (count == 0) {
- snd_soc_update_bits(codec, rx_path_cfg_reg, 0x80,
- 0x00);
- snd_soc_update_bits(codec, src_clk_reg, 0x03, 0x02);
+ snd_soc_component_update_bits(component,
+ rx_path_cfg_reg, 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ src_clk_reg, 0x03, 0x02);
/* default sample rate */
- snd_soc_update_bits(codec, rx_path_ctl_reg, 0x0f,
- 0x04);
+ snd_soc_component_update_bits(component,
+ rx_path_ctl_reg, 0x0f, 0x04);
}
*src_users = count;
break;
};
- dev_dbg(codec->dev, "%s: Spline SRC%d, users: %d\n",
+ dev_dbg(component->dev, "%s: Spline SRC%d, users: %d\n",
__func__, spl_src, *src_users);
return 0;
}
@@ -4904,40 +5081,42 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
u8 src_in;
- src_in = snd_soc_read(codec, WCD9335_CDC_RX_INP_MUX_SPLINE_SRC_CFG0);
+ src_in = snd_soc_component_read32(
+ component, WCD9335_CDC_RX_INP_MUX_SPLINE_SRC_CFG0);
if (!(src_in & 0xFF)) {
- dev_err(codec->dev, "%s: Spline SRC%u input not selected\n",
+ dev_err(component->dev, "%s: Spline SRC%u input not selected\n",
__func__, w->shift);
return -EINVAL;
}
switch (w->shift) {
case SPLINE_SRC0:
- ret = tasha_codec_enable_spline_src(codec,
+ ret = tasha_codec_enable_spline_src(component,
((src_in & 0x03) == 1) ? SRC_IN_HPHL : SRC_IN_LO1,
event);
break;
case SPLINE_SRC1:
- ret = tasha_codec_enable_spline_src(codec,
+ ret = tasha_codec_enable_spline_src(component,
((src_in & 0x0C) == 4) ? SRC_IN_HPHR : SRC_IN_LO2,
event);
break;
case SPLINE_SRC2:
- ret = tasha_codec_enable_spline_src(codec,
+ ret = tasha_codec_enable_spline_src(component,
((src_in & 0x30) == 0x10) ? SRC_IN_LO3 : SRC_IN_SPKRL,
event);
break;
case SPLINE_SRC3:
- ret = tasha_codec_enable_spline_src(codec,
+ ret = tasha_codec_enable_spline_src(component,
((src_in & 0xC0) == 0x40) ? SRC_IN_LO4 : SRC_IN_SPKRR,
event);
break;
default:
- dev_err(codec->dev, "%s: Invalid spline src:%u\n", __func__,
+ dev_err(component->dev, "%s: Invalid spline src:%u\n", __func__,
w->shift);
ret = -EINVAL;
};
@@ -4948,11 +5127,12 @@
static int tasha_codec_enable_swr(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
struct tasha_priv *tasha;
int i, ch_cnt;
- tasha = snd_soc_codec_get_drvdata(codec);
+ tasha = snd_soc_component_get_drvdata(component);
if (!tasha->nr)
return 0;
@@ -4995,11 +5175,11 @@
return 0;
}
-static int tasha_codec_config_ear_spkr_gain(struct snd_soc_codec *codec,
+static int tasha_codec_config_ear_spkr_gain(struct snd_soc_component *component,
int event, int gain_reg)
{
int comp_gain_offset, val;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
switch (tasha->spkr_mode) {
/* Compander gain in SPKR_MODE1 case is 12 dB */
@@ -5021,9 +5201,9 @@
(tasha->ear_spkr_gain != 0)) {
/* For example, val is -8(-12+5-1) for 4dB of gain */
val = comp_gain_offset + tasha->ear_spkr_gain - 1;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
- dev_dbg(codec->dev, "%s: RX7 Volume %d dB\n",
+ dev_dbg(component->dev, "%s: RX7 Volume %d dB\n",
__func__, val);
}
break;
@@ -5036,9 +5216,9 @@
(gain_reg == WCD9335_CDC_RX7_RX_VOL_CTL ||
gain_reg == WCD9335_CDC_RX7_RX_VOL_MIX_CTL) &&
(tasha->ear_spkr_gain != 0)) {
- snd_soc_write(codec, gain_reg, 0x0);
+ snd_soc_component_write(component, gain_reg, 0x0);
- dev_dbg(codec->dev, "%s: Reset RX7 Volume to 0 dB\n",
+ dev_dbg(component->dev, "%s: Reset RX7 Volume to 0 dB\n",
__func__);
}
break;
@@ -5050,13 +5230,14 @@
static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u16 gain_reg;
int offset_val = 0;
int val = 0;
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s %d %s\n", __func__, event, w->name);
switch (w->reg) {
case WCD9335_CDC_RX0_RX_PATH_MIX_CTL:
@@ -5087,7 +5268,7 @@
gain_reg = WCD9335_CDC_RX8_RX_VOL_MIX_CTL;
break;
default:
- dev_err(codec->dev, "%s: No gain register avail for %s\n",
+ dev_err(component->dev, "%s: No gain register avail for %s\n",
__func__, w->name);
return 0;
};
@@ -5099,22 +5280,24 @@
tasha->comp_enabled[COMPANDER_8]) &&
(gain_reg == WCD9335_CDC_RX7_RX_VOL_MIX_CTL ||
gain_reg == WCD9335_CDC_RX8_RX_VOL_MIX_CTL)) {
- snd_soc_update_bits(codec, WCD9335_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD9335_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD9335_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX8_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX8_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
offset_val = -2;
}
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- tasha_codec_config_ear_spkr_gain(codec, event, gain_reg);
+ snd_soc_component_write(component, gain_reg, val);
+ tasha_codec_config_ear_spkr_gain(component, event, gain_reg);
break;
case SND_SOC_DAPM_POST_PMD:
if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) &&
@@ -5122,22 +5305,24 @@
tasha->comp_enabled[COMPANDER_8]) &&
(gain_reg == WCD9335_CDC_RX7_RX_VOL_MIX_CTL ||
gain_reg == WCD9335_CDC_RX8_RX_VOL_MIX_CTL)) {
- snd_soc_update_bits(codec, WCD9335_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9335_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9335_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX8_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX8_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
offset_val = 2;
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
}
- tasha_codec_config_ear_spkr_gain(codec, event, gain_reg);
+ tasha_codec_config_ear_spkr_gain(component, event, gain_reg);
break;
};
@@ -5148,14 +5333,16 @@
bool enable)
{
int ret = 0;
- struct snd_soc_codec *codec = tasha->codec;
+ struct snd_soc_component *component = tasha->component;
if (!tasha->wcd_native_clk) {
- dev_err(tasha->dev, "%s: wcd native clock is NULL\n", __func__);
+ dev_err(tasha->dev, "%s: wcd native clock is NULL\n",
+ __func__);
return -EINVAL;
}
- dev_dbg(tasha->dev, "%s: native_clk_enable = %u\n", __func__, enable);
+ dev_dbg(tasha->dev, "%s: native_clk_enable = %u\n",
+ __func__, enable);
if (enable) {
ret = clk_prepare_enable(tasha->wcd_native_clk);
@@ -5165,40 +5352,47 @@
goto err;
}
if (++tasha->native_clk_users == 1) {
- snd_soc_update_bits(codec, WCD9335_CLOCK_TEST_CTL,
- 0x10, 0x10);
- snd_soc_update_bits(codec, WCD9335_CLOCK_TEST_CTL,
- 0x80, 0x80);
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_CLK_GATE,
- 0x04, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
+ WCD9335_CLOCK_TEST_CTL,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_CLOCK_TEST_CTL,
+ 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_CLK_GATE,
+ 0x04, 0x00);
+ snd_soc_component_update_bits(component,
WCD9335_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x02, 0x02);
}
} else {
if (tasha->native_clk_users &&
(--tasha->native_clk_users == 0)) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x02, 0x00);
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_CLK_GATE,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD9335_CLOCK_TEST_CTL,
- 0x80, 0x00);
- snd_soc_update_bits(codec, WCD9335_CLOCK_TEST_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_CLK_GATE,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD9335_CLOCK_TEST_CTL,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CLOCK_TEST_CTL,
+ 0x10, 0x00);
}
clk_disable_unprepare(tasha->wcd_native_clk);
}
- dev_dbg(codec->dev, "%s: native_clk_users: %d\n", __func__,
+ dev_dbg(component->dev, "%s: native_clk_users: %d\n", __func__,
tasha->native_clk_users);
err:
return ret;
}
-static int tasha_codec_get_native_fifo_sync_mask(struct snd_soc_codec *codec,
- int interp_n)
+static int tasha_codec_get_native_fifo_sync_mask(
+ struct snd_soc_component *component,
+ int interp_n)
{
int mask = 0;
u16 reg;
@@ -5207,8 +5401,8 @@
reg = WCD9335_CDC_RX_INP_MUX_RX_INT1_CFG0 + (2 * interp_n) - 2;
- val1 = snd_soc_read(codec, reg);
- val2 = snd_soc_read(codec, reg + 1);
+ val1 = snd_soc_component_read32(component, reg);
+ val2 = snd_soc_component_read32(component, reg + 1);
inp0 = val1 & 0x0F;
inp1 = (val1 >> 4) & 0x0F;
@@ -5221,9 +5415,9 @@
if (IS_VALID_NATIVE_FIFO_PORT(inp2))
mask |= (1 << (inp2 - 5));
- dev_dbg(codec->dev, "%s: native fifo mask: 0x%x\n", __func__, mask);
+ dev_dbg(component->dev, "%s: native fifo mask: 0x%x\n", __func__, mask);
if (!mask)
- dev_err(codec->dev, "native fifo err,int:%d,inp0:%d,inp1:%d,inp2:%d\n",
+ dev_err(component->dev, "native fifo err,int:%d,inp0:%d,inp1:%d,inp2:%d\n",
interp_n, inp0, inp1, inp2);
return mask;
}
@@ -5232,11 +5426,12 @@
struct snd_kcontrol *kcontrol, int event)
{
int mask;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u16 interp_reg;
- dev_dbg(codec->dev, "%s: event: %d, shift:%d\n", __func__, event,
+ dev_dbg(component->dev, "%s: event: %d, shift:%d\n", __func__, event,
w->shift);
if (w->shift < INTERP_HPHL || w->shift > INTERP_LO2)
@@ -5244,24 +5439,28 @@
interp_reg = WCD9335_CDC_RX1_RX_PATH_CTL + 20 * (w->shift - 1);
- mask = tasha_codec_get_native_fifo_sync_mask(codec, w->shift);
+ mask = tasha_codec_get_native_fifo_sync_mask(component, w->shift);
if (!mask)
return -EINVAL;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Adjust interpolator rate to 44P1_NATIVE */
- snd_soc_update_bits(codec, interp_reg, 0x0F, 0x09);
+ snd_soc_component_update_bits(component, interp_reg,
+ 0x0F, 0x09);
__tasha_cdc_native_clk_enable(tasha, true);
- snd_soc_update_bits(codec, WCD9335_DATA_HUB_NATIVE_FIFO_SYNC,
- mask, mask);
+ snd_soc_component_update_bits(component,
+ WCD9335_DATA_HUB_NATIVE_FIFO_SYNC,
+ mask, mask);
break;
case SND_SOC_DAPM_PRE_PMD:
- snd_soc_update_bits(codec, WCD9335_DATA_HUB_NATIVE_FIFO_SYNC,
- mask, 0x0);
+ snd_soc_component_update_bits(component,
+ WCD9335_DATA_HUB_NATIVE_FIFO_SYNC,
+ mask, 0x0);
__tasha_cdc_native_clk_enable(tasha, false);
/* Adjust interpolator rate to default */
- snd_soc_update_bits(codec, interp_reg, 0x0F, 0x04);
+ snd_soc_component_update_bits(component, interp_reg,
+ 0x0F, 0x04);
break;
}
@@ -5271,14 +5470,15 @@
static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u16 gain_reg;
u16 reg;
int val;
int offset_val = 0;
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s %d %s\n", __func__, event, w->name);
if (!(strcmp(w->name, "RX INT0 INTERP"))) {
reg = WCD9335_CDC_RX0_RX_PATH_CTL;
@@ -5308,66 +5508,70 @@
reg = WCD9335_CDC_RX8_RX_PATH_CTL;
gain_reg = WCD9335_CDC_RX8_RX_VOL_CTL;
} else {
- dev_err(codec->dev, "%s: Interpolator reg not found\n",
+ dev_err(component->dev, "%s: Interpolator reg not found\n",
__func__);
return -EINVAL;
}
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- tasha_codec_vote_max_bw(codec, true);
+ tasha_codec_vote_max_bw(component, true);
/* Reset if needed */
- tasha_codec_enable_prim_interpolator(codec, reg, event);
+ tasha_codec_enable_prim_interpolator(component, reg, event);
break;
case SND_SOC_DAPM_POST_PMU:
- tasha_config_compander(codec, w->shift, event);
+ tasha_config_compander(component, w->shift, event);
/* apply gain after int clk is enabled */
if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) &&
(tasha->comp_enabled[COMPANDER_7] ||
tasha->comp_enabled[COMPANDER_8]) &&
(gain_reg == WCD9335_CDC_RX7_RX_VOL_CTL ||
gain_reg == WCD9335_CDC_RX8_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, WCD9335_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD9335_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD9335_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX8_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX8_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
offset_val = -2;
}
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- tasha_codec_config_ear_spkr_gain(codec, event, gain_reg);
+ snd_soc_component_write(component, gain_reg, val);
+ tasha_codec_config_ear_spkr_gain(component, event, gain_reg);
break;
case SND_SOC_DAPM_POST_PMD:
- tasha_config_compander(codec, w->shift, event);
- tasha_codec_enable_prim_interpolator(codec, reg, event);
+ tasha_config_compander(component, w->shift, event);
+ tasha_codec_enable_prim_interpolator(component, reg, event);
if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) &&
(tasha->comp_enabled[COMPANDER_7] ||
tasha->comp_enabled[COMPANDER_8]) &&
(gain_reg == WCD9335_CDC_RX7_RX_VOL_CTL ||
gain_reg == WCD9335_CDC_RX8_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, WCD9335_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9335_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9335_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX7_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX8_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_RX8_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
offset_val = 2;
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
}
- tasha_codec_config_ear_spkr_gain(codec, event, gain_reg);
+ tasha_codec_config_ear_spkr_gain(component, event, gain_reg);
break;
};
@@ -5377,42 +5581,43 @@
static int tasha_codec_set_iir_gain(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s: event = %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event = %d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU: /* fall through */
case SND_SOC_DAPM_PRE_PMD:
if (strnstr(w->name, "IIR0", sizeof("IIR0"))) {
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD9335_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD9335_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD9335_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD9335_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD9335_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD9335_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD9335_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD9335_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL));
} else {
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD9335_CDC_SIDETONE_IIR1_IIR_GAIN_B1_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD9335_CDC_SIDETONE_IIR1_IIR_GAIN_B1_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD9335_CDC_SIDETONE_IIR1_IIR_GAIN_B2_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD9335_CDC_SIDETONE_IIR1_IIR_GAIN_B2_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD9335_CDC_SIDETONE_IIR1_IIR_GAIN_B3_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD9335_CDC_SIDETONE_IIR1_IIR_GAIN_B3_CTL));
}
break;
@@ -5425,25 +5630,26 @@
struct snd_kcontrol *kcontrol, int event)
{
int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct on_demand_supply *supply;
if (w->shift >= ON_DEMAND_SUPPLIES_MAX) {
- dev_err(codec->dev, "%s: error index > MAX Demand supplies",
+ dev_err(component->dev, "%s: error index > MAX Demand supplies",
__func__);
ret = -EINVAL;
goto out;
}
- dev_dbg(codec->dev, "%s: supply: %s event: %d\n",
+ dev_dbg(component->dev, "%s: supply: %s event: %d\n",
__func__, on_demand_supply_name[w->shift], event);
supply = &tasha->on_demand_list[w->shift];
WARN_ONCE(!supply->supply, "%s isn't defined\n",
on_demand_supply_name[w->shift]);
if (!supply->supply) {
- dev_err(codec->dev, "%s: err supply not present ond for %d",
+ dev_err(component->dev, "%s: err supply not present ond for %d",
__func__, w->shift);
goto out;
}
@@ -5452,14 +5658,14 @@
case SND_SOC_DAPM_PRE_PMU:
ret = regulator_enable(supply->supply);
if (ret)
- dev_err(codec->dev, "%s: Failed to enable %s\n",
+ dev_err(component->dev, "%s: Failed to enable %s\n",
__func__,
on_demand_supply_name[w->shift]);
break;
case SND_SOC_DAPM_POST_PMD:
ret = regulator_disable(supply->supply);
if (ret)
- dev_err(codec->dev, "%s: Failed to disable %s\n",
+ dev_err(component->dev, "%s: Failed to disable %s\n",
__func__,
on_demand_supply_name[w->shift]);
break;
@@ -5471,7 +5677,7 @@
return ret;
}
-static int tasha_codec_find_amic_input(struct snd_soc_codec *codec,
+static int tasha_codec_find_amic_input(struct snd_soc_component *component,
int adc_mux_n)
{
u16 mask, shift, adc_mux_in_reg;
@@ -5497,15 +5703,15 @@
mask = 0xC0;
shift = 6;
}
- is_amic = (((snd_soc_read(codec, adc_mux_in_reg) & mask) >> shift)
- == 1);
+ is_amic = (((snd_soc_component_read32(
+ component, adc_mux_in_reg) & mask) >> shift) == 1);
if (!is_amic)
return 0;
- return snd_soc_read(codec, amic_mux_sel_reg) & 0x07;
+ return snd_soc_component_read32(component, amic_mux_sel_reg) & 0x07;
}
-static void tasha_codec_set_tx_hold(struct snd_soc_codec *codec,
+static void tasha_codec_set_tx_hold(struct snd_soc_component *component,
u16 amic_reg, bool set)
{
u8 mask = 0x20;
@@ -5521,18 +5727,21 @@
switch (amic_reg) {
case WCD9335_ANA_AMIC1:
case WCD9335_ANA_AMIC2:
- snd_soc_update_bits(codec, WCD9335_ANA_AMIC2, mask, val);
+ snd_soc_component_update_bits(component, WCD9335_ANA_AMIC2,
+ mask, val);
break;
case WCD9335_ANA_AMIC3:
case WCD9335_ANA_AMIC4:
- snd_soc_update_bits(codec, WCD9335_ANA_AMIC4, mask, val);
+ snd_soc_component_update_bits(component, WCD9335_ANA_AMIC4,
+ mask, val);
break;
case WCD9335_ANA_AMIC5:
case WCD9335_ANA_AMIC6:
- snd_soc_update_bits(codec, WCD9335_ANA_AMIC6, mask, val);
+ snd_soc_component_update_bits(component, WCD9335_ANA_AMIC6,
+ mask, val);
break;
default:
- dev_dbg(codec->dev, "%s: invalid amic: %d\n",
+ dev_dbg(component->dev, "%s: invalid amic: %d\n",
__func__, amic_reg);
break;
}
@@ -5542,15 +5751,16 @@
struct snd_kcontrol *kcontrol, int event)
{
int adc_mux_n = w->shift;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int amic_n;
- dev_dbg(codec->dev, "%s: event: %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event: %d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- amic_n = tasha_codec_find_amic_input(codec, adc_mux_n);
+ amic_n = tasha_codec_find_amic_input(component, adc_mux_n);
if (amic_n) {
/*
* Prevent ANC Rx pop by leaving Tx FE in HOLD
@@ -5568,7 +5778,8 @@
return 0;
}
-static u16 tasha_codec_get_amic_pwlvl_reg(struct snd_soc_codec *codec, int amic)
+static u16 tasha_codec_get_amic_pwlvl_reg(
+ struct snd_soc_component *component, int amic)
{
u16 pwr_level_reg = 0;
@@ -5588,7 +5799,7 @@
pwr_level_reg = WCD9335_ANA_AMIC5;
break;
default:
- dev_dbg(codec->dev, "%s: invalid amic: %d\n",
+ dev_dbg(component->dev, "%s: invalid amic: %d\n",
__func__, amic);
break;
}
@@ -5606,7 +5817,7 @@
struct delayed_work *hpf_delayed_work;
struct hpf_work *hpf_work;
struct tasha_priv *tasha;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u16 dec_cfg_reg, amic_reg;
u8 hpf_cut_off_freq;
int amic_n;
@@ -5614,23 +5825,24 @@
hpf_delayed_work = to_delayed_work(work);
hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork);
tasha = hpf_work->tasha;
- codec = tasha->codec;
+ component = tasha->component;
hpf_cut_off_freq = hpf_work->hpf_cut_off_freq;
dec_cfg_reg = WCD9335_CDC_TX0_TX_PATH_CFG0 + 16 * hpf_work->decimator;
- dev_dbg(codec->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
+ dev_dbg(component->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
__func__, hpf_work->decimator, hpf_cut_off_freq);
- amic_n = tasha_codec_find_amic_input(codec, hpf_work->decimator);
+ amic_n = tasha_codec_find_amic_input(component, hpf_work->decimator);
if (amic_n) {
amic_reg = WCD9335_ANA_AMIC1 + amic_n - 1;
- tasha_codec_set_tx_hold(codec, amic_reg, false);
+ tasha_codec_set_tx_hold(component, amic_reg, false);
}
- tasha_codec_vote_max_bw(codec, true);
- snd_soc_update_bits(codec, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- tasha_codec_vote_max_bw(codec, false);
+ tasha_codec_vote_max_bw(component, true);
+ snd_soc_component_update_bits(component, dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ tasha_codec_vote_max_bw(component, false);
}
static void tasha_tx_mute_update_callback(struct work_struct *work)
@@ -5638,26 +5850,27 @@
struct tx_mute_work *tx_mute_dwork;
struct tasha_priv *tasha;
struct delayed_work *delayed_work;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u16 tx_vol_ctl_reg, hpf_gate_reg;
delayed_work = to_delayed_work(work);
tx_mute_dwork = container_of(delayed_work, struct tx_mute_work, dwork);
tasha = tx_mute_dwork->tasha;
- codec = tasha->codec;
+ component = tasha->component;
tx_vol_ctl_reg = WCD9335_CDC_TX0_TX_PATH_CTL +
16 * tx_mute_dwork->decimator;
hpf_gate_reg = WCD9335_CDC_TX0_TX_PATH_SEC2 +
16 * tx_mute_dwork->decimator;
- snd_soc_update_bits(codec, hpf_gate_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, hpf_gate_reg, 0x01, 0x01);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x10, 0x00);
}
static int tasha_codec_enable_dec(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
unsigned int decimator;
char *dec_adc_mux_name = NULL;
char *widget_name = NULL;
@@ -5667,9 +5880,9 @@
u16 tx_gain_ctl_reg;
char *dec;
u8 hpf_cut_off_freq;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s %d\n", __func__, event);
+ dev_dbg(component->dev, "%s %d\n", __func__, event);
widget_name = kstrndup(w->name, 15, GFP_KERNEL);
if (!widget_name)
@@ -5678,7 +5891,7 @@
wname = widget_name;
dec_adc_mux_name = strsep(&widget_name, " ");
if (!dec_adc_mux_name) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
+ dev_err(component->dev, "%s: Invalid decimator = %s\n",
__func__, w->name);
ret = -EINVAL;
goto out;
@@ -5687,7 +5900,7 @@
dec = strpbrk(dec_adc_mux_name, "012345678");
if (!dec) {
- dev_err(codec->dev, "%s: decimator index not found\n",
+ dev_err(component->dev, "%s: decimator index not found\n",
__func__);
ret = -EINVAL;
goto out;
@@ -5695,13 +5908,13 @@
ret = kstrtouint(dec, 10, &decimator);
if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
+ dev_err(component->dev, "%s: Invalid decimator = %s\n",
__func__, wname);
ret = -EINVAL;
goto out;
}
- dev_dbg(codec->dev, "%s(): widget = %s decimator = %u\n", __func__,
+ dev_dbg(component->dev, "%s(): widget = %s decimator = %u\n", __func__,
w->name, decimator);
tx_vol_ctl_reg = WCD9335_CDC_TX0_TX_PATH_CTL + 16 * decimator;
@@ -5711,54 +5924,65 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- amic_n = tasha_codec_find_amic_input(codec, decimator);
+ amic_n = tasha_codec_find_amic_input(component, decimator);
if (amic_n)
- pwr_level_reg = tasha_codec_get_amic_pwlvl_reg(codec,
- amic_n);
+ pwr_level_reg = tasha_codec_get_amic_pwlvl_reg(
+ component, amic_n);
if (pwr_level_reg) {
- switch ((snd_soc_read(codec, pwr_level_reg) &
+ switch (
+ (snd_soc_component_read32(component, pwr_level_reg) &
WCD9335_AMIC_PWR_LVL_MASK) >>
WCD9335_AMIC_PWR_LVL_SHIFT) {
case WCD9335_AMIC_PWR_LEVEL_LP:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD9335_DEC_PWR_LVL_MASK,
- WCD9335_DEC_PWR_LVL_LP);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ WCD9335_DEC_PWR_LVL_MASK,
+ WCD9335_DEC_PWR_LVL_LP);
break;
case WCD9335_AMIC_PWR_LEVEL_HP:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD9335_DEC_PWR_LVL_MASK,
- WCD9335_DEC_PWR_LVL_HP);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ WCD9335_DEC_PWR_LVL_MASK,
+ WCD9335_DEC_PWR_LVL_HP);
break;
case WCD9335_AMIC_PWR_LEVEL_DEFAULT:
default:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD9335_DEC_PWR_LVL_MASK,
- WCD9335_DEC_PWR_LVL_DF);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ WCD9335_DEC_PWR_LVL_MASK,
+ WCD9335_DEC_PWR_LVL_DF);
break;
}
}
- hpf_cut_off_freq = (snd_soc_read(codec, dec_cfg_reg) &
+ hpf_cut_off_freq = (
+ snd_soc_component_read32(component, dec_cfg_reg) &
TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
tasha->tx_hpf_work[decimator].hpf_cut_off_freq =
hpf_cut_off_freq;
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ)
- snd_soc_update_bits(codec, dec_cfg_reg,
+ snd_soc_component_update_bits(component, dec_cfg_reg,
TX_HPF_CUT_OFF_FREQ_MASK,
CF_MIN_3DB_150HZ << 5);
/* Enable TX PGA Mute */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec, hpf_gate_reg, 0x01, 0x00);
+ snd_soc_component_update_bits(component, hpf_gate_reg,
+ 0x01, 0x00);
if (decimator == 0) {
- snd_soc_write(codec, WCD9335_MBHC_ZDET_RAMP_CTL, 0x83);
- snd_soc_write(codec, WCD9335_MBHC_ZDET_RAMP_CTL, 0xA3);
- snd_soc_write(codec, WCD9335_MBHC_ZDET_RAMP_CTL, 0x83);
- snd_soc_write(codec, WCD9335_MBHC_ZDET_RAMP_CTL, 0x03);
+ snd_soc_component_write(component,
+ WCD9335_MBHC_ZDET_RAMP_CTL, 0x83);
+ snd_soc_component_write(component,
+ WCD9335_MBHC_ZDET_RAMP_CTL, 0xA3);
+ snd_soc_component_write(component,
+ WCD9335_MBHC_ZDET_RAMP_CTL, 0x83);
+ snd_soc_component_write(component,
+ WCD9335_MBHC_ZDET_RAMP_CTL, 0x03);
}
/* schedule work queue to Remove Mute */
schedule_delayed_work(&tasha->tx_mute_dwork[decimator].dwork,
@@ -5769,28 +5993,32 @@
&tasha->tx_hpf_work[decimator].dwork,
msecs_to_jiffies(300));
/* apply gain after decimator is enabled */
- snd_soc_write(codec, tx_gain_ctl_reg,
- snd_soc_read(codec, tx_gain_ctl_reg));
+ snd_soc_component_write(component, tx_gain_ctl_reg,
+ snd_soc_component_read32(
+ component, tx_gain_ctl_reg));
break;
case SND_SOC_DAPM_PRE_PMD:
hpf_cut_off_freq =
tasha->tx_hpf_work[decimator].hpf_cut_off_freq;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x10);
if (cancel_delayed_work_sync(
&tasha->tx_hpf_work[decimator].dwork)) {
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- tasha_codec_vote_max_bw(codec, true);
- snd_soc_update_bits(codec, dec_cfg_reg,
- TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- tasha_codec_vote_max_bw(codec, false);
+ tasha_codec_vote_max_bw(component, true);
+ snd_soc_component_update_bits(component,
+ dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ tasha_codec_vote_max_bw(component, false);
}
}
cancel_delayed_work_sync(
&tasha->tx_mute_dwork[decimator].dwork);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x00);
break;
};
out:
@@ -5798,7 +6026,7 @@
return ret;
}
-static u32 tasha_get_dmic_sample_rate(struct snd_soc_codec *codec,
+static u32 tasha_get_dmic_sample_rate(struct snd_soc_component *component,
unsigned int dmic, struct wcd9xxx_pdata *pdata)
{
u8 tx_stream_fs;
@@ -5811,13 +6039,13 @@
if (adc_mux_index < 4) {
adc_mux_ctl_reg = WCD9335_CDC_TX_INP_MUX_ADC_MUX0_CFG0 +
(adc_mux_index * 2);
- adc_mux_sel = ((snd_soc_read(codec, adc_mux_ctl_reg) &
- 0x78) >> 3) - 1;
+ adc_mux_sel = ((snd_soc_component_read32(component,
+ adc_mux_ctl_reg) & 0x78) >> 3) - 1;
} else if (adc_mux_index < 9) {
adc_mux_ctl_reg = WCD9335_CDC_TX_INP_MUX_ADC_MUX4_CFG0 +
((adc_mux_index - 4) * 1);
- adc_mux_sel = ((snd_soc_read(codec, adc_mux_ctl_reg) &
- 0x38) >> 3) - 1;
+ adc_mux_sel = ((snd_soc_component_read32(
+ component, adc_mux_ctl_reg) & 0x38) >> 3) - 1;
} else if (adc_mux_index == 9) {
++adc_mux_index;
continue;
@@ -5830,7 +6058,8 @@
if (dec_found == true && adc_mux_index <= 8) {
tx_fs_reg = WCD9335_CDC_TX0_TX_PATH_CTL + (16 * adc_mux_index);
- tx_stream_fs = snd_soc_read(codec, tx_fs_reg) & 0x0F;
+ tx_stream_fs =
+ snd_soc_component_read32(component, tx_fs_reg) & 0x0F;
dmic_fs = tx_stream_fs <= 4 ? WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ :
WCD9XXX_DMIC_SAMPLE_RATE_4P8MHZ;
@@ -5839,10 +6068,12 @@
* any other audio path to apply ECPP DMIC sample rate
*/
if ((adc_mux_index == 1) &&
- ((snd_soc_read(codec, WCD9335_CPE_SS_US_EC_MUX_CFG)
- & 0x0F) == 0x0A) &&
- ((snd_soc_read(codec, WCD9335_CDC_IF_ROUTER_TX_MUX_CFG0)
- & 0x0C) == 0x00)) {
+ ((snd_soc_component_read32(
+ component, WCD9335_CPE_SS_US_EC_MUX_CFG)
+ & 0x0F) == 0x0A) &&
+ ((snd_soc_component_read32(
+ component, WCD9335_CDC_IF_ROUTER_TX_MUX_CFG0)
+ & 0x0C) == 0x00)) {
dmic_fs = pdata->ecpp_dmic_sample_rate;
}
} else {
@@ -5852,13 +6083,13 @@
return dmic_fs;
}
-static u8 tasha_get_dmic_clk_val(struct snd_soc_codec *codec,
+static u8 tasha_get_dmic_clk_val(struct snd_soc_component *component,
u32 mclk_rate, u32 dmic_clk_rate)
{
u32 div_factor;
u8 dmic_ctl_val;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: mclk_rate = %d, dmic_sample_rate = %d\n",
__func__, mclk_rate, dmic_clk_rate);
@@ -5869,7 +6100,7 @@
dmic_ctl_val = WCD9335_DMIC_CLK_DIV_3;
if (dmic_clk_rate == 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: dmic_sample_rate cannot be 0\n",
__func__);
goto done;
@@ -5896,7 +6127,7 @@
dmic_ctl_val = WCD9335_DMIC_CLK_DIV_16;
break;
default:
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid div_factor %u, clk_rate(%u), dmic_rate(%u)\n",
__func__, div_factor, mclk_rate, dmic_clk_rate);
break;
@@ -5909,13 +6140,14 @@
static int tasha_codec_enable_adc(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s: event:%d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event:%d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- tasha_codec_set_tx_hold(codec, w->reg, true);
+ tasha_codec_set_tx_hold(component, w->reg, true);
break;
default:
break;
@@ -5927,9 +6159,10 @@
static int tasha_codec_enable_dmic(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx_pdata *pdata = dev_get_platdata(component->dev->parent);
u8 dmic_clk_en = 0x01;
u16 dmic_clk_reg;
s32 *dmic_clk_cnt;
@@ -5941,13 +6174,13 @@
wname = strpbrk(w->name, "012345");
if (!wname) {
- dev_err(codec->dev, "%s: widget not found\n", __func__);
+ dev_err(component->dev, "%s: widget not found\n", __func__);
return -EINVAL;
}
ret = kstrtouint(wname, 10, &dmic);
if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid DMIC line on the codec\n",
+ dev_err(component->dev, "%s: Invalid DMIC line on the codec\n",
__func__);
return -EINVAL;
}
@@ -5969,42 +6202,42 @@
dmic_clk_reg = WCD9335_CPE_SS_DMIC2_CTL;
break;
default:
- dev_err(codec->dev, "%s: Invalid DMIC Selection\n",
+ dev_err(component->dev, "%s: Invalid DMIC Selection\n",
__func__);
return -EINVAL;
};
- dev_dbg(codec->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
+ dev_dbg(component->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
__func__, event, dmic, *dmic_clk_cnt);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- dmic_sample_rate = tasha_get_dmic_sample_rate(codec, dmic,
+ dmic_sample_rate = tasha_get_dmic_sample_rate(component, dmic,
pdata);
dmic_rate_val =
- tasha_get_dmic_clk_val(codec,
+ tasha_get_dmic_clk_val(component,
pdata->mclk_rate,
dmic_sample_rate);
(*dmic_clk_cnt)++;
if (*dmic_clk_cnt == 1) {
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
0x07 << dmic_rate_shift,
dmic_rate_val << dmic_rate_shift);
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
dmic_clk_en, dmic_clk_en);
}
break;
case SND_SOC_DAPM_POST_PMD:
dmic_rate_val =
- tasha_get_dmic_clk_val(codec,
+ tasha_get_dmic_clk_val(component,
pdata->mclk_rate,
pdata->mad_dmic_sample_rate);
(*dmic_clk_cnt)--;
if (*dmic_clk_cnt == 0) {
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
dmic_clk_en, 0);
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
0x07 << dmic_rate_shift,
dmic_rate_val << dmic_rate_shift);
}
@@ -6017,10 +6250,11 @@
static int __tasha_codec_enable_micbias(struct snd_soc_dapm_widget *w,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int micb_num;
- dev_dbg(codec->dev, "%s: wname: %s, event: %d\n",
+ dev_dbg(component->dev, "%s: wname: %s, event: %d\n",
__func__, w->name, event);
if (strnstr(w->name, "MIC BIAS1", sizeof("MIC BIAS1")))
@@ -6041,14 +6275,14 @@
* so use ref count to handle micbias pullup
* and enable requests
*/
- tasha_micbias_control(codec, micb_num, MICB_ENABLE, true);
+ tasha_micbias_control(component, micb_num, MICB_ENABLE, true);
break;
case SND_SOC_DAPM_POST_PMU:
/* wait for cnp time */
usleep_range(1000, 1100);
break;
case SND_SOC_DAPM_POST_PMD:
- tasha_micbias_control(codec, micb_num, MICB_DISABLE, true);
+ tasha_micbias_control(component, micb_num, MICB_DISABLE, true);
break;
};
@@ -6058,15 +6292,17 @@
static int tasha_codec_ldo_h_control(struct snd_soc_dapm_widget *w,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
if (SND_SOC_DAPM_EVENT_ON(event)) {
tasha->ldo_h_users++;
if (tasha->ldo_h_users == 1)
- snd_soc_update_bits(codec, WCD9335_LDOH_MODE,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9335_LDOH_MODE,
+ 0x80, 0x80);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
@@ -6076,8 +6312,9 @@
tasha->ldo_h_users = 0;
if (tasha->ldo_h_users == 0)
- snd_soc_update_bits(codec, WCD9335_LDOH_MODE,
- 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_LDOH_MODE,
+ 0x80, 0x00);
}
return 0;
@@ -6087,8 +6324,9 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
@@ -6109,17 +6347,18 @@
int event)
{
int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
wcd_resmgr_enable_master_bias(tasha->resmgr);
- tasha_cdc_mclk_enable(codec, true, true);
+ tasha_cdc_mclk_enable(component, true, true);
ret = __tasha_codec_enable_micbias(w, SND_SOC_DAPM_PRE_PMU);
/* Wait for 1ms for better cnp */
usleep_range(1000, 1100);
- tasha_cdc_mclk_enable(codec, false, true);
+ tasha_cdc_mclk_enable(component, false, true);
break;
case SND_SOC_DAPM_POST_PMD:
ret = __tasha_codec_enable_micbias(w, SND_SOC_DAPM_POST_PMD);
@@ -6136,24 +6375,25 @@
return __tasha_codec_enable_micbias(w, event);
}
-static int tasha_codec_enable_standalone_ldo_h(struct snd_soc_codec *codec,
- bool enable)
+static int tasha_codec_enable_standalone_ldo_h(
+ struct snd_soc_component *component,
+ bool enable)
{
int rc;
if (enable)
rc = snd_soc_dapm_force_enable_pin(
- snd_soc_codec_get_dapm(codec),
+ snd_soc_component_get_dapm(component),
DAPM_LDO_H_STANDALONE);
else
rc = snd_soc_dapm_disable_pin(
- snd_soc_codec_get_dapm(codec),
+ snd_soc_component_get_dapm(component),
DAPM_LDO_H_STANDALONE);
if (!rc)
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(snd_soc_component_get_dapm(component));
else
- dev_err(codec->dev, "%s: ldo_h force %s pin failed\n",
+ dev_err(component->dev, "%s: ldo_h force %s pin failed\n",
__func__, (enable ? "enable" : "disable"));
return rc;
@@ -6161,7 +6401,7 @@
/*
* tasha_codec_enable_standalone_micbias - enable micbias standalone
- * @codec: pointer to codec instance
+ * @component: pointer to codec instance
* @micb_num: number of micbias to be enabled
* @enable: true to enable micbias or false to disable
*
@@ -6170,7 +6410,7 @@
*
* Return: error code in case of failure or 0 for success
*/
-int tasha_codec_enable_standalone_micbias(struct snd_soc_codec *codec,
+int tasha_codec_enable_standalone_micbias(struct snd_soc_component *component,
int micb_num,
bool enable)
{
@@ -6181,29 +6421,30 @@
int micb_index = micb_num - 1;
int rc;
- if (!codec) {
- pr_err("%s: Codec memory is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: Component memory is NULL\n", __func__);
return -EINVAL;
}
if ((micb_index < 0) || (micb_index > TASHA_MAX_MICBIAS - 1)) {
- dev_err(codec->dev, "%s: Invalid micbias index, micb_ind:%d\n",
+ dev_err(component->dev, "%s: Invalid micbias index, micb_ind:%d\n",
__func__, micb_index);
return -EINVAL;
}
if (enable)
rc = snd_soc_dapm_force_enable_pin(
- snd_soc_codec_get_dapm(codec),
- micb_names[micb_index]);
+ snd_soc_component_get_dapm(component),
+ micb_names[micb_index]);
else
- rc = snd_soc_dapm_disable_pin(snd_soc_codec_get_dapm(codec),
- micb_names[micb_index]);
+ rc = snd_soc_dapm_disable_pin(
+ snd_soc_component_get_dapm(component),
+ micb_names[micb_index]);
if (!rc)
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(snd_soc_component_get_dapm(component));
else
- dev_err(codec->dev, "%s: micbias%d force %s pin failed\n",
+ dev_err(component->dev, "%s: micbias%d force %s pin failed\n",
__func__, micb_num, (enable ? "enable" : "disable"));
return rc;
@@ -7630,7 +7871,8 @@
static int tasha_amic_pwr_lvl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u16 amic_reg;
if (!strcmp(kcontrol->id.name, "AMIC_1_2 PWR MODE"))
@@ -7641,8 +7883,9 @@
amic_reg = WCD9335_ANA_AMIC5;
ucontrol->value.integer.value[0] =
- (snd_soc_read(codec, amic_reg) & WCD9335_AMIC_PWR_LVL_MASK) >>
- WCD9335_AMIC_PWR_LVL_SHIFT;
+ (snd_soc_component_read32(component, amic_reg) &
+ WCD9335_AMIC_PWR_LVL_MASK) >>
+ WCD9335_AMIC_PWR_LVL_SHIFT;
return 0;
}
@@ -7650,13 +7893,14 @@
static int tasha_amic_pwr_lvl_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u32 mode_val;
u16 amic_reg;
mode_val = ucontrol->value.enumerated.item[0];
- dev_dbg(codec->dev, "%s: mode: %d\n",
+ dev_dbg(component->dev, "%s: mode: %d\n",
__func__, mode_val);
if (!strcmp(kcontrol->id.name, "AMIC_1_2 PWR MODE"))
@@ -7666,8 +7910,9 @@
if (!strcmp(kcontrol->id.name, "AMIC_5_6 PWR MODE"))
amic_reg = WCD9335_ANA_AMIC5;
- snd_soc_update_bits(codec, amic_reg, WCD9335_AMIC_PWR_LVL_MASK,
- mode_val << WCD9335_AMIC_PWR_LVL_SHIFT);
+ snd_soc_component_update_bits(component, amic_reg,
+ WCD9335_AMIC_PWR_LVL_MASK,
+ mode_val << WCD9335_AMIC_PWR_LVL_SHIFT);
return 0;
}
@@ -7675,8 +7920,9 @@
static int tasha_rx_hph_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tasha->hph_mode;
return 0;
@@ -7685,17 +7931,18 @@
static int tasha_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u32 mode_val;
mode_val = ucontrol->value.enumerated.item[0];
- dev_dbg(codec->dev, "%s: mode: %d\n",
+ dev_dbg(component->dev, "%s: mode: %d\n",
__func__, mode_val);
if (mode_val == 0) {
- dev_warn(codec->dev, "%s:Invalid HPH Mode, default to Cls-H HiFi\n",
+ dev_warn(component->dev, "%s:Invalid HPH Mode, default to Cls-H HiFi\n",
__func__);
mode_val = CLS_H_HIFI;
}
@@ -7716,11 +7963,13 @@
static int tasha_enable_ldo_h_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u8 val = 0;
- if (codec)
- val = snd_soc_read(codec, WCD9335_LDOH_MODE) & 0x80;
+ if (component)
+ val = snd_soc_component_read32(component, WCD9335_LDOH_MODE) &
+ 0x80;
ucontrol->value.integer.value[0] = !!val;
@@ -7730,13 +7979,14 @@
static int tasha_enable_ldo_h_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int value = ucontrol->value.integer.value[0];
bool enable;
enable = !!value;
- if (codec)
- tasha_codec_enable_standalone_ldo_h(codec, enable);
+ if (component)
+ tasha_codec_enable_standalone_ldo_h(component, enable);
return 0;
}
@@ -7745,13 +7995,14 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 tasha_mad_input;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- tasha_mad_input = snd_soc_read(codec,
+ tasha_mad_input = snd_soc_component_read32(component,
WCD9335_SOC_MAD_INP_SEL) & 0x0F;
ucontrol->value.integer.value[0] = tasha_mad_input;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: tasha_mad_input = %s\n", __func__,
tasha_conn_mad_text[tasha_mad_input]);
return 0;
@@ -7761,8 +8012,9 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 tasha_mad_input;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct snd_soc_card *card = codec->component.card;
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_card *card = component->card;
char mad_amic_input_widget[6];
const char *mad_input_widget;
const char *source_widget = NULL;
@@ -7773,7 +8025,7 @@
tasha_mad_input = ucontrol->value.integer.value[0];
if (tasha_mad_input >= ARRAY_SIZE(tasha_conn_mad_text)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: tasha_mad_input = %d out of bounds\n",
__func__, tasha_mad_input);
return -EINVAL;
@@ -7783,7 +8035,7 @@
!strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED2") ||
!strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED3") ||
!strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED4")) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Unsupported tasha_mad_input = %s\n",
__func__, tasha_conn_mad_text[tasha_mad_input]);
return -EINVAL;
@@ -7794,14 +8046,14 @@
mad_input = strpbrk(tasha_conn_mad_text[tasha_mad_input],
"123456");
if (!mad_input) {
- dev_err(codec->dev, "%s: Invalid MAD input %s\n",
+ dev_err(component->dev, "%s: Invalid MAD input %s\n",
__func__,
tasha_conn_mad_text[tasha_mad_input]);
return -EINVAL;
}
ret = kstrtouint(mad_input, 10, &adc);
if ((ret < 0) || (adc > 6)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid ADC = %s\n", __func__,
tasha_conn_mad_text[tasha_mad_input]);
ret = -EINVAL;
@@ -7815,7 +8067,7 @@
mad_input_widget = tasha_conn_mad_text[tasha_mad_input];
}
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: tasha input widget = %s\n", __func__,
mad_input_widget);
@@ -7823,7 +8075,7 @@
if (!strcmp(card->of_dapm_routes[i].sink, mad_input_widget)) {
source_widget = card->of_dapm_routes[i].source;
if (!source_widget) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: invalid source widget\n",
__func__);
return -EINVAL;
@@ -7850,19 +8102,19 @@
}
if (!mic_bias_found) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: mic bias source not found for input = %s\n",
__func__, mad_input_widget);
return -EINVAL;
}
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: mic_bias found = %d\n", __func__,
mic_bias_found);
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_INP_SEL,
+ snd_soc_component_update_bits(component, WCD9335_SOC_MAD_INP_SEL,
0x0F, tasha_mad_input);
- snd_soc_update_bits(codec, WCD9335_ANA_MAD_SETUP,
+ snd_soc_component_update_bits(component, WCD9335_ANA_MAD_SETUP,
0x07, mic_bias_found);
return 0;
@@ -7871,7 +8123,8 @@
static int tasha_pinctl_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u16 ctl_reg;
u8 reg_val, pinctl_position;
@@ -7891,12 +8144,12 @@
ctl_reg = WCD9335_TEST_DEBUG_PIN_CTL_OE_3;
break;
default:
- dev_err(codec->dev, "%s: Invalid pinctl position = %d\n",
+ dev_err(component->dev, "%s: Invalid pinctl position = %d\n",
__func__, pinctl_position);
return -EINVAL;
}
- reg_val = snd_soc_read(codec, ctl_reg);
+ reg_val = snd_soc_component_read32(component, ctl_reg);
reg_val = (reg_val >> (pinctl_position & 0x07)) & 0x1;
ucontrol->value.integer.value[0] = reg_val;
@@ -7906,8 +8159,9 @@
static int tasha_pinctl_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u16 ctl_reg, cfg_reg;
u8 ctl_val, cfg_val, pinctl_position, pinctl_mode, mask;
@@ -7930,14 +8184,14 @@
ctl_reg = WCD9335_TEST_DEBUG_PIN_CTL_OE_3;
break;
default:
- dev_err(codec->dev, "%s: Invalid pinctl position = %d\n",
+ dev_err(component->dev, "%s: Invalid pinctl position = %d\n",
__func__, pinctl_position);
return -EINVAL;
}
ctl_val = pinctl_mode << (pinctl_position & 0x07);
mask = 1 << (pinctl_position & 0x07);
- snd_soc_update_bits(codec, ctl_reg, mask, ctl_val);
+ snd_soc_component_update_bits(component, ctl_reg, mask, ctl_val);
cfg_reg = WCD9335_TLMM_BIST_MODE_PINCFG + pinctl_position;
if (!pinctl_mode) {
@@ -7948,16 +8202,16 @@
} else {
cfg_val = 0;
}
- snd_soc_update_bits(codec, cfg_reg, 0x07, cfg_val);
+ snd_soc_component_update_bits(component, cfg_reg, 0x07, cfg_val);
- dev_dbg(codec->dev, "%s: reg=0x%x mask=0x%x val=%d reg=0x%x val=%d\n",
+ dev_dbg(component->dev, "%s: reg=0x%x mask=0x%x val=%d reg=0x%x val=%d\n",
__func__, ctl_reg, mask, ctl_val, cfg_reg, cfg_val);
return 0;
}
static void wcd_vbat_adc_out_config_2_0(struct wcd_vbat *vbat,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
u8 val1, val2;
@@ -7965,51 +8219,65 @@
* Measure dcp1 by using "ALT" branch of band gap
* voltage(Vbg) and use it in FAST mode
*/
- snd_soc_update_bits(codec, WCD9335_BIAS_CTL, 0x82, 0x82);
- snd_soc_update_bits(codec, WCD9335_CDC_VBAT_VBAT_PATH_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec, WCD9335_CDC_VBAT_VBAT_DEBUG1, 0x01, 0x01);
- snd_soc_update_bits(codec, WCD9335_ANA_VBADC, 0x80, 0x80);
- snd_soc_update_bits(codec, WCD9335_VBADC_SUBBLOCK_EN, 0x20, 0x00);
-
- snd_soc_update_bits(codec, WCD9335_VBADC_FE_CTRL, 0x20, 0x20);
+ snd_soc_component_update_bits(component, WCD9335_BIAS_CTL,
+ 0x82, 0x82);
+ snd_soc_component_update_bits(component, WCD9335_CDC_VBAT_VBAT_PATH_CTL,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component, WCD9335_CDC_VBAT_VBAT_DEBUG1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD9335_ANA_VBADC,
+ 0x80, 0x80);
+ snd_soc_component_update_bits(component, WCD9335_VBADC_SUBBLOCK_EN,
+ 0x20, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_VBADC_FE_CTRL,
+ 0x20, 0x20);
/* Wait 100 usec after calibration select as Vbg */
usleep_range(100, 110);
- snd_soc_update_bits(codec, WCD9335_VBADC_ADC_IO, 0x40, 0x40);
- val1 = snd_soc_read(codec, WCD9335_VBADC_ADC_DOUTMSB);
- val2 = snd_soc_read(codec, WCD9335_VBADC_ADC_DOUTLSB);
- snd_soc_update_bits(codec, WCD9335_VBADC_ADC_IO, 0x40, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_VBADC_ADC_IO,
+ 0x40, 0x40);
+ val1 = snd_soc_component_read32(component, WCD9335_VBADC_ADC_DOUTMSB);
+ val2 = snd_soc_component_read32(component, WCD9335_VBADC_ADC_DOUTLSB);
+ snd_soc_component_update_bits(component, WCD9335_VBADC_ADC_IO,
+ 0x40, 0x00);
vbat->dcp1 = (((val1 & 0xFF) << 3) | (val2 & 0x07));
- snd_soc_update_bits(codec, WCD9335_BIAS_CTL, 0x40, 0x40);
+ snd_soc_component_update_bits(component, WCD9335_BIAS_CTL, 0x40, 0x40);
/* Wait 100 usec after selecting Vbg as 1.05V */
usleep_range(100, 110);
- snd_soc_update_bits(codec, WCD9335_VBADC_ADC_IO, 0x40, 0x40);
- val1 = snd_soc_read(codec, WCD9335_VBADC_ADC_DOUTMSB);
- val2 = snd_soc_read(codec, WCD9335_VBADC_ADC_DOUTLSB);
- snd_soc_update_bits(codec, WCD9335_VBADC_ADC_IO, 0x40, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_VBADC_ADC_IO,
+ 0x40, 0x40);
+ val1 = snd_soc_component_read32(component, WCD9335_VBADC_ADC_DOUTMSB);
+ val2 = snd_soc_component_read32(component, WCD9335_VBADC_ADC_DOUTLSB);
+ snd_soc_component_update_bits(component, WCD9335_VBADC_ADC_IO,
+ 0x40, 0x00);
vbat->dcp2 = (((val1 & 0xFF) << 3) | (val2 & 0x07));
- dev_dbg(codec->dev, "%s: dcp1:0x%x, dcp2:0x%x\n",
+ dev_dbg(component->dev, "%s: dcp1:0x%x, dcp2:0x%x\n",
__func__, vbat->dcp1, vbat->dcp2);
- snd_soc_write(codec, WCD9335_BIAS_CTL, 0x28);
+ snd_soc_component_write(component, WCD9335_BIAS_CTL, 0x28);
/* Wait 100 usec after selecting Vbg as 0.85V */
usleep_range(100, 110);
- snd_soc_update_bits(codec, WCD9335_VBADC_FE_CTRL, 0x20, 0x00);
- snd_soc_update_bits(codec, WCD9335_VBADC_SUBBLOCK_EN, 0x20, 0x20);
- snd_soc_update_bits(codec, WCD9335_ANA_VBADC, 0x80, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_VBADC_FE_CTRL,
+ 0x20, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_VBADC_SUBBLOCK_EN,
+ 0x20, 0x20);
+ snd_soc_component_update_bits(component, WCD9335_ANA_VBADC,
+ 0x80, 0x00);
- snd_soc_update_bits(codec, WCD9335_CDC_VBAT_VBAT_PATH_CTL, 0x10, 0x00);
- snd_soc_update_bits(codec, WCD9335_CDC_VBAT_VBAT_DEBUG1, 0x01, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_CDC_VBAT_VBAT_PATH_CTL,
+ 0x10, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_CDC_VBAT_VBAT_DEBUG1,
+ 0x01, 0x00);
}
static void wcd_vbat_adc_out_config_1_x(struct wcd_vbat *vbat,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
u8 val1, val2;
@@ -8017,29 +8285,30 @@
* Measure dcp1 by applying band gap voltage(Vbg)
* of 0.85V
*/
- snd_soc_write(codec, WCD9335_ANA_BIAS, 0x20);
- snd_soc_write(codec, WCD9335_BIAS_CTL, 0x28);
- snd_soc_write(codec, WCD9335_BIAS_VBG_FINE_ADJ, 0x05);
- snd_soc_write(codec, WCD9335_ANA_BIAS, 0xA0);
+ snd_soc_component_write(component, WCD9335_ANA_BIAS, 0x20);
+ snd_soc_component_write(component, WCD9335_BIAS_CTL, 0x28);
+ snd_soc_component_write(component, WCD9335_BIAS_VBG_FINE_ADJ, 0x05);
+ snd_soc_component_write(component, WCD9335_ANA_BIAS, 0xA0);
/* Wait 2 sec after enabling band gap bias */
usleep_range(2000000, 2000100);
- snd_soc_write(codec, WCD9335_ANA_CLK_TOP, 0x82);
- snd_soc_write(codec, WCD9335_ANA_CLK_TOP, 0x87);
- snd_soc_update_bits(codec, WCD9335_CDC_VBAT_VBAT_PATH_CTL, 0x10, 0x10);
- snd_soc_write(codec, WCD9335_CDC_VBAT_VBAT_CFG, 0x0D);
- snd_soc_write(codec, WCD9335_CDC_VBAT_VBAT_DEBUG1, 0x01);
+ snd_soc_component_write(component, WCD9335_ANA_CLK_TOP, 0x82);
+ snd_soc_component_write(component, WCD9335_ANA_CLK_TOP, 0x87);
+ snd_soc_component_update_bits(component, WCD9335_CDC_VBAT_VBAT_PATH_CTL,
+ 0x10, 0x10);
+ snd_soc_component_write(component, WCD9335_CDC_VBAT_VBAT_CFG, 0x0D);
+ snd_soc_component_write(component, WCD9335_CDC_VBAT_VBAT_DEBUG1, 0x01);
- snd_soc_write(codec, WCD9335_ANA_VBADC, 0x80);
- snd_soc_write(codec, WCD9335_VBADC_SUBBLOCK_EN, 0xDE);
- snd_soc_write(codec, WCD9335_VBADC_FE_CTRL, 0x3C);
+ snd_soc_component_write(component, WCD9335_ANA_VBADC, 0x80);
+ snd_soc_component_write(component, WCD9335_VBADC_SUBBLOCK_EN, 0xDE);
+ snd_soc_component_write(component, WCD9335_VBADC_FE_CTRL, 0x3C);
/* Wait 1 msec after calibration select as Vbg */
usleep_range(1000, 1100);
- snd_soc_write(codec, WCD9335_VBADC_ADC_IO, 0xC0);
- val1 = snd_soc_read(codec, WCD9335_VBADC_ADC_DOUTMSB);
- val2 = snd_soc_read(codec, WCD9335_VBADC_ADC_DOUTLSB);
- snd_soc_write(codec, WCD9335_VBADC_ADC_IO, 0x80);
+ snd_soc_component_write(component, WCD9335_VBADC_ADC_IO, 0xC0);
+ val1 = snd_soc_component_read32(component, WCD9335_VBADC_ADC_DOUTMSB);
+ val2 = snd_soc_component_read32(component, WCD9335_VBADC_ADC_DOUTLSB);
+ snd_soc_component_write(component, WCD9335_VBADC_ADC_IO, 0x80);
vbat->dcp1 = (((val1 & 0xFF) << 3) | (val2 & 0x07));
@@ -8047,69 +8316,70 @@
* Measure dcp2 by applying band gap voltage(Vbg)
* of 1.05V
*/
- snd_soc_write(codec, WCD9335_ANA_BIAS, 0x80);
- snd_soc_write(codec, WCD9335_ANA_BIAS, 0xC0);
- snd_soc_write(codec, WCD9335_BIAS_CTL, 0x68);
+ snd_soc_component_write(component, WCD9335_ANA_BIAS, 0x80);
+ snd_soc_component_write(component, WCD9335_ANA_BIAS, 0xC0);
+ snd_soc_component_write(component, WCD9335_BIAS_CTL, 0x68);
/* Wait 2 msec after selecting Vbg as 1.05V */
usleep_range(2000, 2100);
- snd_soc_write(codec, WCD9335_ANA_BIAS, 0x80);
+ snd_soc_component_write(component, WCD9335_ANA_BIAS, 0x80);
/* Wait 1 sec after enabling band gap bias */
usleep_range(1000000, 1000100);
- snd_soc_write(codec, WCD9335_VBADC_ADC_IO, 0xC0);
- val1 = snd_soc_read(codec, WCD9335_VBADC_ADC_DOUTMSB);
- val2 = snd_soc_read(codec, WCD9335_VBADC_ADC_DOUTLSB);
- snd_soc_write(codec, WCD9335_VBADC_ADC_IO, 0x80);
+ snd_soc_component_write(component, WCD9335_VBADC_ADC_IO, 0xC0);
+ val1 = snd_soc_component_read32(component, WCD9335_VBADC_ADC_DOUTMSB);
+ val2 = snd_soc_component_read32(component, WCD9335_VBADC_ADC_DOUTLSB);
+ snd_soc_component_write(component, WCD9335_VBADC_ADC_IO, 0x80);
vbat->dcp2 = (((val1 & 0xFF) << 3) | (val2 & 0x07));
- dev_dbg(codec->dev, "%s: dcp1:0x%x, dcp2:0x%x\n",
+ dev_dbg(component->dev, "%s: dcp1:0x%x, dcp2:0x%x\n",
__func__, vbat->dcp1, vbat->dcp2);
/* Reset the Vbat ADC configuration */
- snd_soc_write(codec, WCD9335_ANA_BIAS, 0x80);
- snd_soc_write(codec, WCD9335_ANA_BIAS, 0xC0);
+ snd_soc_component_write(component, WCD9335_ANA_BIAS, 0x80);
+ snd_soc_component_write(component, WCD9335_ANA_BIAS, 0xC0);
- snd_soc_write(codec, WCD9335_BIAS_CTL, 0x28);
+ snd_soc_component_write(component, WCD9335_BIAS_CTL, 0x28);
/* Wait 2 msec after selecting Vbg as 0.85V */
usleep_range(2000, 2100);
- snd_soc_write(codec, WCD9335_ANA_BIAS, 0xA0);
+ snd_soc_component_write(component, WCD9335_ANA_BIAS, 0xA0);
/* Wait 1 sec after enabling band gap bias */
usleep_range(1000000, 1000100);
- snd_soc_write(codec, WCD9335_VBADC_FE_CTRL, 0x1C);
- snd_soc_write(codec, WCD9335_VBADC_SUBBLOCK_EN, 0xFE);
- snd_soc_write(codec, WCD9335_VBADC_ADC_IO, 0x80);
- snd_soc_write(codec, WCD9335_ANA_VBADC, 0x00);
+ snd_soc_component_write(component, WCD9335_VBADC_FE_CTRL, 0x1C);
+ snd_soc_component_write(component, WCD9335_VBADC_SUBBLOCK_EN, 0xFE);
+ snd_soc_component_write(component, WCD9335_VBADC_ADC_IO, 0x80);
+ snd_soc_component_write(component, WCD9335_ANA_VBADC, 0x00);
- snd_soc_write(codec, WCD9335_CDC_VBAT_VBAT_DEBUG1, 0x00);
- snd_soc_write(codec, WCD9335_CDC_VBAT_VBAT_PATH_CTL, 0x00);
- snd_soc_write(codec, WCD9335_CDC_VBAT_VBAT_CFG, 0x0A);
+ snd_soc_component_write(component, WCD9335_CDC_VBAT_VBAT_DEBUG1, 0x00);
+ snd_soc_component_write(component, WCD9335_CDC_VBAT_VBAT_PATH_CTL,
+ 0x00);
+ snd_soc_component_write(component, WCD9335_CDC_VBAT_VBAT_CFG, 0x0A);
}
static void wcd_vbat_adc_out_config(struct wcd_vbat *vbat,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
if (!vbat->adc_config) {
- tasha_cdc_mclk_enable(codec, true, false);
+ tasha_cdc_mclk_enable(component, true, false);
if (TASHA_IS_2_0(wcd9xxx))
- wcd_vbat_adc_out_config_2_0(vbat, codec);
+ wcd_vbat_adc_out_config_2_0(vbat, component);
else
- wcd_vbat_adc_out_config_1_x(vbat, codec);
+ wcd_vbat_adc_out_config_1_x(vbat, component);
- tasha_cdc_mclk_enable(codec, false, false);
+ tasha_cdc_mclk_enable(component, false, false);
vbat->adc_config = true;
}
}
-static int tasha_update_vbat_reg_config(struct snd_soc_codec *codec)
+static int tasha_update_vbat_reg_config(struct snd_soc_component *component)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct firmware_cal *hwdep_cal = NULL;
struct vbat_monitor_reg *vbat_reg_ptr = NULL;
const void *data;
@@ -8123,17 +8393,17 @@
if (hwdep_cal) {
data = hwdep_cal->data;
cal_size = hwdep_cal->size;
- dev_dbg(codec->dev, "%s: using hwdep calibration\n",
+ dev_dbg(component->dev, "%s: using hwdep calibration\n",
__func__);
} else {
- dev_err(codec->dev, "%s: Vbat cal not received\n",
+ dev_err(component->dev, "%s: Vbat cal not received\n",
__func__);
ret = -EINVAL;
goto done;
}
if (cal_size < sizeof(*vbat_reg_ptr)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Incorrect size %zd for Vbat Cal, expected %zd\n",
__func__, cal_size, sizeof(*vbat_reg_ptr));
ret = -EINVAL;
@@ -8143,7 +8413,7 @@
vbat_reg_ptr = (struct vbat_monitor_reg *) (data);
if (!vbat_reg_ptr) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid calibration data for Vbat\n",
__func__);
ret = -EINVAL;
@@ -8152,7 +8422,7 @@
vbat_writes_size = vbat_reg_ptr->size;
vbat_size_remaining = cal_size - sizeof(u32);
- dev_dbg(codec->dev, "%s: vbat_writes_sz: %d, vbat_sz_remaining: %zd\n",
+ dev_dbg(component->dev, "%s: vbat_writes_sz: %d, vbat_sz_remaining: %zd\n",
__func__, vbat_writes_size, vbat_size_remaining);
if ((vbat_writes_size * TASHA_PACKED_REG_SIZE)
@@ -8165,8 +8435,9 @@
for (i = 0 ; i < vbat_writes_size; i++) {
TASHA_CODEC_UNPACK_ENTRY(vbat_reg_ptr->writes[i],
reg, mask, val);
- old_val = snd_soc_read(codec, reg);
- snd_soc_write(codec, reg, (old_val & ~mask) | (val & mask));
+ old_val = snd_soc_component_read32(component, reg);
+ snd_soc_component_write(component, reg, (old_val & ~mask) |
+ (val & mask));
}
done:
@@ -8176,15 +8447,16 @@
static int tasha_vbat_adc_data_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
- wcd_vbat_adc_out_config(&tasha->vbat, codec);
+ wcd_vbat_adc_out_config(&tasha->vbat, component);
ucontrol->value.integer.value[0] = tasha->vbat.dcp1;
ucontrol->value.integer.value[1] = tasha->vbat.dcp2;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: Vbat ADC output values, Dcp1 : %lu, Dcp2: %lu\n",
__func__, ucontrol->value.integer.value[0],
ucontrol->value.integer.value[1]);
@@ -8201,13 +8473,14 @@
static int tasha_vbat_gsm_mode_func_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
ucontrol->value.integer.value[0] =
- ((snd_soc_read(codec, WCD9335_CDC_VBAT_VBAT_CFG) & 0x04) ?
- 1 : 0);
+ ((snd_soc_component_read32(
+ component, WCD9335_CDC_VBAT_VBAT_CFG) & 0x04) ? 1 : 0);
- dev_dbg(codec->dev, "%s: value: %lu\n", __func__,
+ dev_dbg(component->dev, "%s: value: %lu\n", __func__,
ucontrol->value.integer.value[0]);
return 0;
@@ -8216,18 +8489,21 @@
static int tasha_vbat_gsm_mode_func_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: value: %lu\n", __func__,
+ dev_dbg(component->dev, "%s: value: %lu\n", __func__,
ucontrol->value.integer.value[0]);
/* Set Vbat register configuration for GSM mode bit based on value */
if (ucontrol->value.integer.value[0])
- snd_soc_update_bits(codec, WCD9335_CDC_VBAT_VBAT_CFG,
- 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_VBAT_VBAT_CFG,
+ 0x04, 0x04);
else
- snd_soc_update_bits(codec, WCD9335_CDC_VBAT_VBAT_CFG,
- 0x04, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_VBAT_VBAT_CFG,
+ 0x04, 0x00);
return 0;
}
@@ -8237,8 +8513,9 @@
int event)
{
int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u16 vbat_path_ctl, vbat_cfg, vbat_path_cfg;
vbat_path_ctl = WCD9335_CDC_VBAT_VBAT_PATH_CTL;
@@ -8256,25 +8533,31 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- ret = tasha_update_vbat_reg_config(codec);
+ ret = tasha_update_vbat_reg_config(component);
if (ret) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s : VBAT isn't calibrated, So not enabling it\n",
__func__);
return 0;
}
- snd_soc_write(codec, WCD9335_ANA_VBADC, 0x80);
- snd_soc_update_bits(codec, vbat_path_cfg, 0x02, 0x02);
- snd_soc_update_bits(codec, vbat_path_ctl, 0x10, 0x10);
- snd_soc_update_bits(codec, vbat_cfg, 0x01, 0x01);
+ snd_soc_component_write(component, WCD9335_ANA_VBADC, 0x80);
+ snd_soc_component_update_bits(component, vbat_path_cfg,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, vbat_path_ctl,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component, vbat_cfg, 0x01, 0x01);
tasha->vbat.is_enabled = true;
break;
case SND_SOC_DAPM_POST_PMD:
if (tasha->vbat.is_enabled) {
- snd_soc_update_bits(codec, vbat_cfg, 0x01, 0x00);
- snd_soc_update_bits(codec, vbat_path_ctl, 0x10, 0x00);
- snd_soc_update_bits(codec, vbat_path_cfg, 0x02, 0x00);
- snd_soc_write(codec, WCD9335_ANA_VBADC, 0x00);
+ snd_soc_component_update_bits(component, vbat_cfg,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component, vbat_path_ctl,
+ 0x10, 0x00);
+ snd_soc_component_update_bits(component, vbat_path_cfg,
+ 0x02, 0x00);
+ snd_soc_component_write(component, WCD9335_ANA_VBADC,
+ 0x00);
tasha->vbat.is_enabled = false;
}
break;
@@ -8531,8 +8814,9 @@
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val;
u16 mic_sel_reg;
@@ -8542,7 +8826,7 @@
if (val > e->items - 1)
return -EINVAL;
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: wname: %s, val: 0x%x\n", __func__,
widget->name, val);
switch (e->reg) {
@@ -8574,14 +8858,15 @@
mic_sel_reg = WCD9335_CDC_TX8_TX_PATH_CFG0;
break;
default:
- dev_err(codec->dev, "%s: e->reg: 0x%x not expected\n",
+ dev_err(component->dev, "%s: e->reg: 0x%x not expected\n",
__func__, e->reg);
return -EINVAL;
}
/* ADC: 0, DMIC: 1 */
mic_sel = val ? 0x0 : 0x1;
- snd_soc_update_bits(codec, mic_sel_reg, 1 << 7, mic_sel << 7);
+ snd_soc_component_update_bits(component, mic_sel_reg,
+ 1 << 7, mic_sel << 7);
return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
}
@@ -8590,8 +8875,9 @@
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val;
unsigned short look_ahead_dly_reg = WCD9335_CDC_RX0_RX_PATH_CFG0;
@@ -8600,7 +8886,7 @@
if (val >= e->items)
return -EINVAL;
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: wname: %s, val: 0x%x\n", __func__,
widget->name, val);
if (e->reg == WCD9335_CDC_RX0_RX_PATH_SEC0)
@@ -8611,7 +8897,7 @@
look_ahead_dly_reg = WCD9335_CDC_RX2_RX_PATH_CFG0;
/* Set Look Ahead Delay */
- snd_soc_update_bits(codec, look_ahead_dly_reg,
+ snd_soc_component_update_bits(component, look_ahead_dly_reg,
0x08, (val ? 0x08 : 0x00));
/* Set DEM INP Select */
return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
@@ -8621,15 +8907,16 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 ear_pa_gain;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- ear_pa_gain = snd_soc_read(codec, WCD9335_ANA_EAR);
+ ear_pa_gain = snd_soc_component_read32(component, WCD9335_ANA_EAR);
ear_pa_gain = (ear_pa_gain & 0x70) >> 4;
ucontrol->value.integer.value[0] = ear_pa_gain;
- dev_dbg(codec->dev, "%s: ear_pa_gain = 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: ear_pa_gain = 0x%x\n", __func__,
ear_pa_gain);
return 0;
@@ -8639,26 +8926,29 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 ear_pa_gain;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
ear_pa_gain = ucontrol->value.integer.value[0] << 4;
- snd_soc_update_bits(codec, WCD9335_ANA_EAR, 0x70, ear_pa_gain);
+ snd_soc_component_update_bits(component, WCD9335_ANA_EAR,
+ 0x70, ear_pa_gain);
return 0;
}
static int tasha_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tasha->ear_spkr_gain;
- dev_dbg(codec->dev, "%s: ear_spkr_gain = %ld\n", __func__,
+ dev_dbg(component->dev, "%s: ear_spkr_gain = %ld\n", __func__,
ucontrol->value.integer.value[0]);
return 0;
@@ -8667,10 +8957,11 @@
static int tasha_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
tasha->ear_spkr_gain = ucontrol->value.integer.value[0];
@@ -8682,12 +8973,14 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- bst_state_max = snd_soc_read(codec, WCD9335_CDC_BOOST0_BOOST_CTL);
+ bst_state_max = snd_soc_component_read32(
+ component, WCD9335_CDC_BOOST0_BOOST_CTL);
bst_state_max = (bst_state_max & 0x0c) >> 2;
ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -8697,12 +8990,13 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, WCD9335_CDC_BOOST0_BOOST_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CDC_BOOST0_BOOST_CTL,
0x0c, bst_state_max);
return 0;
@@ -8712,12 +9006,14 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- bst_state_max = snd_soc_read(codec, WCD9335_CDC_BOOST1_BOOST_CTL);
+ bst_state_max = snd_soc_component_read32(
+ component, WCD9335_CDC_BOOST1_BOOST_CTL);
bst_state_max = (bst_state_max & 0x0c) >> 2;
ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -8727,21 +9023,22 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, WCD9335_CDC_BOOST1_BOOST_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CDC_BOOST1_BOOST_CTL,
0x0c, bst_state_max);
return 0;
}
-static int tasha_config_compander(struct snd_soc_codec *codec, int interp_n,
- int event)
+static int tasha_config_compander(struct snd_soc_component *component,
+ int interp_n, int event)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int comp;
u16 comp_ctl0_reg, rx_path_cfg0_reg;
@@ -8750,7 +9047,7 @@
return 0;
comp = interp_n - 1;
- dev_dbg(codec->dev, "%s: event %d compander %d, enabled %d\n",
+ dev_dbg(component->dev, "%s: event %d compander %d, enabled %d\n",
__func__, event, comp + 1, tasha->comp_enabled[comp]);
if (!tasha->comp_enabled[comp])
@@ -8761,25 +9058,35 @@
if (SND_SOC_DAPM_EVENT_ON(event)) {
/* Enable Compander Clock */
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, rx_path_cfg0_reg,
+ 0x02, 0x02);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x04);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component, rx_path_cfg0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x04, 0x00);
}
return 0;
}
-static int tasha_codec_config_mad(struct snd_soc_codec *codec)
+static int tasha_codec_config_mad(struct snd_soc_component *component)
{
int ret = 0;
int idx;
@@ -8788,31 +9095,31 @@
struct wcd_mad_audio_cal *mad_cal = NULL;
const void *data;
const char *filename = TASHA_MAD_AUDIO_FIRMWARE_PATH;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
size_t cal_size;
hwdep_cal = wcdcal_get_fw_cal(tasha->fw_data, WCD9XXX_MAD_CAL);
if (hwdep_cal) {
data = hwdep_cal->data;
cal_size = hwdep_cal->size;
- dev_dbg(codec->dev, "%s: using hwdep calibration\n",
+ dev_dbg(component->dev, "%s: using hwdep calibration\n",
__func__);
} else {
- ret = request_firmware(&fw, filename, codec->dev);
+ ret = request_firmware(&fw, filename, component->dev);
if (ret || !fw) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: MAD firmware acquire failed, err = %d\n",
__func__, ret);
return -ENODEV;
}
data = fw->data;
cal_size = fw->size;
- dev_dbg(codec->dev, "%s: using request_firmware calibration\n",
+ dev_dbg(component->dev, "%s: using request_firmware calibration\n",
__func__);
}
if (cal_size < sizeof(*mad_cal)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Incorrect size %zd for MAD Cal, expected %zd\n",
__func__, cal_size, sizeof(*mad_cal));
ret = -ENOMEM;
@@ -8821,80 +9128,86 @@
mad_cal = (struct wcd_mad_audio_cal *) (data);
if (!mad_cal) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid calibration data\n",
__func__);
ret = -EINVAL;
goto done;
}
- snd_soc_write(codec, WCD9335_SOC_MAD_MAIN_CTL_2,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_MAIN_CTL_2,
mad_cal->microphone_info.cycle_time);
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_MAIN_CTL_1, 0xFF << 3,
- ((uint16_t)mad_cal->microphone_info.settle_time)
- << 3);
+ snd_soc_component_update_bits(component, WCD9335_SOC_MAD_MAIN_CTL_1,
+ 0xFF << 3,
+ ((uint16_t)mad_cal->microphone_info.settle_time) << 3);
/* Audio */
- snd_soc_write(codec, WCD9335_SOC_MAD_AUDIO_CTL_8,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_AUDIO_CTL_8,
mad_cal->audio_info.rms_omit_samples);
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_AUDIO_CTL_1,
+ snd_soc_component_update_bits(component, WCD9335_SOC_MAD_AUDIO_CTL_1,
0x07 << 4, mad_cal->audio_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_AUDIO_CTL_2, 0x03 << 2,
- mad_cal->audio_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD9335_SOC_MAD_AUDIO_CTL_7,
+ snd_soc_component_update_bits(component, WCD9335_SOC_MAD_AUDIO_CTL_2,
+ 0x03 << 2,
+ mad_cal->audio_info.detection_mechanism << 2);
+ snd_soc_component_write(component, WCD9335_SOC_MAD_AUDIO_CTL_7,
mad_cal->audio_info.rms_diff_threshold & 0x3F);
- snd_soc_write(codec, WCD9335_SOC_MAD_AUDIO_CTL_5,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_AUDIO_CTL_5,
mad_cal->audio_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD9335_SOC_MAD_AUDIO_CTL_6,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_AUDIO_CTL_6,
mad_cal->audio_info.rms_threshold_msb);
for (idx = 0; idx < ARRAY_SIZE(mad_cal->audio_info.iir_coefficients);
idx++) {
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_AUDIO_IIR_CTL_PTR,
- 0x3F, idx);
- snd_soc_write(codec, WCD9335_SOC_MAD_AUDIO_IIR_CTL_VAL,
- mad_cal->audio_info.iir_coefficients[idx]);
- dev_dbg(codec->dev, "%s:MAD Audio IIR Coef[%d] = 0X%x",
+ snd_soc_component_update_bits(component,
+ WCD9335_SOC_MAD_AUDIO_IIR_CTL_PTR, 0x3F, idx);
+ snd_soc_component_write(component,
+ WCD9335_SOC_MAD_AUDIO_IIR_CTL_VAL,
+ mad_cal->audio_info.iir_coefficients[idx]);
+ dev_dbg(component->dev, "%s:MAD Audio IIR Coef[%d] = 0X%x",
__func__, idx,
mad_cal->audio_info.iir_coefficients[idx]);
}
/* Beacon */
- snd_soc_write(codec, WCD9335_SOC_MAD_BEACON_CTL_8,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_BEACON_CTL_8,
mad_cal->beacon_info.rms_omit_samples);
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_BEACON_CTL_1,
+ snd_soc_component_update_bits(component, WCD9335_SOC_MAD_BEACON_CTL_1,
0x07 << 4, mad_cal->beacon_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_BEACON_CTL_2, 0x03 << 2,
- mad_cal->beacon_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD9335_SOC_MAD_BEACON_CTL_7,
+ snd_soc_component_update_bits(component, WCD9335_SOC_MAD_BEACON_CTL_2,
+ 0x03 << 2,
+ mad_cal->beacon_info.detection_mechanism << 2);
+ snd_soc_component_write(component, WCD9335_SOC_MAD_BEACON_CTL_7,
mad_cal->beacon_info.rms_diff_threshold & 0x1F);
- snd_soc_write(codec, WCD9335_SOC_MAD_BEACON_CTL_5,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_BEACON_CTL_5,
mad_cal->beacon_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD9335_SOC_MAD_BEACON_CTL_6,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_BEACON_CTL_6,
mad_cal->beacon_info.rms_threshold_msb);
for (idx = 0; idx < ARRAY_SIZE(mad_cal->beacon_info.iir_coefficients);
idx++) {
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_BEACON_IIR_CTL_PTR,
- 0x3F, idx);
- snd_soc_write(codec, WCD9335_SOC_MAD_BEACON_IIR_CTL_VAL,
- mad_cal->beacon_info.iir_coefficients[idx]);
- dev_dbg(codec->dev, "%s:MAD Beacon IIR Coef[%d] = 0X%x",
+ snd_soc_component_update_bits(component,
+ WCD9335_SOC_MAD_BEACON_IIR_CTL_PTR,
+ 0x3F, idx);
+ snd_soc_component_write(component,
+ WCD9335_SOC_MAD_BEACON_IIR_CTL_VAL,
+ mad_cal->beacon_info.iir_coefficients[idx]);
+ dev_dbg(component->dev, "%s:MAD Beacon IIR Coef[%d] = 0X%x",
__func__, idx,
mad_cal->beacon_info.iir_coefficients[idx]);
}
/* Ultrasound */
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_ULTR_CTL_1,
+ snd_soc_component_update_bits(component, WCD9335_SOC_MAD_ULTR_CTL_1,
0x07 << 4,
mad_cal->ultrasound_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD9335_SOC_MAD_ULTR_CTL_2, 0x03 << 2,
- mad_cal->ultrasound_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD9335_SOC_MAD_ULTR_CTL_7,
+ snd_soc_component_update_bits(component, WCD9335_SOC_MAD_ULTR_CTL_2,
+ 0x03 << 2,
+ mad_cal->ultrasound_info.detection_mechanism << 2);
+ snd_soc_component_write(component, WCD9335_SOC_MAD_ULTR_CTL_7,
mad_cal->ultrasound_info.rms_diff_threshold & 0x1F);
- snd_soc_write(codec, WCD9335_SOC_MAD_ULTR_CTL_5,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_ULTR_CTL_5,
mad_cal->ultrasound_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD9335_SOC_MAD_ULTR_CTL_6,
+ snd_soc_component_write(component, WCD9335_SOC_MAD_ULTR_CTL_6,
mad_cal->ultrasound_info.rms_threshold_msb);
done:
@@ -8907,38 +9220,39 @@
static int tasha_codec_enable_mad(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: event = %d\n", __func__, event);
/* Return if CPE INPUT is DEC1 */
- if (snd_soc_read(codec, WCD9335_CPE_SS_SVA_CFG) & 0x01)
+ if (snd_soc_component_read32(component, WCD9335_CPE_SS_SVA_CFG) & 0x01)
return ret;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Turn on MAD clk */
- snd_soc_update_bits(codec, WCD9335_CPE_SS_MAD_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_MAD_CTL,
0x01, 0x01);
/* Undo reset for MAD */
- snd_soc_update_bits(codec, WCD9335_CPE_SS_MAD_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_MAD_CTL,
0x02, 0x00);
- ret = tasha_codec_config_mad(codec);
+ ret = tasha_codec_config_mad(component);
if (ret)
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to config MAD, err = %d\n",
__func__, ret);
break;
case SND_SOC_DAPM_POST_PMD:
/* Reset the MAD block */
- snd_soc_update_bits(codec, WCD9335_CPE_SS_MAD_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_MAD_CTL,
0x02, 0x02);
/* Turn off MAD clk */
- snd_soc_update_bits(codec, WCD9335_CPE_SS_MAD_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_MAD_CTL,
0x01, 0x00);
break;
}
@@ -8949,27 +9263,30 @@
static int tasha_codec_configure_cpe_input(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: event = %d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Configure CPE input as DEC1 */
- snd_soc_update_bits(codec, WCD9335_CPE_SS_SVA_CFG,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_SVA_CFG,
+ 0x01, 0x01);
/* Configure DEC1 Tx out with sample rate as 16K */
- snd_soc_update_bits(codec, WCD9335_CDC_TX1_TX_PATH_CTL,
- 0x0F, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_TX1_TX_PATH_CTL,
+ 0x0F, 0x01);
break;
case SND_SOC_DAPM_POST_PMD:
/* Reset DEC1 Tx out sample rate */
- snd_soc_update_bits(codec, WCD9335_CDC_TX1_TX_PATH_CTL,
- 0x0F, 0x04);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_SVA_CFG,
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_TX1_TX_PATH_CTL,
+ 0x0F, 0x04);
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_SVA_CFG,
0x01, 0x00);
break;
@@ -8984,15 +9301,16 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
if (test_bit(AIF4_SWITCH_VALUE, &tasha_p->status_mask))
ucontrol->value.integer.value[0] = 1;
else
ucontrol->value.integer.value[0] = 0;
- dev_dbg(codec->dev, "%s: AIF4 switch value = %ld\n",
+ dev_dbg(component->dev, "%s: AIF4 switch value = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
}
@@ -9003,10 +9321,11 @@
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
struct snd_soc_dapm_update *update = NULL;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tasha_priv *tasha_p = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s: AIF4 switch value = %ld\n",
+ dev_dbg(component->dev, "%s: AIF4 switch value = %ld\n",
__func__, ucontrol->value.integer.value[0]);
if (ucontrol->value.integer.value[0]) {
@@ -10314,23 +10633,29 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s: event = %d name = %s\n",
+ dev_dbg(component->dev, "%s: event = %d name = %s\n",
__func__, event, w->name);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- snd_soc_write(codec, WCD9335_CPE_SS_EC_BUF_INT_PERIOD, 0x3B);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_CFG, 0x08, 0x08);
- snd_soc_update_bits(codec, WCD9335_CDC_IF_ROUTER_TX_MUX_CFG0,
- 0x08, 0x08);
+ snd_soc_component_write(component,
+ WCD9335_CPE_SS_EC_BUF_INT_PERIOD, 0x3B);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_SS_CFG, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_IF_ROUTER_TX_MUX_CFG0, 0x08, 0x08);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, WCD9335_CDC_IF_ROUTER_TX_MUX_CFG0,
- 0x08, 0x00);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_CFG, 0x08, 0x00);
- snd_soc_write(codec, WCD9335_CPE_SS_EC_BUF_INT_PERIOD, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CDC_IF_ROUTER_TX_MUX_CFG0,
+ 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_SS_CFG, 0x08, 0x00);
+ snd_soc_component_write(component,
+ WCD9335_CPE_SS_EC_BUF_INT_PERIOD, 0x00);
break;
}
@@ -11136,7 +11461,8 @@
unsigned int *tx_num, unsigned int *tx_slot,
unsigned int *rx_num, unsigned int *rx_slot)
{
- struct tasha_priv *tasha_p = snd_soc_codec_get_drvdata(dai->codec);
+ struct tasha_priv *tasha_p =
+ snd_soc_component_get_drvdata(dai->component);
u32 i = 0;
struct wcd9xxx_ch *ch;
@@ -11200,8 +11526,8 @@
pr_err("%s: dai is empty\n", __func__);
return -EINVAL;
}
- tasha = snd_soc_codec_get_drvdata(dai->codec);
- core = dev_get_drvdata(dai->codec->dev->parent);
+ tasha = snd_soc_component_get_drvdata(dai->component);
+ core = dev_get_drvdata(dai->component->dev->parent);
if (!tx_slot || !rx_slot) {
pr_err("%s: Invalid tx_slot=%pK, rx_slot=%pK\n",
@@ -11242,7 +11568,8 @@
static void tasha_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(dai->codec);
+ struct tasha_priv *tasha =
+ snd_soc_component_get_drvdata(dai->component);
pr_debug("%s(): substream = %s stream = %d\n", __func__,
substream->name, substream->stream);
@@ -11251,15 +11578,15 @@
return;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- tasha_codec_vote_max_bw(dai->codec, false);
+ tasha_codec_vote_max_bw(dai->component, false);
}
static int tasha_set_decimator_rate(struct snd_soc_dai *dai,
u8 tx_fs_rate_reg_val, u32 sample_rate)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct wcd9xxx_ch *ch;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u32 tx_port = 0;
u8 shift = 0, shift_val = 0, tx_mux_sel = 0;
int decimator = -1;
@@ -11267,11 +11594,11 @@
list_for_each_entry(ch, &tasha->dai[dai->id].wcd9xxx_ch_list, list) {
tx_port = ch->port;
- dev_dbg(codec->dev, "%s: dai->id = %d, tx_port = %d",
+ dev_dbg(component->dev, "%s: dai->id = %d, tx_port = %d",
__func__, dai->id, tx_port);
if ((tx_port < 0) || (tx_port == 12) || (tx_port >= 14)) {
- dev_err(codec->dev, "%s: Invalid SLIM TX%u port. DAI ID: %d\n",
+ dev_err(component->dev, "%s: Invalid SLIM TX%u port. DAI ID: %d\n",
__func__, tx_port, dai->id);
return -EINVAL;
}
@@ -11297,7 +11624,7 @@
shift = 4;
shift_val = 0x03;
}
- tx_mux_sel = snd_soc_read(codec, tx_port_reg) &
+ tx_mux_sel = snd_soc_component_read32(component, tx_port_reg) &
(shift_val << shift);
tx_mux_sel = tx_mux_sel >> shift;
@@ -11318,16 +11645,16 @@
if (decimator >= 0) {
tx_fs_reg = WCD9335_CDC_TX0_TX_PATH_CTL +
16 * decimator;
- dev_dbg(codec->dev, "%s: set DEC%u (-> SLIM_TX%u) rate to %u\n",
+ dev_dbg(component->dev, "%s: set DEC%u (-> SLIM_TX%u) rate to %u\n",
__func__, decimator, tx_port, sample_rate);
- snd_soc_update_bits(codec, tx_fs_reg, 0x0F,
- tx_fs_rate_reg_val);
+ snd_soc_component_update_bits(component, tx_fs_reg,
+ 0x0F, tx_fs_rate_reg_val);
} else if ((tx_port <= 8) && (tx_mux_sel == 0x01)) {
/* Check if the TX Mux input is RX MIX TXn */
- dev_dbg(codec->dev, "%s: RX_MIX_TX%u going to SLIM TX%u\n",
+ dev_dbg(component->dev, "%s: RX_MIX_TX%u going to SLIM TX%u\n",
__func__, tx_port, tx_port);
} else {
- dev_err(codec->dev, "%s: ERROR: Invalid decimator: %d\n",
+ dev_err(component->dev, "%s: ERROR: Invalid decimator: %d\n",
__func__, decimator);
return -EINVAL;
}
@@ -11343,9 +11670,9 @@
u32 j;
u16 int_mux_cfg1, int_fs_reg;
u8 int_mux_cfg1_val;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct wcd9xxx_ch *ch;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
list_for_each_entry(ch, &tasha->dai[dai->id].wcd9xxx_ch_list, list) {
int_2_inp = ch->port + INTn_2_INP_SEL_RX0 -
@@ -11361,7 +11688,8 @@
int_mux_cfg1 = WCD9335_CDC_RX_INP_MUX_RX_INT0_CFG1;
for (j = 0; j < TASHA_NUM_INTERPOLATORS; j++) {
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1) &
+ int_mux_cfg1_val = snd_soc_component_read32(
+ component, int_mux_cfg1) &
0x0F;
if (int_mux_cfg1_val == int_2_inp) {
int_fs_reg = WCD9335_CDC_RX0_RX_PATH_MIX_CTL +
@@ -11370,7 +11698,8 @@
__func__, dai->id, j);
pr_debug("%s: set INT%u_2 sample rate to %u\n",
__func__, j, sample_rate);
- snd_soc_update_bits(codec, int_fs_reg,
+ snd_soc_component_update_bits(component,
+ int_fs_reg,
0x0F, int_mix_fs_rate_reg_val);
}
int_mux_cfg1 += 2;
@@ -11389,9 +11718,9 @@
u16 int_fs_reg;
u8 int_mux_cfg0_val, int_mux_cfg1_val;
u8 inp0_sel, inp1_sel, inp2_sel;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct wcd9xxx_ch *ch;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
list_for_each_entry(ch, &tasha->dai[dai->id].wcd9xxx_ch_list, list) {
int_1_mix1_inp = ch->port + INTn_1_MIX_INP_SEL_RX0 -
@@ -11415,8 +11744,10 @@
for (j = 0; j < TASHA_NUM_INTERPOLATORS; j++) {
int_mux_cfg1 = int_mux_cfg0 + 1;
- int_mux_cfg0_val = snd_soc_read(codec, int_mux_cfg0);
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1);
+ int_mux_cfg0_val = snd_soc_component_read32(component,
+ int_mux_cfg0);
+ int_mux_cfg1_val = snd_soc_component_read32(component,
+ int_mux_cfg1);
inp0_sel = int_mux_cfg0_val & 0x0F;
inp1_sel = (int_mux_cfg0_val >> 4) & 0x0F;
inp2_sel = (int_mux_cfg1_val >> 4) & 0x0F;
@@ -11434,7 +11765,8 @@
pr_info("%s: Cannot set 44.1KHz on INT0\n",
__func__);
} else
- snd_soc_update_bits(codec, int_fs_reg,
+ snd_soc_component_update_bits(
+ component, int_fs_reg,
0x0F, int_prim_fs_rate_reg_val);
}
int_mux_cfg0 += 2;
@@ -11490,7 +11822,7 @@
substream->name, substream->stream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- tasha_codec_vote_max_bw(dai->codec, false);
+ tasha_codec_vote_max_bw(dai->component, false);
return 0;
}
@@ -11498,12 +11830,13 @@
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(dai->codec);
+ struct tasha_priv *tasha =
+ snd_soc_component_get_drvdata(dai->component);
int ret;
int tx_fs_rate = -EINVAL;
int rx_fs_rate = -EINVAL;
int i2s_bit_mode;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
pr_debug("%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n", __func__,
dai->name, dai->id, params_rate(params),
@@ -11556,10 +11889,10 @@
__func__, params_rate(params));
return -EINVAL;
};
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_RX_I2S_CTL,
0x20, i2s_bit_mode << 5);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_RX_I2S_CTL,
0x1c, (rx_fs_rate << 2));
}
@@ -11623,27 +11956,27 @@
return -EINVAL;
};
if (tasha->intf_type == WCD9XXX_INTERFACE_TYPE_I2C) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_TX_I2S_CTL,
0x20, i2s_bit_mode << 5);
if (tx_fs_rate > 1)
tx_fs_rate--;
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_TX_I2S_CTL,
0x1c, tx_fs_rate << 2);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_TX_I2S_SD0_L_CFG,
0x05, 0x05);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_TX_I2S_SD0_R_CFG,
0x05, 0x05);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_TX_I2S_SD1_L_CFG,
0x05, 0x05);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_DATA_HUB_DATA_HUB_TX_I2S_SD1_R_CFG,
0x05, 0x05);
}
@@ -11661,18 +11994,19 @@
static int tasha_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(dai->codec);
+ struct tasha_priv *tasha =
+ snd_soc_component_get_drvdata(dai->component);
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS:
/* CPU is master */
if (tasha->intf_type == WCD9XXX_INTERFACE_TYPE_I2C) {
if (dai->id == AIF1_CAP)
- snd_soc_update_bits(dai->codec,
+ snd_soc_component_update_bits(dai->component,
WCD9335_DATA_HUB_DATA_HUB_TX_I2S_CTL,
0x2, 0);
else if (dai->id == AIF1_PB)
- snd_soc_update_bits(dai->codec,
+ snd_soc_component_update_bits(dai->component,
WCD9335_DATA_HUB_DATA_HUB_RX_I2S_CTL,
0x2, 0);
}
@@ -11681,11 +12015,11 @@
/* CPU is slave */
if (tasha->intf_type == WCD9XXX_INTERFACE_TYPE_I2C) {
if (dai->id == AIF1_CAP)
- snd_soc_update_bits(dai->codec,
+ snd_soc_component_update_bits(dai->component,
WCD9335_DATA_HUB_DATA_HUB_TX_I2S_CTL,
0x2, 0x2);
else if (dai->id == AIF1_PB)
- snd_soc_update_bits(dai->codec,
+ snd_soc_component_update_bits(dai->component,
WCD9335_DATA_HUB_DATA_HUB_RX_I2S_CTL,
0x2, 0x2);
}
@@ -11947,13 +12281,13 @@
static void tasha_codec_power_gate_digital_core(struct tasha_priv *tasha)
{
- struct snd_soc_codec *codec = tasha->codec;
+ struct snd_soc_component *component = tasha->component;
- if (!codec)
+ if (!component)
return;
mutex_lock(&tasha->power_lock);
- dev_dbg(codec->dev, "%s: Entering power gating function, %d\n",
+ dev_dbg(component->dev, "%s: Entering power gating function, %d\n",
__func__, tasha->power_active_ref);
if (tasha->power_active_ref > 0)
@@ -11962,18 +12296,21 @@
wcd9xxx_set_power_state(tasha->wcd9xxx,
WCD_REGION_POWER_COLLAPSE_BEGIN,
WCD9XXX_DIG_CORE_REGION_1);
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL,
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL,
0x04, 0x04);
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL,
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL,
0x01, 0x00);
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL,
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL,
0x02, 0x00);
clear_bit(AUDIO_NOMINAL, &tasha->status_mask);
tasha_codec_update_sido_voltage(tasha, sido_buck_svs_voltage);
wcd9xxx_set_power_state(tasha->wcd9xxx, WCD_REGION_POWER_DOWN,
WCD9XXX_DIG_CORE_REGION_1);
exit:
- dev_dbg(codec->dev, "%s: Exiting power gating function, %d\n",
+ dev_dbg(component->dev, "%s: Exiting power gating function, %d\n",
__func__, tasha->power_active_ref);
mutex_unlock(&tasha->power_lock);
}
@@ -11982,37 +12319,43 @@
{
struct tasha_priv *tasha;
struct delayed_work *dwork;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
dwork = to_delayed_work(work);
tasha = container_of(dwork, struct tasha_priv, power_gate_work);
- codec = tasha->codec;
+ component = tasha->component;
- if (!codec)
+ if (!component)
return;
tasha_codec_power_gate_digital_core(tasha);
}
/* called under power_lock acquisition */
-static int tasha_dig_core_remove_power_collapse(struct snd_soc_codec *codec)
+static int tasha_dig_core_remove_power_collapse(
+ struct snd_soc_component *component)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
- tasha_codec_vote_max_bw(codec, true);
- snd_soc_write(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x5);
- snd_soc_write(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x7);
- snd_soc_write(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x3);
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_RST_CTL, 0x02, 0x00);
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_RST_CTL, 0x02, 0x02);
+ tasha_codec_vote_max_bw(component, true);
+ snd_soc_component_write(component,
+ WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x5);
+ snd_soc_component_write(component,
+ WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x7);
+ snd_soc_component_write(component,
+ WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x3);
+ snd_soc_component_update_bits(component, WCD9335_CODEC_RPM_RST_CTL,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_CODEC_RPM_RST_CTL,
+ 0x02, 0x02);
wcd9xxx_set_power_state(tasha->wcd9xxx,
WCD_REGION_POWER_COLLAPSE_REMOVE,
WCD9XXX_DIG_CORE_REGION_1);
- regcache_mark_dirty(codec->component.regmap);
- regcache_sync_region(codec->component.regmap,
+ regcache_mark_dirty(component->regmap);
+ regcache_sync_region(component->regmap,
TASHA_DIG_CORE_REG_MIN, TASHA_DIG_CORE_REG_MAX);
- tasha_codec_vote_max_bw(codec, false);
+ tasha_codec_vote_max_bw(component, false);
return 0;
}
@@ -12020,7 +12363,7 @@
static int tasha_dig_core_power_collapse(struct tasha_priv *tasha,
int req_state)
{
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
int cur_state;
/* Exit if feature is disabled */
@@ -12041,8 +12384,8 @@
goto unlock_mutex;
}
- codec = tasha->codec;
- if (!codec)
+ component = tasha->component;
+ if (!component)
goto unlock_mutex;
if (req_state == POWER_COLLAPSE) {
@@ -12062,7 +12405,7 @@
tasha->wcd9xxx,
WCD9XXX_DIG_CORE_REGION_1);
if (cur_state == WCD_REGION_POWER_DOWN)
- tasha_dig_core_remove_power_collapse(codec);
+ tasha_dig_core_remove_power_collapse(component);
else {
mutex_unlock(&tasha->power_lock);
cancel_delayed_work_sync(
@@ -12125,17 +12468,19 @@
return ret;
}
-int tasha_cdc_mclk_enable(struct snd_soc_codec *codec, int enable, bool dapm)
+int tasha_cdc_mclk_enable(struct snd_soc_component *component,
+ int enable, bool dapm)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
return __tasha_cdc_mclk_enable(tasha, enable);
}
EXPORT_SYMBOL(tasha_cdc_mclk_enable);
-int tasha_cdc_mclk_tx_enable(struct snd_soc_codec *codec, int enable, bool dapm)
+int tasha_cdc_mclk_tx_enable(struct snd_soc_component *component,
+ int enable, bool dapm)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int ret = 0;
dev_dbg(tasha->dev, "%s: clk_mode: %d, enable: %d, clk_internal: %d\n",
@@ -12145,10 +12490,10 @@
tasha_cdc_sido_ccl_enable(tasha, true);
wcd_resmgr_enable_master_bias(tasha->resmgr);
tasha_dig_core_power_collapse(tasha, POWER_RESUME);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
0x01, 0x01);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x01, 0x01);
set_bit(CPE_NOMINAL, &tasha->status_mask);
@@ -12210,7 +12555,7 @@
/*
* tasha_codec_info_create_codec_entry - creates wcd9335 module
* @codec_root: The parent directory
- * @codec: Codec instance
+ * @component: Codec instance
*
* Creates wcd9335 module and version entry under the given
* parent directory.
@@ -12218,21 +12563,21 @@
* Return: 0 on success or negative error code on failure.
*/
int tasha_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct snd_info_entry *version_entry;
struct tasha_priv *tasha;
struct snd_soc_card *card;
- if (!codec_root || !codec)
+ if (!codec_root || !component)
return -EINVAL;
- tasha = snd_soc_codec_get_drvdata(codec);
- card = codec->component.card;
+ tasha = snd_soc_component_get_drvdata(component);
+ card = component->card;
tasha->entry = snd_info_create_subdir(codec_root->module,
"tasha", codec_root);
if (!tasha->entry) {
- dev_dbg(codec->dev, "%s: failed to create wcd9335 entry\n",
+ dev_dbg(component->dev, "%s: failed to create wcd9335 entry\n",
__func__);
return -ENOMEM;
}
@@ -12241,7 +12586,7 @@
"version",
tasha->entry);
if (!version_entry) {
- dev_dbg(codec->dev, "%s: failed to create wcd9335 version entry\n",
+ dev_dbg(component->dev, "%s: failed to create wcd9335 version entry\n",
__func__);
return -ENOMEM;
}
@@ -12262,9 +12607,9 @@
EXPORT_SYMBOL(tasha_codec_info_create_codec_entry);
static int __tasha_codec_internal_rco_ctrl(
- struct snd_soc_codec *codec, bool enable)
+ struct snd_soc_component *component, bool enable)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int ret = 0;
if (enable) {
@@ -12287,7 +12632,7 @@
}
if (ret) {
- dev_err(codec->dev, "%s: Error in %s RCO\n",
+ dev_err(component->dev, "%s: Error in %s RCO\n",
__func__, (enable ? "enabling" : "disabling"));
ret = -EINVAL;
}
@@ -12300,28 +12645,28 @@
* Make sure that the caller does not acquire
* BG_CLK_LOCK.
*/
-static int tasha_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
+static int tasha_codec_internal_rco_ctrl(struct snd_soc_component *component,
bool enable)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
int ret = 0;
WCD9XXX_V2_BG_CLK_LOCK(tasha->resmgr);
- ret = __tasha_codec_internal_rco_ctrl(codec, enable);
+ ret = __tasha_codec_internal_rco_ctrl(component, enable);
WCD9XXX_V2_BG_CLK_UNLOCK(tasha->resmgr);
return ret;
}
/*
* tasha_mbhc_hs_detect: starts mbhc insertion/removal functionality
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @mbhc_cfg: handle to mbhc configuration structure
* return 0 if mbhc_start is success or error code in case of failure
*/
-int tasha_mbhc_hs_detect(struct snd_soc_codec *codec,
+int tasha_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
return wcd_mbhc_start(&tasha->mbhc, mbhc_cfg);
}
@@ -12329,11 +12674,11 @@
/*
* tasha_mbhc_hs_detect_exit: stop mbhc insertion/removal functionality
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*/
-void tasha_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
+void tasha_mbhc_hs_detect_exit(struct snd_soc_component *component)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
wcd_mbhc_stop(&tasha->mbhc);
}
@@ -12527,27 +12872,27 @@
{WCD9335_DIFF_LO_COM_PA_FREQ, 0x70, 0x40},
};
-static void tasha_update_reg_reset_values(struct snd_soc_codec *codec)
+static void tasha_update_reg_reset_values(struct snd_soc_component *component)
{
u32 i;
- struct wcd9xxx *tasha_core = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *tasha_core = dev_get_drvdata(component->dev->parent);
if (TASHA_IS_1_1(tasha_core)) {
for (i = 0; i < ARRAY_SIZE(tasha_reg_update_reset_val_1_1);
i++)
- snd_soc_write(codec,
+ snd_soc_component_write(component,
tasha_reg_update_reset_val_1_1[i].reg,
tasha_reg_update_reset_val_1_1[i].val);
}
}
-static void tasha_codec_init_reg(struct snd_soc_codec *codec)
+static void tasha_codec_init_reg(struct snd_soc_component *component)
{
u32 i;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
for (i = 0; i < ARRAY_SIZE(tasha_codec_reg_init_common_val); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tasha_codec_reg_init_common_val[i].reg,
tasha_codec_reg_init_common_val[i].mask,
tasha_codec_reg_init_common_val[i].val);
@@ -12555,26 +12900,26 @@
if (TASHA_IS_1_1(wcd9xxx) ||
TASHA_IS_1_0(wcd9xxx))
for (i = 0; i < ARRAY_SIZE(tasha_codec_reg_init_1_x_val); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tasha_codec_reg_init_1_x_val[i].reg,
tasha_codec_reg_init_1_x_val[i].mask,
tasha_codec_reg_init_1_x_val[i].val);
if (TASHA_IS_1_1(wcd9xxx)) {
for (i = 0; i < ARRAY_SIZE(tasha_codec_reg_init_val_1_1); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tasha_codec_reg_init_val_1_1[i].reg,
tasha_codec_reg_init_val_1_1[i].mask,
tasha_codec_reg_init_val_1_1[i].val);
} else if (TASHA_IS_1_0(wcd9xxx)) {
for (i = 0; i < ARRAY_SIZE(tasha_codec_reg_init_val_1_0); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tasha_codec_reg_init_val_1_0[i].reg,
tasha_codec_reg_init_val_1_0[i].mask,
tasha_codec_reg_init_val_1_0[i].val);
} else if (TASHA_IS_2_0(wcd9xxx)) {
for (i = 0; i < ARRAY_SIZE(tasha_codec_reg_init_val_2_0); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tasha_codec_reg_init_val_2_0[i].reg,
tasha_codec_reg_init_val_2_0[i].mask,
tasha_codec_reg_init_val_2_0[i].val);
@@ -12603,10 +12948,10 @@
}
-static void tasha_slim_interface_init_reg(struct snd_soc_codec *codec)
+static void tasha_slim_interface_init_reg(struct snd_soc_component *component)
{
int i;
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
for (i = 0; i < WCD9XXX_SLIM_NUM_PORT_REG; i++)
wcd9xxx_interface_reg_write(priv->wcd9xxx,
@@ -12715,7 +13060,7 @@
static int tasha_setup_irqs(struct tasha_priv *tasha)
{
int ret = 0;
- struct snd_soc_codec *codec = tasha->codec;
+ struct snd_soc_component *component = tasha->component;
struct wcd9xxx *wcd9xxx = tasha->wcd9xxx;
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
@@ -12726,14 +13071,14 @@
pr_err("%s: Failed to request irq %d\n", __func__,
WCD9XXX_IRQ_SLIMBUS);
else
- tasha_slim_interface_init_reg(codec);
+ tasha_slim_interface_init_reg(component);
return ret;
}
-static void tasha_init_slim_slave_cfg(struct snd_soc_codec *codec)
+static void tasha_init_slim_slave_cfg(struct snd_soc_component *component)
{
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
struct afe_param_cdc_slimbus_slave_cfg *cfg;
struct wcd9xxx *wcd9xxx = priv->wcd9xxx;
uint64_t eaddr = 0;
@@ -12748,7 +13093,7 @@
cfg->device_enum_addr_lsw = eaddr & 0xFFFFFFFF;
cfg->device_enum_addr_msw = eaddr >> 32;
- dev_dbg(codec->dev, "%s: slimbus logical address 0x%llx\n",
+ dev_dbg(component->dev, "%s: slimbus logical address 0x%llx\n",
__func__, eaddr);
}
@@ -12764,7 +13109,7 @@
static int tasha_handle_pdata(struct tasha_priv *tasha,
struct wcd9xxx_pdata *pdata)
{
- struct snd_soc_codec *codec = tasha->codec;
+ struct snd_soc_component *component = tasha->component;
u8 dmic_ctl_val, mad_dmic_ctl_val;
u8 anc_ctl_value;
u32 def_dmic_rate, dmic_clk_drv;
@@ -12772,7 +13117,7 @@
int rc = 0;
if (!pdata) {
- dev_err(codec->dev, "%s: NULL pdata\n", __func__);
+ dev_err(component->dev, "%s: NULL pdata\n", __func__);
return -ENODEV;
}
@@ -12786,10 +13131,14 @@
rc = -EINVAL;
goto done;
}
- snd_soc_update_bits(codec, WCD9335_ANA_MICB1, 0x3F, vout_ctl_1);
- snd_soc_update_bits(codec, WCD9335_ANA_MICB2, 0x3F, vout_ctl_2);
- snd_soc_update_bits(codec, WCD9335_ANA_MICB3, 0x3F, vout_ctl_3);
- snd_soc_update_bits(codec, WCD9335_ANA_MICB4, 0x3F, vout_ctl_4);
+ snd_soc_component_update_bits(component, WCD9335_ANA_MICB1,
+ 0x3F, vout_ctl_1);
+ snd_soc_component_update_bits(component, WCD9335_ANA_MICB2,
+ 0x3F, vout_ctl_2);
+ snd_soc_component_update_bits(component, WCD9335_ANA_MICB3,
+ 0x3F, vout_ctl_3);
+ snd_soc_component_update_bits(component, WCD9335_ANA_MICB4,
+ 0x3F, vout_ctl_4);
/* Set the DMIC sample rate */
switch (pdata->mclk_rate) {
@@ -12801,7 +13150,7 @@
break;
default:
/* should never happen */
- dev_err(codec->dev, "%s: Invalid mclk_rate %d\n",
+ dev_err(component->dev, "%s: Invalid mclk_rate %d\n",
__func__, pdata->mclk_rate);
rc = -EINVAL;
goto done;
@@ -12809,13 +13158,13 @@
if (pdata->dmic_sample_rate ==
WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED) {
- dev_info(codec->dev, "%s: dmic_rate invalid default = %d\n",
+ dev_info(component->dev, "%s: dmic_rate invalid default = %d\n",
__func__, def_dmic_rate);
pdata->dmic_sample_rate = def_dmic_rate;
}
if (pdata->mad_dmic_sample_rate ==
WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED) {
- dev_info(codec->dev, "%s: mad_dmic_rate invalid default = %d\n",
+ dev_info(component->dev, "%s: mad_dmic_rate invalid default = %d\n",
__func__, def_dmic_rate);
/*
* use dmic_sample_rate as the default for MAD
@@ -12825,7 +13174,7 @@
}
if (pdata->ecpp_dmic_sample_rate ==
WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED) {
- dev_info(codec->dev,
+ dev_info(component->dev,
"%s: ecpp_dmic_rate invalid default = %d\n",
__func__, def_dmic_rate);
/*
@@ -12838,7 +13187,7 @@
if (pdata->dmic_clk_drv ==
WCD9XXX_DMIC_CLK_DRIVE_UNDEFINED) {
pdata->dmic_clk_drv = WCD9335_DMIC_CLK_DRIVE_DEFAULT;
- dev_info(codec->dev,
+ dev_info(component->dev,
"%s: dmic_clk_strength invalid, default = %d\n",
__func__, pdata->dmic_clk_drv);
}
@@ -12857,14 +13206,14 @@
dmic_clk_drv = 3;
break;
default:
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: invalid dmic_clk_drv %d, using default\n",
__func__, pdata->dmic_clk_drv);
dmic_clk_drv = 0;
break;
}
- snd_soc_update_bits(codec, WCD9335_TEST_DEBUG_PAD_DRVCTL,
+ snd_soc_component_update_bits(component, WCD9335_TEST_DEBUG_PAD_DRVCTL,
0x0C, dmic_clk_drv << 2);
/*
@@ -12872,17 +13221,17 @@
* whereas, the anc/txfe dmic rates to dmic_sample_rate
* since the anc/txfe are independent of mad block.
*/
- mad_dmic_ctl_val = tasha_get_dmic_clk_val(tasha->codec,
+ mad_dmic_ctl_val = tasha_get_dmic_clk_val(tasha->component,
pdata->mclk_rate,
pdata->mad_dmic_sample_rate);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_DMIC0_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_DMIC0_CTL,
0x0E, mad_dmic_ctl_val << 1);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_DMIC1_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_DMIC1_CTL,
0x0E, mad_dmic_ctl_val << 1);
- snd_soc_update_bits(codec, WCD9335_CPE_SS_DMIC2_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CPE_SS_DMIC2_CTL,
0x0E, mad_dmic_ctl_val << 1);
- dmic_ctl_val = tasha_get_dmic_clk_val(tasha->codec,
+ dmic_ctl_val = tasha_get_dmic_clk_val(tasha->component,
pdata->mclk_rate,
pdata->dmic_sample_rate);
@@ -12891,38 +13240,38 @@
else
anc_ctl_value = WCD9335_ANC_DMIC_X2_HALF_RATE;
- snd_soc_update_bits(codec, WCD9335_CDC_ANC0_MODE_2_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CDC_ANC0_MODE_2_CTL,
0x40, anc_ctl_value << 6);
- snd_soc_update_bits(codec, WCD9335_CDC_ANC0_MODE_2_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CDC_ANC0_MODE_2_CTL,
0x20, anc_ctl_value << 5);
- snd_soc_update_bits(codec, WCD9335_CDC_ANC1_MODE_2_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CDC_ANC1_MODE_2_CTL,
0x40, anc_ctl_value << 6);
- snd_soc_update_bits(codec, WCD9335_CDC_ANC1_MODE_2_CTL,
+ snd_soc_component_update_bits(component, WCD9335_CDC_ANC1_MODE_2_CTL,
0x20, anc_ctl_value << 5);
done:
return rc;
}
static struct wcd_cpe_core *tasha_codec_get_cpe_core(
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
- struct tasha_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
return priv->cpe_core;
}
static int tasha_codec_cpe_fll_update_divider(
- struct snd_soc_codec *codec, u32 cpe_fll_rate)
+ struct snd_soc_component *component, u32 cpe_fll_rate)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u32 div_val = 0, l_val = 0;
u32 computed_cpe_fll;
if (cpe_fll_rate != CPE_FLL_CLK_75MHZ &&
cpe_fll_rate != CPE_FLL_CLK_150MHZ) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid CPE fll rate request %u\n",
__func__, cpe_fll_rate);
return -EINVAL;
@@ -12930,18 +13279,20 @@
if (wcd9xxx->mclk_rate == TASHA_MCLK_CLK_12P288MHZ) {
/* update divider to 10 and enable 5x divider */
- snd_soc_write(codec, WCD9335_CPE_FLL_USER_CTL_1,
+ snd_soc_component_write(component, WCD9335_CPE_FLL_USER_CTL_1,
0x55);
div_val = 10;
} else if (wcd9xxx->mclk_rate == TASHA_MCLK_CLK_9P6MHZ) {
/* update divider to 8 and enable 2x divider */
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_USER_CTL_0,
- 0x7C, 0x70);
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_USER_CTL_1,
- 0xE0, 0x20);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_USER_CTL_0,
+ 0x7C, 0x70);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_USER_CTL_1,
+ 0xE0, 0x20);
div_val = 8;
} else {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid MCLK rate %u\n",
__func__, wcd9xxx->mclk_rate);
return -EINVAL;
@@ -12957,102 +13308,106 @@
/* update L value LSB and MSB */
- snd_soc_write(codec, WCD9335_CPE_FLL_L_VAL_CTL_0,
+ snd_soc_component_write(component, WCD9335_CPE_FLL_L_VAL_CTL_0,
(l_val & 0xFF));
- snd_soc_write(codec, WCD9335_CPE_FLL_L_VAL_CTL_1,
+ snd_soc_component_write(component, WCD9335_CPE_FLL_L_VAL_CTL_1,
((l_val >> 8) & 0xFF));
tasha->current_cpe_clk_freq = cpe_fll_rate;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: updated l_val to %u for cpe_clk %u and mclk %u\n",
__func__, l_val, cpe_fll_rate, wcd9xxx->mclk_rate);
return 0;
}
-static int __tasha_cdc_change_cpe_clk(struct snd_soc_codec *codec,
+static int __tasha_cdc_change_cpe_clk(struct snd_soc_component *component,
u32 clk_freq)
{
int ret = 0;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
if (!tasha_cdc_is_svs_enabled(tasha)) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: SVS not enabled or tasha is not 2p0, return\n",
__func__);
return 0;
}
- dev_dbg(codec->dev, "%s: clk_freq = %u\n", __func__, clk_freq);
+ dev_dbg(component->dev, "%s: clk_freq = %u\n", __func__, clk_freq);
if (clk_freq == CPE_FLL_CLK_75MHZ) {
/* Change to SVS */
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_FLL_MODE,
- 0x08, 0x08);
- if (tasha_codec_cpe_fll_update_divider(codec, clk_freq)) {
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_FLL_MODE,
+ 0x08, 0x08);
+ if (tasha_codec_cpe_fll_update_divider(component, clk_freq)) {
ret = -EINVAL;
goto done;
}
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_FLL_MODE,
- 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_FLL_MODE,
+ 0x10, 0x10);
clear_bit(CPE_NOMINAL, &tasha->status_mask);
tasha_codec_update_sido_voltage(tasha, sido_buck_svs_voltage);
} else if (clk_freq == CPE_FLL_CLK_150MHZ) {
/* change to nominal */
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_FLL_MODE,
- 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_FLL_MODE,
+ 0x08, 0x08);
set_bit(CPE_NOMINAL, &tasha->status_mask);
tasha_codec_update_sido_voltage(tasha, SIDO_VOLTAGE_NOMINAL_MV);
- if (tasha_codec_cpe_fll_update_divider(codec, clk_freq)) {
+ if (tasha_codec_cpe_fll_update_divider(component, clk_freq)) {
ret = -EINVAL;
goto done;
}
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_FLL_MODE,
- 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_FLL_MODE,
+ 0x10, 0x10);
} else {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid clk_freq request %d for CPE FLL\n",
__func__, clk_freq);
ret = -EINVAL;
}
done:
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_FLL_MODE,
- 0x10, 0x00);
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_FLL_MODE,
- 0x08, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_CPE_FLL_FLL_MODE,
+ 0x10, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_CPE_FLL_FLL_MODE,
+ 0x08, 0x00);
return ret;
}
-static int tasha_codec_cpe_fll_enable(struct snd_soc_codec *codec,
+static int tasha_codec_cpe_fll_enable(struct snd_soc_component *component,
bool enable)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u8 clk_sel_reg_val = 0x00;
- dev_dbg(codec->dev, "%s: enable = %s\n",
+ dev_dbg(component->dev, "%s: enable = %s\n",
__func__, enable ? "true" : "false");
if (enable) {
if (tasha_cdc_is_svs_enabled(tasha)) {
/* FLL enable is always at SVS */
- if (__tasha_cdc_change_cpe_clk(codec,
+ if (__tasha_cdc_change_cpe_clk(component,
CPE_FLL_CLK_75MHZ)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: clk change to %d failed\n",
__func__, CPE_FLL_CLK_75MHZ);
return -EINVAL;
}
} else {
- if (tasha_codec_cpe_fll_update_divider(codec,
+ if (tasha_codec_cpe_fll_update_divider(component,
CPE_FLL_CLK_75MHZ)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: clk change to %d failed\n",
__func__, CPE_FLL_CLK_75MHZ);
return -EINVAL;
@@ -13060,53 +13415,61 @@
}
if (TASHA_IS_1_0(wcd9xxx)) {
- tasha_cdc_mclk_enable(codec, true, false);
+ tasha_cdc_mclk_enable(component, true, false);
clk_sel_reg_val = 0x02;
}
/* Setup CPE reference clk */
- snd_soc_update_bits(codec, WCD9335_ANA_CLK_TOP,
- 0x02, clk_sel_reg_val);
+ snd_soc_component_update_bits(component, WCD9335_ANA_CLK_TOP,
+ 0x02, clk_sel_reg_val);
/* enable CPE FLL reference clk */
- snd_soc_update_bits(codec, WCD9335_ANA_CLK_TOP,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD9335_ANA_CLK_TOP,
+ 0x01, 0x01);
/* program the PLL */
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_USER_CTL_0,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_USER_CTL_0,
+ 0x01, 0x01);
/* TEST clk setting */
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_TEST_CTL_0,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_TEST_CTL_0,
+ 0x80, 0x80);
/* set FLL mode to HW controlled */
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_FLL_MODE,
- 0x60, 0x00);
- snd_soc_write(codec, WCD9335_CPE_FLL_FLL_MODE, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_FLL_MODE,
+ 0x60, 0x00);
+ snd_soc_component_write(component, WCD9335_CPE_FLL_FLL_MODE,
+ 0x80);
} else {
/* disable CPE FLL reference clk */
- snd_soc_update_bits(codec, WCD9335_ANA_CLK_TOP,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component, WCD9335_ANA_CLK_TOP,
+ 0x01, 0x00);
/* undo TEST clk setting */
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_TEST_CTL_0,
- 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_TEST_CTL_0,
+ 0x80, 0x00);
/* undo FLL mode to HW control */
- snd_soc_write(codec, WCD9335_CPE_FLL_FLL_MODE, 0x00);
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_FLL_MODE,
- 0x60, 0x20);
+ snd_soc_component_write(component,
+ WCD9335_CPE_FLL_FLL_MODE, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_FLL_MODE,
+ 0x60, 0x20);
/* undo the PLL */
- snd_soc_update_bits(codec, WCD9335_CPE_FLL_USER_CTL_0,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CPE_FLL_USER_CTL_0,
+ 0x01, 0x00);
if (TASHA_IS_1_0(wcd9xxx))
- tasha_cdc_mclk_enable(codec, false, false);
+ tasha_cdc_mclk_enable(component, false, false);
/*
* FLL could get disabled while at nominal,
* scale it back to SVS
*/
if (tasha_cdc_is_svs_enabled(tasha))
- __tasha_cdc_change_cpe_clk(codec,
+ __tasha_cdc_change_cpe_clk(component,
CPE_FLL_CLK_75MHZ);
}
@@ -13117,20 +13480,20 @@
static void tasha_cdc_query_cpe_clk_plan(void *data,
struct cpe_svc_cfg_clk_plan *clk_freq)
{
- struct snd_soc_codec *codec = data;
+ struct snd_soc_component *component = data;
struct tasha_priv *tasha;
u32 cpe_clk_khz;
- if (!codec) {
- pr_err("%s: Invalid codec handle\n",
+ if (!component) {
+ pr_err("%s: Invalid component handle\n",
__func__);
return;
}
- tasha = snd_soc_codec_get_drvdata(codec);
+ tasha = snd_soc_component_get_drvdata(component);
cpe_clk_khz = tasha->current_cpe_clk_freq / 1000;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: current_clk_freq = %u\n",
__func__, tasha->current_cpe_clk_freq);
@@ -13149,17 +13512,17 @@
static void tasha_cdc_change_cpe_clk(void *data,
u32 clk_freq)
{
- struct snd_soc_codec *codec = data;
+ struct snd_soc_component *component = data;
struct tasha_priv *tasha;
u32 cpe_clk_khz, req_freq = 0;
- if (!codec) {
+ if (!component) {
pr_err("%s: Invalid codec handle\n",
__func__);
return;
}
- tasha = snd_soc_codec_get_drvdata(codec);
+ tasha = snd_soc_component_get_drvdata(component);
cpe_clk_khz = tasha->current_cpe_clk_freq / 1000;
if (tasha_cdc_is_svs_enabled(tasha)) {
@@ -13169,34 +13532,34 @@
req_freq = CPE_FLL_CLK_150MHZ;
}
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: requested clk_freq = %u, current clk_freq = %u\n",
__func__, clk_freq * 1000,
tasha->current_cpe_clk_freq);
if (tasha_cdc_is_svs_enabled(tasha)) {
- if (__tasha_cdc_change_cpe_clk(codec, req_freq))
- dev_err(codec->dev,
+ if (__tasha_cdc_change_cpe_clk(component, req_freq))
+ dev_err(component->dev,
"%s: clock/voltage scaling failed\n",
__func__);
}
}
-static int tasha_codec_slim_reserve_bw(struct snd_soc_codec *codec,
+static int tasha_codec_slim_reserve_bw(struct snd_soc_component *component,
u32 bw_ops, bool commit)
{
struct wcd9xxx *wcd9xxx;
- if (!codec) {
+ if (!component) {
pr_err("%s: Invalid handle to codec\n",
__func__);
return -EINVAL;
}
- wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ wcd9xxx = dev_get_drvdata(component->dev->parent);
if (!wcd9xxx) {
- dev_err(codec->dev, "%s: Invalid parent drv_data\n",
+ dev_err(component->dev, "%s: Invalid parent drv_data\n",
__func__);
return -EINVAL;
}
@@ -13204,11 +13567,11 @@
return wcd9xxx_slim_reserve_bw(wcd9xxx, bw_ops, commit);
}
-static int tasha_codec_vote_max_bw(struct snd_soc_codec *codec,
+static int tasha_codec_vote_max_bw(struct snd_soc_component *component,
bool vote)
{
u32 bw_ops;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
if (tasha->intf_type == WCD9XXX_INTERFACE_TYPE_I2C)
return 0;
@@ -13218,19 +13581,19 @@
tasha->ref_count++;
if (tasha->ref_count == 1) {
bw_ops = SLIM_BW_CLK_GEAR_9;
- tasha_codec_slim_reserve_bw(codec,
+ tasha_codec_slim_reserve_bw(component,
bw_ops, true);
}
} else if (!vote && tasha->ref_count > 0) {
tasha->ref_count--;
if (tasha->ref_count == 0) {
bw_ops = SLIM_BW_UNVOTE;
- tasha_codec_slim_reserve_bw(codec,
+ tasha_codec_slim_reserve_bw(component,
bw_ops, true);
}
};
- dev_dbg(codec->dev, "%s Value of counter after vote or un-vote is %d\n",
+ dev_dbg(component->dev, "%s Value of counter after vote or un-vote is %d\n",
__func__, tasha->ref_count);
mutex_unlock(&tasha->sb_clk_gear_lock);
@@ -13238,10 +13601,10 @@
return 0;
}
-static int tasha_cpe_err_irq_control(struct snd_soc_codec *codec,
+static int tasha_cpe_err_irq_control(struct snd_soc_component *component,
enum cpe_err_irq_cntl_type cntl_type, u8 *status)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
u8 irq_bits;
if (TASHA_IS_2_0(tasha->wcd9xxx))
@@ -13254,24 +13617,25 @@
switch (cntl_type) {
case CPE_ERR_IRQ_MASK:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CPE_SS_SS_ERROR_INT_MASK,
irq_bits, irq_bits);
break;
case CPE_ERR_IRQ_UNMASK:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9335_CPE_SS_SS_ERROR_INT_MASK,
irq_bits, 0x00);
break;
case CPE_ERR_IRQ_CLEAR:
- snd_soc_write(codec, WCD9335_CPE_SS_SS_ERROR_INT_CLEAR,
- irq_bits);
+ snd_soc_component_write(component,
+ WCD9335_CPE_SS_SS_ERROR_INT_CLEAR,
+ irq_bits);
break;
case CPE_ERR_IRQ_STATUS:
if (!status)
return -EINVAL;
- *status = snd_soc_read(codec,
- WCD9335_CPE_SS_SS_ERROR_INT_STATUS);
+ *status = snd_soc_component_read32(component,
+ WCD9335_CPE_SS_SS_ERROR_INT_STATUS);
break;
}
@@ -13294,14 +13658,14 @@
.change_freq_plan_cb = tasha_cdc_change_cpe_clk,
};
-static int tasha_cpe_initialize(struct snd_soc_codec *codec)
+static int tasha_cpe_initialize(struct snd_soc_component *component)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct wcd_cpe_params cpe_params;
memset(&cpe_params, 0,
sizeof(struct wcd_cpe_params));
- cpe_params.codec = codec;
+ cpe_params.component = component;
cpe_params.get_cpe_core = tasha_codec_get_cpe_core;
cpe_params.cdc_cb = &cpe_cb;
cpe_params.dbg_mode = cpe_debug_mode;
@@ -13316,13 +13680,13 @@
cpe_params.cdc_irq_info.cpe_fatal_irqs =
TASHA_CPE_FATAL_IRQS;
- cpe_svc_params.context = codec;
+ cpe_svc_params.context = component;
cpe_params.cpe_svc_params = &cpe_svc_params;
- tasha->cpe_core = wcd_cpe_init("cpe_9335", codec,
+ tasha->cpe_core = wcd_cpe_init("cpe_9335", component,
&cpe_params);
if (IS_ERR_OR_NULL(tasha->cpe_core)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to enable CPE\n",
__func__);
return -EINVAL;
@@ -13337,18 +13701,18 @@
static int tasha_device_down(struct wcd9xxx *wcd9xxx)
{
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct tasha_priv *priv;
int count;
int i = 0;
- codec = (struct snd_soc_codec *)(wcd9xxx->ssr_priv);
- priv = snd_soc_codec_get_drvdata(codec);
+ component = (struct snd_soc_component *)(wcd9xxx->ssr_priv);
+ priv = snd_soc_component_get_drvdata(component);
wcd_cpe_ssr_event(priv->cpe_core, WCD_CPE_BUS_DOWN_EVENT);
for (i = 0; i < priv->nr; i++)
swrm_wcd_notify(priv->swr_ctrl_data[i].swr_pdev,
SWR_DEVICE_DOWN, NULL);
- snd_soc_card_change_online_state(codec->component.card, 0);
+ snd_soc_card_change_online_state(component->card, 0);
for (count = 0; count < NUM_CODEC_DAIS; count++)
priv->dai[count].bus_down_in_recovery = true;
@@ -13361,13 +13725,13 @@
{
int i, ret = 0;
struct wcd9xxx *control;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct tasha_priv *tasha;
struct wcd9xxx_pdata *pdata;
- codec = (struct snd_soc_codec *)(wcd9xxx->ssr_priv);
- tasha = snd_soc_codec_get_drvdata(codec);
- control = dev_get_drvdata(codec->dev->parent);
+ component = (struct snd_soc_component *)(wcd9xxx->ssr_priv);
+ tasha = snd_soc_component_get_drvdata(component);
+ control = dev_get_drvdata(component->dev->parent);
wcd9xxx_set_power_state(tasha->wcd9xxx,
WCD_REGION_POWER_COLLAPSE_REMOVE,
@@ -13379,11 +13743,11 @@
control->slim_slave->laddr;
tasha_slimbus_slave_port_cfg.slave_dev_pgd_la =
control->slim->laddr;
- tasha_init_slim_slave_cfg(codec);
+ tasha_init_slim_slave_cfg(component);
if (tasha->machine_codec_event_cb)
- tasha->machine_codec_event_cb(codec,
+ tasha->machine_codec_event_cb(component,
WCD9335_CODEC_EVENT_CODEC_UP);
- snd_soc_card_change_online_state(codec->component.card, 1);
+ snd_soc_card_change_online_state(component->card, 1);
/* Class-H Init*/
wcd_clsh_init(&tasha->clsh_d);
@@ -13393,30 +13757,32 @@
tasha_update_reg_defaults(tasha);
- tasha->codec = codec;
+ tasha->component = component;
- dev_dbg(codec->dev, "%s: MCLK Rate = %x\n",
+ dev_dbg(component->dev, "%s: MCLK Rate = %x\n",
__func__, control->mclk_rate);
if (control->mclk_rate == TASHA_MCLK_CLK_12P288MHZ)
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_CLK_MCLK_CFG,
- 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_CLK_MCLK_CFG,
+ 0x03, 0x00);
else if (control->mclk_rate == TASHA_MCLK_CLK_9P6MHZ)
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_CLK_MCLK_CFG,
- 0x03, 0x01);
- tasha_codec_init_reg(codec);
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_CLK_MCLK_CFG,
+ 0x03, 0x01);
+ tasha_codec_init_reg(component);
wcd_resmgr_post_ssr_v2(tasha->resmgr);
- tasha_enable_efuse_sensing(codec);
+ tasha_enable_efuse_sensing(component);
- regcache_mark_dirty(codec->component.regmap);
- regcache_sync(codec->component.regmap);
+ regcache_mark_dirty(component->regmap);
+ regcache_sync(component->regmap);
- pdata = dev_get_platdata(codec->dev->parent);
+ pdata = dev_get_platdata(component->dev->parent);
ret = tasha_handle_pdata(tasha, pdata);
if (ret < 0)
- dev_err(codec->dev, "%s: invalid pdata\n", __func__);
+ dev_err(component->dev, "%s: invalid pdata\n", __func__);
/* Reset reference counter for voting for max bw */
tasha->ref_count = 0;
@@ -13425,23 +13791,23 @@
tasha->mbhc_started = false;
/* Initialize MBHC module */
- ret = wcd_mbhc_init(&tasha->mbhc, codec, &mbhc_cb, &intr_ids,
+ ret = wcd_mbhc_init(&tasha->mbhc, component, &mbhc_cb, &intr_ids,
wcd_mbhc_registers, TASHA_ZDET_SUPPORTED);
if (ret)
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
else
- tasha_mbhc_hs_detect(codec, tasha->mbhc.mbhc_cfg);
+ tasha_mbhc_hs_detect(component, tasha->mbhc.mbhc_cfg);
tasha_cleanup_irqs(tasha);
ret = tasha_setup_irqs(tasha);
if (ret) {
- dev_err(codec->dev, "%s: tasha irq setup failed %d\n",
+ dev_err(component->dev, "%s: tasha irq setup failed %d\n",
__func__, ret);
goto err;
}
- tasha_set_spkr_mode(codec, tasha->spkr_mode);
+ tasha_set_spkr_mode(component, tasha->spkr_mode);
wcd_cpe_ssr_event(tasha->cpe_core, WCD_CPE_BUS_UP_EVENT);
err:
@@ -13450,12 +13816,12 @@
}
static struct regulator *tasha_codec_find_ondemand_regulator(
- struct snd_soc_codec *codec, const char *name)
+ struct snd_soc_component *component, const char *name)
{
int i;
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct wcd9xxx *wcd9xxx = tasha->wcd9xxx;
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
+ struct wcd9xxx_pdata *pdata = dev_get_platdata(component->dev->parent);
for (i = 0; i < wcd9xxx->num_of_supplies; ++i) {
if (pdata->regulator[i].ondemand &&
@@ -13469,32 +13835,35 @@
return NULL;
}
-static int tasha_codec_probe(struct snd_soc_codec *codec)
+static int tasha_codec_probe(struct snd_soc_component *component)
{
struct wcd9xxx *control;
struct tasha_priv *tasha;
struct wcd9xxx_pdata *pdata;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
int i, ret;
void *ptr = NULL;
struct regulator *supply;
- control = dev_get_drvdata(codec->dev->parent);
+ control = dev_get_drvdata(component->dev->parent);
- dev_info(codec->dev, "%s()\n", __func__);
- tasha = snd_soc_codec_get_drvdata(codec);
+ snd_soc_component_init_regmap(component, control->regmap);
+
+ dev_info(component->dev, "%s()\n", __func__);
+ tasha = snd_soc_component_get_drvdata(component);
tasha->intf_type = wcd9xxx_get_intf_type();
if (tasha->intf_type == WCD9XXX_INTERFACE_TYPE_SLIMBUS) {
control->dev_down = tasha_device_down;
control->post_reset = tasha_post_reset_cb;
- control->ssr_priv = (void *)codec;
+ control->ssr_priv = (void *)component;
}
/* Resource Manager post Init */
- ret = wcd_resmgr_post_init(tasha->resmgr, &tasha_resmgr_cb, codec);
+ ret = wcd_resmgr_post_init(tasha->resmgr, &tasha_resmgr_cb, component);
if (ret) {
- dev_err(codec->dev, "%s: wcd resmgr post init failed\n",
+ dev_err(component->dev, "%s: wcd resmgr post init failed\n",
__func__);
goto err;
}
@@ -13503,32 +13872,34 @@
/* Default HPH Mode to Class-H HiFi */
tasha->hph_mode = CLS_H_HIFI;
- tasha->codec = codec;
+ tasha->component = component;
for (i = 0; i < COMPANDER_MAX; i++)
tasha->comp_enabled[i] = 0;
tasha->spkr_gain_offset = RX_GAIN_OFFSET_0_DB;
tasha->intf_type = wcd9xxx_get_intf_type();
- tasha_update_reg_reset_values(codec);
+ tasha_update_reg_reset_values(component);
pr_debug("%s: MCLK Rate = %x\n", __func__, control->mclk_rate);
if (control->mclk_rate == TASHA_MCLK_CLK_12P288MHZ)
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_CLK_MCLK_CFG,
- 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_CLK_MCLK_CFG,
+ 0x03, 0x00);
else if (control->mclk_rate == TASHA_MCLK_CLK_9P6MHZ)
- snd_soc_update_bits(codec, WCD9335_CODEC_RPM_CLK_MCLK_CFG,
- 0x03, 0x01);
- tasha_codec_init_reg(codec);
+ snd_soc_component_update_bits(component,
+ WCD9335_CODEC_RPM_CLK_MCLK_CFG,
+ 0x03, 0x01);
+ tasha_codec_init_reg(component);
- tasha_enable_efuse_sensing(codec);
+ tasha_enable_efuse_sensing(component);
- pdata = dev_get_platdata(codec->dev->parent);
+ pdata = dev_get_platdata(component->dev->parent);
ret = tasha_handle_pdata(tasha, pdata);
if (ret < 0) {
pr_err("%s: bad pdata\n", __func__);
goto err;
}
- supply = tasha_codec_find_ondemand_regulator(codec,
+ supply = tasha_codec_find_ondemand_regulator(component,
on_demand_supply_name[ON_DEMAND_MICBIAS]);
if (supply) {
tasha->on_demand_list[ON_DEMAND_MICBIAS].supply = supply;
@@ -13536,7 +13907,7 @@
0;
}
- tasha->fw_data = devm_kzalloc(codec->dev,
+ tasha->fw_data = devm_kzalloc(component->dev,
sizeof(*(tasha->fw_data)), GFP_KERNEL);
if (!tasha->fw_data)
goto err;
@@ -13546,9 +13917,9 @@
set_bit(WCD9XXX_VBAT_CAL, tasha->fw_data->cal_bit);
ret = wcd_cal_create_hwdep(tasha->fw_data,
- WCD9XXX_CODEC_HWDEP_NODE, codec);
+ WCD9XXX_CODEC_HWDEP_NODE, component);
if (ret < 0) {
- dev_err(codec->dev, "%s hwdep failed %d\n", __func__, ret);
+ dev_err(component->dev, "%s hwdep failed %d\n", __func__, ret);
goto err_hwdep;
}
@@ -13558,14 +13929,14 @@
WCD9335_MBHC_FSM_STATUS;
wcd_mbhc_registers[WCD_MBHC_FSM_STATUS].mask = 0x01;
}
- ret = wcd_mbhc_init(&tasha->mbhc, codec, &mbhc_cb, &intr_ids,
+ ret = wcd_mbhc_init(&tasha->mbhc, component, &mbhc_cb, &intr_ids,
wcd_mbhc_registers, TASHA_ZDET_SUPPORTED);
if (ret) {
pr_err("%s: mbhc initialization failed\n", __func__);
goto err_hwdep;
}
- ptr = devm_kzalloc(codec->dev, (sizeof(tasha_rx_chs) +
+ ptr = devm_kzalloc(component->dev, (sizeof(tasha_rx_chs) +
sizeof(tasha_tx_chs)), GFP_KERNEL);
if (!ptr) {
ret = -ENOMEM;
@@ -13592,19 +13963,19 @@
control->slim->laddr;
tasha_slimbus_slave_port_cfg.slave_port_mapping[0] =
TASHA_TX13;
- tasha_init_slim_slave_cfg(codec);
+ tasha_init_slim_slave_cfg(component);
}
- snd_soc_add_codec_controls(codec, impedance_detect_controls,
+ snd_soc_add_component_controls(component, impedance_detect_controls,
ARRAY_SIZE(impedance_detect_controls));
- snd_soc_add_codec_controls(codec, hph_type_detect_controls,
+ snd_soc_add_component_controls(component, hph_type_detect_controls,
ARRAY_SIZE(hph_type_detect_controls));
- snd_soc_add_codec_controls(codec,
+ snd_soc_add_component_controls(component,
tasha_analog_gain_controls,
ARRAY_SIZE(tasha_analog_gain_controls));
if (tasha->is_wsa_attach)
- snd_soc_add_codec_controls(codec,
+ snd_soc_add_component_controls(component,
tasha_spkr_wsa_controls,
ARRAY_SIZE(tasha_spkr_wsa_controls));
control->num_rx_port = TASHA_RX_MAX;
@@ -13637,9 +14008,9 @@
goto err_pdata;
}
- ret = tasha_cpe_initialize(codec);
+ ret = tasha_cpe_initialize(component);
if (ret) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: cpe initialization failed, err = %d\n",
__func__, ret);
/* Do not fail probe if CPE failed */
@@ -13682,22 +14053,22 @@
return ret;
err_pdata:
- devm_kfree(codec->dev, ptr);
+ devm_kfree(component->dev, ptr);
control->rx_chs = NULL;
control->tx_chs = NULL;
err_hwdep:
- devm_kfree(codec->dev, tasha->fw_data);
+ devm_kfree(component->dev, tasha->fw_data);
tasha->fw_data = NULL;
err:
return ret;
}
-static int tasha_codec_remove(struct snd_soc_codec *codec)
+static void tasha_codec_remove(struct snd_soc_component *component)
{
- struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ struct tasha_priv *tasha = snd_soc_component_get_drvdata(component);
struct wcd9xxx *control;
- control = dev_get_drvdata(codec->dev->parent);
+ control = dev_get_drvdata(component->dev->parent);
control->num_rx_port = 0;
control->num_tx_port = 0;
control->rx_chs = NULL;
@@ -13708,28 +14079,19 @@
wcd_mbhc_deinit(&tasha->mbhc);
/* Cleanup resmgr */
- return 0;
+ return;
}
-static struct regmap *tasha_get_regmap(struct device *dev)
-{
- struct wcd9xxx *control = dev_get_drvdata(dev->parent);
-
- return control->regmap;
-}
-
-static struct snd_soc_codec_driver soc_codec_dev_tasha = {
+static const struct snd_soc_component_driver soc_codec_dev_tasha = {
+ .name = DRV_NAME,
.probe = tasha_codec_probe,
.remove = tasha_codec_remove,
- .get_regmap = tasha_get_regmap,
- .component_driver = {
- .controls = tasha_snd_controls,
- .num_controls = ARRAY_SIZE(tasha_snd_controls),
- .dapm_widgets = tasha_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(tasha_dapm_widgets),
- .dapm_routes = audio_map,
- .num_dapm_routes = ARRAY_SIZE(audio_map),
- },
+ .controls = tasha_snd_controls,
+ .num_controls = ARRAY_SIZE(tasha_snd_controls),
+ .dapm_widgets = tasha_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(tasha_dapm_widgets),
+ .dapm_routes = audio_map,
+ .num_dapm_routes = ARRAY_SIZE(audio_map),
};
#ifdef CONFIG_PM
@@ -14123,7 +14485,7 @@
/*
* tasha_codec_ver: to get tasha codec version
- * @codec: handle to snd_soc_codec *
+ * @codec: handle to snd_soc_component *
* return enum codec_variant - version
*/
enum codec_variant tasha_codec_ver(void)
@@ -14273,12 +14635,14 @@
tasha->wcd_native_clk = wcd_native_clk;
if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_SLIMBUS)
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_tasha,
- tasha_dai, ARRAY_SIZE(tasha_dai));
+ ret = snd_soc_register_component(&pdev->dev,
+ &soc_codec_dev_tasha,
+ tasha_dai, ARRAY_SIZE(tasha_dai));
else if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_I2C)
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_tasha,
- tasha_i2s_dai,
- ARRAY_SIZE(tasha_i2s_dai));
+ ret = snd_soc_register_component(&pdev->dev,
+ &soc_codec_dev_tasha,
+ tasha_i2s_dai,
+ ARRAY_SIZE(tasha_i2s_dai));
else
ret = -EINVAL;
if (ret) {
@@ -14328,7 +14692,7 @@
clk_put(tasha->wcd_native_clk);
mutex_destroy(&tasha->mclk_lock);
mutex_destroy(&tasha->sb_clk_gear_lock);
- snd_soc_unregister_codec(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
devm_kfree(&pdev->dev, tasha);
return 0;
}
diff --git a/asoc/codecs/wcd9335.h b/asoc/codecs/wcd9335.h
index f5f1038..203c6de 100644
--- a/asoc/codecs/wcd9335.h
+++ b/asoc/codecs/wcd9335.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#ifndef WCD9335_H
#define WCD9335_H
@@ -138,95 +130,102 @@
};
#if IS_ENABLED(CONFIG_SND_SOC_WCD9335)
-extern void *tasha_get_afe_config(struct snd_soc_codec *codec,
+extern void *tasha_get_afe_config(struct snd_soc_component *component,
enum afe_config_type config_type);
-extern int tasha_cdc_mclk_enable(struct snd_soc_codec *codec, int enable,
- bool dapm);
-extern int tasha_cdc_mclk_tx_enable(struct snd_soc_codec *codec, int enable,
- bool dapm);
-extern int tasha_enable_efuse_sensing(struct snd_soc_codec *codec);
-extern int tasha_mbhc_hs_detect(struct snd_soc_codec *codec,
+extern int tasha_cdc_mclk_enable(struct snd_soc_component *component,
+ int enable, bool dapm);
+extern int tasha_cdc_mclk_tx_enable(struct snd_soc_component *component,
+ int enable, bool dapm);
+extern int tasha_enable_efuse_sensing(struct snd_soc_component *component);
+extern int tasha_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg);
-extern void tasha_mbhc_hs_detect_exit(struct snd_soc_codec *codec);
+extern void tasha_mbhc_hs_detect_exit(struct snd_soc_component *component);
extern void tasha_mbhc_zdet_gpio_ctrl(
- int (*zdet_gpio_cb)(struct snd_soc_codec *codec, bool high),
- struct snd_soc_codec *codec);
+ int (*zdet_gpio_cb)(struct snd_soc_component *component,
+ bool high), struct snd_soc_component *component);
extern int tasha_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
extern void tasha_event_register(
- int (*machine_event_cb)(struct snd_soc_codec *codec,
+ int (*machine_event_cb)(struct snd_soc_component *component,
enum wcd9335_codec_event),
- struct snd_soc_codec *codec);
-extern int tasha_codec_enable_standalone_micbias(struct snd_soc_codec *codec,
- int micb_num,
- bool enable);
-extern int tasha_set_spkr_mode(struct snd_soc_codec *codec, int mode);
-extern int tasha_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset);
+ struct snd_soc_component *component);
+extern int tasha_codec_enable_standalone_micbias(
+ struct snd_soc_component *component,
+ int micb_num,
+ bool enable);
+extern int tasha_set_spkr_mode(struct snd_soc_component *component, int mode);
+extern int tasha_set_spkr_gain_offset(struct snd_soc_component *component,
+ int offset);
extern enum codec_variant tasha_codec_ver(void);
#else /* CONFIG_SND_SOC_WCD9335 */
-static inline void *tasha_get_afe_config(struct snd_soc_codec *codec,
+static inline void *tasha_get_afe_config(struct snd_soc_component *component,
enum afe_config_type config_type)
{
return NULL;
}
-static inline int tasha_cdc_mclk_enable(struct snd_soc_codec *codec,
+static inline int tasha_cdc_mclk_enable(struct snd_soc_component *component,
int enable,
bool dapm)
{
return 0;
}
-static inline int tasha_cdc_mclk_tx_enable(struct snd_soc_codec *codec,
+static inline int tasha_cdc_mclk_tx_enable(struct snd_soc_component *component,
int enable,
bool dapm)
{
return 0;
}
-static inline int tasha_enable_efuse_sensing(struct snd_soc_codec *codec)
+static inline int tasha_enable_efuse_sensing(
+ struct snd_soc_component *component)
{
return 0;
}
-static inline int tasha_mbhc_hs_detect(struct snd_soc_codec *codec,
+static inline int tasha_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg)
{
return 0;
}
-static inline void tasha_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
+static inline void tasha_mbhc_hs_detect_exit(
+ struct snd_soc_component *component)
{
}
static inline void tasha_mbhc_zdet_gpio_ctrl(
- int (*zdet_gpio_cb)(struct snd_soc_codec *codec, bool high),
- struct snd_soc_codec *codec)
+ int (*zdet_gpio_cb)(struct snd_soc_component *component,
+ bool high),
+ struct snd_soc_component *component)
{
}
static inline int tasha_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return 0;
}
static inline void tasha_event_register(
- int (*machine_event_cb)(struct snd_soc_codec *codec,
+ int (*machine_event_cb)(struct snd_soc_component *component,
enum wcd9335_codec_event),
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
}
static inline int tasha_codec_enable_standalone_micbias(
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
int micb_num,
bool enable)
{
return 0;
}
-static inline int tasha_set_spkr_mode(struct snd_soc_codec *codec, int mode)
+static inline int tasha_set_spkr_mode(struct snd_soc_component *component,
+ int mode)
{
return 0;
}
-static inline int tasha_set_spkr_gain_offset(struct snd_soc_codec *codec,
- int offset)
+static inline int tasha_set_spkr_gain_offset(
+ struct snd_soc_component *component,
+ int offset)
{
return 0;
}
diff --git a/asoc/codecs/wcd9335_irq.h b/asoc/codecs/wcd9335_irq.h
index c666d31..ae81a1a 100644
--- a/asoc/codecs/wcd9335_irq.h
+++ b/asoc/codecs/wcd9335_irq.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD9335_IRQ_H_
diff --git a/asoc/codecs/wcd9335_registers.h b/asoc/codecs/wcd9335_registers.h
index c50430d..4af4e1b 100644
--- a/asoc/codecs/wcd9335_registers.h
+++ b/asoc/codecs/wcd9335_registers.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WCD9335_REGISTERS_H
diff --git a/asoc/codecs/wcd934x/wcd934x-dsd.c b/asoc/codecs/wcd934x/wcd934x-dsd.c
index eea18c3..0a9c556 100644
--- a/asoc/codecs/wcd934x/wcd934x-dsd.c
+++ b/asoc/codecs/wcd934x/wcd934x-dsd.c
@@ -1,13 +1,5 @@
-/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -170,15 +162,15 @@
int interp_num)
{
unsigned int reg, val;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
- if (!dsd_conf || !dsd_conf->codec)
+ if (!dsd_conf || !dsd_conf->component)
return -EINVAL;
- codec = dsd_conf->codec;
+ component = dsd_conf->component;
if (!is_valid_dsd_interpolator(interp_num)) {
- dev_err(codec->dev, "%s: Invalid Interpolator: %d for DSD\n",
+ dev_err(component->dev, "%s: Invalid Interpolator: %d for DSD\n",
__func__, interp_num);
return -EINVAL;
}
@@ -204,7 +196,7 @@
return -EINVAL;
}
- snd_soc_update_bits(codec, reg, 0x02, val);
+ snd_soc_component_update_bits(component, reg, 0x02, val);
return 0;
}
@@ -218,17 +210,21 @@
*/
void tavil_dsd_reset(struct tavil_dsd_config *dsd_conf)
{
- if (!dsd_conf || !dsd_conf->codec)
+ if (!dsd_conf || !dsd_conf->component)
return;
- snd_soc_update_bits(dsd_conf->codec, WCD934X_CDC_DSD0_PATH_CTL,
- 0x02, 0x02);
- snd_soc_update_bits(dsd_conf->codec, WCD934X_CDC_DSD0_PATH_CTL,
- 0x01, 0x00);
- snd_soc_update_bits(dsd_conf->codec, WCD934X_CDC_DSD1_PATH_CTL,
- 0x02, 0x02);
- snd_soc_update_bits(dsd_conf->codec, WCD934X_CDC_DSD1_PATH_CTL,
- 0x01, 0x00);
+ snd_soc_component_update_bits(dsd_conf->component,
+ WCD934X_CDC_DSD0_PATH_CTL,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(dsd_conf->component,
+ WCD934X_CDC_DSD0_PATH_CTL,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(dsd_conf->component,
+ WCD934X_CDC_DSD1_PATH_CTL,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(dsd_conf->component,
+ WCD934X_CDC_DSD1_PATH_CTL,
+ 0x01, 0x00);
}
EXPORT_SYMBOL(tavil_dsd_reset);
@@ -248,17 +244,17 @@
u8 val0, val1;
u8 dsd0_out_sel, dsd1_out_sel;
u16 int_fs_reg, interp_num = 0;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
- if (!dsd_conf || !dsd_conf->codec)
+ if (!dsd_conf || !dsd_conf->component)
return;
- codec = dsd_conf->codec;
+ component = dsd_conf->component;
dsd_inp_sel = DSD_INP_SEL_RX0 + rx_port - WCD934X_RX_PORT_START_NUMBER;
- val0 = snd_soc_read(codec, WCD934X_CDC_DSD0_CFG0);
- val1 = snd_soc_read(codec, WCD934X_CDC_DSD1_CFG0);
+ val0 = snd_soc_component_read32(component, WCD934X_CDC_DSD0_CFG0);
+ val1 = snd_soc_component_read32(component, WCD934X_CDC_DSD1_CFG0);
dsd0_inp = (val0 & 0x3C) >> 2;
dsd1_inp = (val1 & 0x3C) >> 2;
dsd0_out_sel = (val0 & 0x02) >> 1;
@@ -278,23 +274,24 @@
if (interp_num) {
int_fs_reg = WCD934X_CDC_RX0_RX_PATH_CTL + 20 * interp_num;
- if ((snd_soc_read(codec, int_fs_reg) & 0x0f) < 0x09) {
- dev_dbg(codec->dev, "%s: Set Interp %d to sample_rate val 0x%x\n",
+ if ((snd_soc_component_read32(component, int_fs_reg) & 0x0f) <
+ 0x09) {
+ dev_dbg(component->dev, "%s: Set Interp %d to sample_rate val 0x%x\n",
__func__, interp_num, sample_rate_val);
- snd_soc_update_bits(codec, int_fs_reg, 0x0F,
- sample_rate_val);
+ snd_soc_component_update_bits(component, int_fs_reg,
+ 0x0F, sample_rate_val);
}
}
}
EXPORT_SYMBOL(tavil_dsd_set_interp_rate);
-static int tavil_set_dsd_mode(struct snd_soc_codec *codec, int dsd_num,
+static int tavil_set_dsd_mode(struct snd_soc_component *component, int dsd_num,
u8 *pcm_rate_val)
{
unsigned int dsd_out_sel_reg;
u8 dsd_mode;
u32 sample_rate;
- struct tavil_dsd_config *dsd_conf = tavil_get_dsd_config(codec);
+ struct tavil_dsd_config *dsd_conf = tavil_get_dsd_config(component);
if (!dsd_conf)
return -EINVAL;
@@ -315,17 +312,19 @@
*pcm_rate_val = 0xc;
break;
default:
- dev_err(codec->dev, "%s: Invalid DSD rate: %d\n",
+ dev_err(component->dev, "%s: Invalid DSD rate: %d\n",
__func__, sample_rate);
return -EINVAL;
}
- snd_soc_update_bits(codec, dsd_out_sel_reg, 0x01, dsd_mode);
+ snd_soc_component_update_bits(component, dsd_out_sel_reg,
+ 0x01, dsd_mode);
return 0;
}
-static void tavil_dsd_data_pull(struct snd_soc_codec *codec, int dsd_num,
+static void tavil_dsd_data_pull(struct snd_soc_component *component,
+ int dsd_num,
u8 pcm_rate_val, bool enable)
{
u8 clk_en, mute_en;
@@ -340,37 +339,41 @@
}
if (dsd_num & 0x01) {
- snd_soc_update_bits(codec, WCD934X_CDC_RX7_RX_PATH_MIX_CTL,
- 0x20, clk_en);
- dsd_inp_sel = (snd_soc_read(codec, WCD934X_CDC_DSD0_CFG0) &
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_MIX_CTL,
+ 0x20, clk_en);
+ dsd_inp_sel = (snd_soc_component_read32(
+ component, WCD934X_CDC_DSD0_CFG0) &
0x3C) >> 2;
dsd_inp_sel = (enable) ? dsd_inp_sel : 0;
if (dsd_inp_sel < 9) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX_INP_MUX_RX_INT7_CFG1,
0x0F, dsd_inp_sel);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX7_RX_PATH_MIX_CTL,
0x0F, pcm_rate_val);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX7_RX_PATH_MIX_CTL,
0x10, mute_en);
}
}
if (dsd_num & 0x02) {
- snd_soc_update_bits(codec, WCD934X_CDC_RX8_RX_PATH_MIX_CTL,
- 0x20, clk_en);
- dsd_inp_sel = (snd_soc_read(codec, WCD934X_CDC_DSD1_CFG0) &
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_MIX_CTL,
+ 0x20, clk_en);
+ dsd_inp_sel = (snd_soc_component_read32(
+ component, WCD934X_CDC_DSD1_CFG0) &
0x3C) >> 2;
dsd_inp_sel = (enable) ? dsd_inp_sel : 0;
if (dsd_inp_sel < 9) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX_INP_MUX_RX_INT8_CFG1,
0x0F, dsd_inp_sel);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX8_RX_PATH_MIX_CTL,
0x0F, pcm_rate_val);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX8_RX_PATH_MIX_CTL,
0x10, mute_en);
}
@@ -379,85 +382,99 @@
static void tavil_dsd_update_volume(struct tavil_dsd_config *dsd_conf)
{
- snd_soc_update_bits(dsd_conf->codec, WCD934X_CDC_TOP_TOP_CFG0,
- 0x01, 0x01);
- snd_soc_update_bits(dsd_conf->codec, WCD934X_CDC_TOP_TOP_CFG0,
- 0x01, 0x00);
+ snd_soc_component_update_bits(dsd_conf->component,
+ WCD934X_CDC_TOP_TOP_CFG0,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(dsd_conf->component,
+ WCD934X_CDC_TOP_TOP_CFG0,
+ 0x01, 0x00);
}
static int tavil_enable_dsd(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_dsd_config *dsd_conf = tavil_get_dsd_config(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_dsd_config *dsd_conf = tavil_get_dsd_config(component);
int rc, clk_users;
int interp_idx;
u8 pcm_rate_val;
if (!dsd_conf) {
- dev_err(codec->dev, "%s: null dsd_config pointer\n", __func__);
+ dev_err(component->dev, "%s: null dsd_config pointer\n",
+ __func__);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s: DSD%d, event: %d\n", __func__,
+ dev_dbg(component->dev, "%s: DSD%d, event: %d\n", __func__,
w->shift, event);
if (w->shift == DSD0) {
/* Read out select */
- if (snd_soc_read(codec, WCD934X_CDC_DSD0_CFG0) & 0x02)
+ if (snd_soc_component_read32(
+ component, WCD934X_CDC_DSD0_CFG0) & 0x02)
interp_idx = INTERP_LO1;
else
interp_idx = INTERP_HPHL;
} else if (w->shift == DSD1) {
/* Read out select */
- if (snd_soc_read(codec, WCD934X_CDC_DSD1_CFG0) & 0x02)
+ if (snd_soc_component_read32(
+ component, WCD934X_CDC_DSD1_CFG0) & 0x02)
interp_idx = INTERP_LO2;
else
interp_idx = INTERP_HPHR;
} else {
- dev_err(codec->dev, "%s: Unsupported DSD:%d\n",
+ dev_err(component->dev, "%s: Unsupported DSD:%d\n",
__func__, w->shift);
return -EINVAL;
}
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- clk_users = tavil_codec_enable_interp_clk(codec, event,
+ clk_users = tavil_codec_enable_interp_clk(component, event,
interp_idx);
- rc = tavil_set_dsd_mode(codec, w->shift, &pcm_rate_val);
+ rc = tavil_set_dsd_mode(component, w->shift, &pcm_rate_val);
if (rc)
return rc;
- tavil_dsd_data_pull(codec, (1 << w->shift), pcm_rate_val,
+ tavil_dsd_data_pull(component, (1 << w->shift), pcm_rate_val,
true);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_CLK_RST_CTRL_DSD_CONTROL, 0x01,
0x01);
if (w->shift == DSD0) {
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_PATH_CTL,
- 0x02, 0x02);
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_PATH_CTL,
- 0x02, 0x00);
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_PATH_CTL,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_PATH_CTL,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_PATH_CTL,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_PATH_CTL,
+ 0x01, 0x01);
/* Apply Gain */
- snd_soc_write(codec, WCD934X_CDC_DSD0_CFG1,
- dsd_conf->volume[DSD0]);
+ snd_soc_component_write(component,
+ WCD934X_CDC_DSD0_CFG1,
+ dsd_conf->volume[DSD0]);
if (dsd_conf->version == TAVIL_VERSION_1_1)
tavil_dsd_update_volume(dsd_conf);
} else if (w->shift == DSD1) {
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_PATH_CTL,
- 0x02, 0x02);
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_PATH_CTL,
- 0x02, 0x00);
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_PATH_CTL,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_PATH_CTL,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_PATH_CTL,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_PATH_CTL,
+ 0x01, 0x01);
/* Apply Gain */
- snd_soc_write(codec, WCD934X_CDC_DSD1_CFG1,
- dsd_conf->volume[DSD1]);
+ snd_soc_component_write(component,
+ WCD934X_CDC_DSD1_CFG1,
+ dsd_conf->volume[DSD1]);
if (dsd_conf->version == TAVIL_VERSION_1_1)
tavil_dsd_update_volume(dsd_conf);
}
@@ -465,14 +482,15 @@
usleep_range(10000, 10100);
if (clk_users > 1) {
- snd_soc_update_bits(codec, WCD934X_ANA_RX_SUPPLIES,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_RX_SUPPLIES,
+ 0x02, 0x02);
if (w->shift == DSD0)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_DSD0_CFG2,
0x04, 0x00);
if (w->shift == DSD1)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_DSD1_CFG2,
0x04, 0x00);
@@ -480,25 +498,31 @@
break;
case SND_SOC_DAPM_POST_PMD:
if (w->shift == DSD0) {
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_CFG2,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_PATH_CTL,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_CFG2,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_PATH_CTL,
+ 0x01, 0x00);
} else if (w->shift == DSD1) {
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_CFG2,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_PATH_CTL,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_CFG2,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_PATH_CTL,
+ 0x01, 0x00);
}
- tavil_codec_enable_interp_clk(codec, event, interp_idx);
+ tavil_codec_enable_interp_clk(component, event, interp_idx);
- if (!(snd_soc_read(codec, WCD934X_CDC_DSD0_PATH_CTL) & 0x01) &&
- !(snd_soc_read(codec, WCD934X_CDC_DSD1_PATH_CTL) & 0x01)) {
- snd_soc_update_bits(codec,
+ if (!(snd_soc_component_read32(
+ component, WCD934X_CDC_DSD0_PATH_CTL) & 0x01) &&
+ !(snd_soc_component_read32(
+ component, WCD934X_CDC_DSD1_PATH_CTL) & 0x01)) {
+ snd_soc_component_update_bits(component,
WCD934X_CDC_CLK_RST_CTRL_DSD_CONTROL,
0x01, 0x00);
- tavil_dsd_data_pull(codec, 0x03, 0x04, false);
+ tavil_dsd_data_pull(component, 0x03, 0x04, false);
tavil_dsd_reset(dsd_conf);
}
break;
@@ -521,8 +545,9 @@
static int tavil_dsd_vol_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_dsd_config *dsd_conf = tavil_get_dsd_config(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_dsd_config *dsd_conf = tavil_get_dsd_config(component);
int nv[DSD_MAX], cv[DSD_MAX];
int step_size, nv1;
int i, dsd_idx;
@@ -545,7 +570,7 @@
if (cv[dsd_idx] == nv[dsd_idx])
continue;
- dev_dbg(codec->dev, "%s: DSD%d cur.vol: %d, new vol: %d\n",
+ dev_dbg(component->dev, "%s: DSD%d cur.vol: %d, new vol: %d\n",
__func__, dsd_idx, cv[dsd_idx], nv[dsd_idx]);
step_size = (nv[dsd_idx] - cv[dsd_idx]) /
@@ -555,7 +580,7 @@
for (i = 0; i < DSD_VOLUME_STEPS; i++) {
nv1 += step_size;
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_DSD0_CFG1 + 16 * dsd_idx,
nv1);
if (dsd_conf->version == TAVIL_VERSION_1_1)
@@ -567,7 +592,7 @@
DSD_VOLUME_USLEEP_MARGIN_US));
}
if (nv1 != nv[dsd_idx]) {
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_DSD0_CFG1 + 16 * dsd_idx,
nv[dsd_idx]);
@@ -587,8 +612,9 @@
static int tavil_dsd_vol_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_dsd_config *dsd_conf = tavil_get_dsd_config(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_dsd_config *dsd_conf = tavil_get_dsd_config(component);
if (dsd_conf) {
ucontrol->value.integer.value[0] = dsd_conf->volume[DSD0];
@@ -626,45 +652,63 @@
/**
* tavil_dsd_post_ssr_init - DSD intialization after subsystem restart
*
- * @codec: pointer to snd_soc_codec
+ * @component: pointer to snd_soc_component
*
* Returns 0 on success or error on failure
*/
int tavil_dsd_post_ssr_init(struct tavil_dsd_config *dsd_conf)
{
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
- if (!dsd_conf || !dsd_conf->codec)
+ if (!dsd_conf || !dsd_conf->component)
return -EINVAL;
- codec = dsd_conf->codec;
+ component = dsd_conf->component;
/* Disable DSD Interrupts */
- snd_soc_update_bits(codec, WCD934X_INTR_CODEC_MISC_MASK, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD934X_INTR_CODEC_MISC_MASK,
+ 0x08, 0x08);
/* DSD registers init */
if (dsd_conf->version == TAVIL_VERSION_1_0) {
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_CFG2, 0x02, 0x00);
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_CFG2, 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_CFG2,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_CFG2,
+ 0x02, 0x00);
}
/* DSD0: Mute EN */
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_CFG2, 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_CFG2,
+ 0x04, 0x04);
/* DSD1: Mute EN */
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_CFG2, 0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG3, 0x10,
- 0x10);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG3, 0x10,
- 0x10);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG0, 0x0E,
- 0x0A);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG0, 0x0E,
- 0x0A);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG1, 0x07,
- 0x04);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG1, 0x07,
- 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_CFG2,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG3,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG3,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG0,
+ 0x0E, 0x0A);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG0,
+ 0x0E, 0x0A);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG1,
+ 0x07, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG1,
+ 0x07, 0x04);
/* Enable DSD Interrupts */
- snd_soc_update_bits(codec, WCD934X_INTR_CODEC_MISC_MASK, 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_INTR_CODEC_MISC_MASK,
+ 0x08, 0x00);
return 0;
}
@@ -673,60 +717,71 @@
/**
* tavil_dsd_init - DSD intialization
*
- * @codec: pointer to snd_soc_codec
+ * @component: pointer to snd_soc_component
*
* Returns pointer to tavil_dsd_config for success or NULL for failure
*/
-struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_codec *codec)
+struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_component *component)
{
struct snd_soc_dapm_context *dapm;
struct tavil_dsd_config *dsd_conf;
u8 val;
- if (!codec)
+ if (!component)
return NULL;
- dapm = snd_soc_codec_get_dapm(codec);
+ dapm = snd_soc_component_get_dapm(component);
/* Read efuse register to check if DSD is supported */
- val = snd_soc_read(codec, WCD934X_CHIP_TIER_CTRL_EFUSE_VAL_OUT14);
+ val = snd_soc_component_read32(component,
+ WCD934X_CHIP_TIER_CTRL_EFUSE_VAL_OUT14);
if (val & 0x80) {
- dev_info(codec->dev, "%s: DSD unsupported for this codec version\n",
+ dev_info(component->dev, "%s: DSD unsupported for this codec version\n",
__func__);
return NULL;
}
- dsd_conf = devm_kzalloc(codec->dev, sizeof(struct tavil_dsd_config),
+ dsd_conf = devm_kzalloc(component->dev, sizeof(struct tavil_dsd_config),
GFP_KERNEL);
if (!dsd_conf)
return NULL;
- dsd_conf->codec = codec;
+ dsd_conf->component = component;
/* Read version */
- dsd_conf->version = snd_soc_read(codec,
+ dsd_conf->version = snd_soc_component_read32(component,
WCD934X_CHIP_TIER_CTRL_CHIP_ID_BYTE0);
/* DSD registers init */
if (dsd_conf->version == TAVIL_VERSION_1_0) {
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_CFG2, 0x02, 0x00);
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_CFG2, 0x02, 0x00);
+ snd_soc_component_update_bits(component, WCD934X_CDC_DSD0_CFG2,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, WCD934X_CDC_DSD1_CFG2,
+ 0x02, 0x00);
}
/* DSD0: Mute EN */
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_CFG2, 0x04, 0x04);
+ snd_soc_component_update_bits(component, WCD934X_CDC_DSD0_CFG2,
+ 0x04, 0x04);
/* DSD1: Mute EN */
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_CFG2, 0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG3, 0x10,
- 0x10);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG3, 0x10,
- 0x10);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG0, 0x0E,
- 0x0A);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG0, 0x0E,
- 0x0A);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG1, 0x07,
- 0x04);
- snd_soc_update_bits(codec, WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG1, 0x07,
- 0x04);
+ snd_soc_component_update_bits(component, WCD934X_CDC_DSD1_CFG2,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG3,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG3,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG0,
+ 0x0E, 0x0A);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG0,
+ 0x0E, 0x0A);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD0_DEBUG_CFG1,
+ 0x07, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DEBUG_DSD1_DEBUG_CFG1,
+ 0x07, 0x04);
snd_soc_dapm_new_controls(dapm, tavil_dsd_widgets,
ARRAY_SIZE(tavil_dsd_widgets));
@@ -738,11 +793,12 @@
dsd_conf->volume[DSD0] = DSD_VOLUME_MAX_0dB;
dsd_conf->volume[DSD1] = DSD_VOLUME_MAX_0dB;
- snd_soc_add_codec_controls(codec, tavil_dsd_vol_controls,
+ snd_soc_add_component_controls(component, tavil_dsd_vol_controls,
ARRAY_SIZE(tavil_dsd_vol_controls));
/* Enable DSD Interrupts */
- snd_soc_update_bits(codec, WCD934X_INTR_CODEC_MISC_MASK, 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_INTR_CODEC_MISC_MASK, 0x08, 0x00);
return dsd_conf;
}
@@ -755,18 +811,19 @@
*/
void tavil_dsd_deinit(struct tavil_dsd_config *dsd_conf)
{
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
if (!dsd_conf)
return;
- codec = dsd_conf->codec;
+ component = dsd_conf->component;
mutex_destroy(&dsd_conf->vol_mutex);
/* Disable DSD Interrupts */
- snd_soc_update_bits(codec, WCD934X_INTR_CODEC_MISC_MASK, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD934X_INTR_CODEC_MISC_MASK, 0x08, 0x08);
- devm_kfree(codec->dev, dsd_conf);
+ devm_kfree(component->dev, dsd_conf);
}
EXPORT_SYMBOL(tavil_dsd_deinit);
diff --git a/asoc/codecs/wcd934x/wcd934x-dsd.h b/asoc/codecs/wcd934x/wcd934x-dsd.h
index 834b96c..e078c07 100644
--- a/asoc/codecs/wcd934x/wcd934x-dsd.h
+++ b/asoc/codecs/wcd934x/wcd934x-dsd.h
@@ -1,13 +1,5 @@
-/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __WCD934X_DSD_H__
@@ -35,7 +27,7 @@
};
struct tavil_dsd_config {
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
unsigned int dsd_interp_mixer[INTERP_MAX];
u32 base_sample_rate[DSD_MAX];
int volume[DSD_MAX];
@@ -53,7 +45,7 @@
void tavil_dsd_reset(struct tavil_dsd_config *dsd_conf);
void tavil_dsd_set_interp_rate(struct tavil_dsd_config *dsd_conf, u16 rx_port,
u32 sample_rate, u8 sample_rate_val);
-struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_codec *codec);
+struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_component *component);
void tavil_dsd_deinit(struct tavil_dsd_config *dsd_config);
int tavil_dsd_post_ssr_init(struct tavil_dsd_config *dsd_config);
#else
@@ -82,7 +74,7 @@
u32 sample_rate, u8 sample_rate_val)
{ }
-struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_codec *codec)
+struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_component *component)
{
return NULL;
}
diff --git a/asoc/codecs/wcd934x/wcd934x-dsp-cntl.c b/asoc/codecs/wcd934x/wcd934x-dsp-cntl.c
index f18cc81..e64b158 100644
--- a/asoc/codecs/wcd934x/wcd934x-dsp-cntl.c
+++ b/asoc/codecs/wcd934x/wcd934x-dsp-cntl.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/slab.h>
@@ -33,16 +25,16 @@
#define WCD_934X_RAMDUMP_SIZE ((1024 * 1024) - 128)
#define WCD_MISCDEV_CMD_MAX_LEN 11
-#define WCD_CNTL_MUTEX_LOCK(codec, lock) \
+#define WCD_CNTL_MUTEX_LOCK(component, lock) \
{ \
- dev_dbg(codec->dev, "%s: mutex_lock(%s)\n", \
+ dev_dbg(component->dev, "%s: mutex_lock(%s)\n", \
__func__, __stringify_1(lock)); \
mutex_lock(&lock); \
}
-#define WCD_CNTL_MUTEX_UNLOCK(codec, lock) \
+#define WCD_CNTL_MUTEX_UNLOCK(component, lock) \
{ \
- dev_dbg(codec->dev, "%s: mutex_unlock(%s)\n", \
+ dev_dbg(component->dev, "%s: mutex_unlock(%s)\n", \
__func__, __stringify_1(lock)); \
mutex_unlock(&lock); \
}
@@ -117,7 +109,7 @@
static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl,
bool internal)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
struct wdsp_err_signal_arg arg;
enum wdsp_signal signal;
int i;
@@ -128,21 +120,22 @@
return;
/* Mask all error interrupts */
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A,
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A,
0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B,
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B,
0xFF);
/* Collect important WDSP registers dump for debug use */
pr_err("%s: Dump the WDSP registers for debug use\n", __func__);
for (i = 0; i < sizeof(wdsp_reg_for_debug_dump)/sizeof(u16); i++) {
- val = snd_soc_read(codec, wdsp_reg_for_debug_dump[i]);
+ val = snd_soc_component_read32(component,
+ wdsp_reg_for_debug_dump[i]);
pr_err("%s: reg = 0x%x, val = 0x%x\n", __func__,
wdsp_reg_for_debug_dump[i], val);
}
/* Trigger NMI in WDSP to sync and update the memory */
- snd_soc_write(codec, WCD934X_CPE_SS_BACKUP_INT, 0x02);
+ snd_soc_component_write(component, WCD934X_CPE_SS_BACKUP_INT, 0x02);
/* Collect WDSP ramdump for debug use */
if (cntl->m_dev && cntl->m_ops && cntl->m_ops->signal_handler) {
@@ -154,9 +147,9 @@
}
/* Unmask the fatal irqs */
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A,
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A,
~(cntl->irqs.fatal_irqs & 0xFF));
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B,
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B,
~((cntl->irqs.fatal_irqs >> 8) & 0xFF));
WCD_CNTL_CLR_ERR_IRQ_FLAG(cntl);
@@ -185,7 +178,7 @@
ret = kstrtou32(buf, 10, &val);
if (ret) {
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: Invalid entry, ret = %d\n", __func__, ret);
return -EINVAL;
}
@@ -205,7 +198,7 @@
ret = -EINVAL;
if (ret < 0)
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: failed to %s dsp\n", __func__,
vote ? "enable" : "disable");
return count;
@@ -255,17 +248,17 @@
struct wdsp_ssr_entry *ssr_entry = &cntl->ssr_entry;
unsigned long ret;
- WCD_CNTL_MUTEX_LOCK(cntl->codec, cntl->ssr_mutex);
+ WCD_CNTL_MUTEX_LOCK(cntl->component, cntl->ssr_mutex);
ssr_entry->offline = !online;
/* Make sure the write is complete */
wmb();
ret = xchg(&ssr_entry->offline_change, 1);
wake_up_interruptible(&ssr_entry->offline_poll_wait);
- dev_dbg(cntl->codec->dev,
+ dev_dbg(cntl->component->dev,
"%s: requested %u, offline %u offline_change %u, ret = %ldn",
__func__, online, ssr_entry->offline,
ssr_entry->offline_change, ret);
- WCD_CNTL_MUTEX_UNLOCK(cntl->codec, cntl->ssr_mutex);
+ WCD_CNTL_MUTEX_UNLOCK(cntl->component, cntl->ssr_mutex);
}
static ssize_t wdsp_ssr_entry_read(struct snd_info_entry *entry,
@@ -288,16 +281,16 @@
ssr_entry = &cntl->ssr_entry;
- WCD_CNTL_MUTEX_LOCK(cntl->codec, cntl->ssr_mutex);
+ WCD_CNTL_MUTEX_LOCK(cntl->component, cntl->ssr_mutex);
offline = ssr_entry->offline;
/* Make sure the read is complete */
rmb();
- dev_dbg(cntl->codec->dev, "%s: offline = %s\n", __func__,
+ dev_dbg(cntl->component->dev, "%s: offline = %s\n", __func__,
offline ? "true" : "false");
len = snprintf(buffer, sizeof(buffer), "%s\n",
offline ? "OFFLINE" : "ONLINE");
ret = simple_read_from_buffer(buf, count, &pos, buffer, len);
- WCD_CNTL_MUTEX_UNLOCK(cntl->codec, cntl->ssr_mutex);
+ WCD_CNTL_MUTEX_UNLOCK(cntl->component, cntl->ssr_mutex);
return ret;
}
@@ -319,18 +312,18 @@
cntl = (struct wcd_dsp_cntl *) entry->private_data;
ssr_entry = &cntl->ssr_entry;
- dev_dbg(cntl->codec->dev, "%s: Poll wait, offline = %u\n",
+ dev_dbg(cntl->component->dev, "%s: Poll wait, offline = %u\n",
__func__, ssr_entry->offline);
poll_wait(file, &ssr_entry->offline_poll_wait, wait);
- dev_dbg(cntl->codec->dev, "%s: Woken up Poll wait, offline = %u\n",
+ dev_dbg(cntl->component->dev, "%s: Woken up Poll wait, offline = %u\n",
__func__, ssr_entry->offline);
- WCD_CNTL_MUTEX_LOCK(cntl->codec, cntl->ssr_mutex);
+ WCD_CNTL_MUTEX_LOCK(cntl->component, cntl->ssr_mutex);
if (xchg(&ssr_entry->offline_change, 0))
ret = POLLIN | POLLPRI | POLLRDNORM;
- dev_dbg(cntl->codec->dev, "%s: ret (%d) from poll_wait\n",
+ dev_dbg(cntl->component->dev, "%s: ret (%d) from poll_wait\n",
__func__, ret);
- WCD_CNTL_MUTEX_UNLOCK(cntl->codec, cntl->ssr_mutex);
+ WCD_CNTL_MUTEX_UNLOCK(cntl->component, cntl->ssr_mutex);
return ret;
}
@@ -342,25 +335,25 @@
static int wcd_cntl_cpe_fll_calibrate(struct wcd_dsp_cntl *cntl)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
int ret = 0, retry = 0;
u8 cal_lsb, cal_msb;
u8 lock_det;
/* Make sure clocks are gated */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPE_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPE_CTL,
0x05, 0x00);
/* Enable CPE FLL reference clock */
- snd_soc_update_bits(codec, WCD934X_CLK_SYS_MCLK2_PRG1,
+ snd_soc_component_update_bits(component, WCD934X_CLK_SYS_MCLK2_PRG1,
0x80, 0x80);
- snd_soc_update_bits(codec, WCD934X_CPE_FLL_USER_CTL_5,
+ snd_soc_component_update_bits(component, WCD934X_CPE_FLL_USER_CTL_5,
0xF3, 0x13);
- snd_soc_write(codec, WCD934X_CPE_FLL_L_VAL_CTL_0, 0x50);
+ snd_soc_component_write(component, WCD934X_CPE_FLL_L_VAL_CTL_0, 0x50);
/* Disable CPAR reset and Enable CPAR clk */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPAR_CTL,
0x02, 0x02);
/* Write calibration l-value based on cdc clk rate */
@@ -371,56 +364,57 @@
cal_lsb = 0x56;
cal_msb = 0x00;
}
- snd_soc_write(codec, WCD934X_CPE_FLL_USER_CTL_6, cal_lsb);
- snd_soc_write(codec, WCD934X_CPE_FLL_USER_CTL_7, cal_msb);
+ snd_soc_component_write(component, WCD934X_CPE_FLL_USER_CTL_6, cal_lsb);
+ snd_soc_component_write(component, WCD934X_CPE_FLL_USER_CTL_7, cal_msb);
/* FLL mode to follow power up sequence */
- snd_soc_update_bits(codec, WCD934X_CPE_FLL_FLL_MODE,
+ snd_soc_component_update_bits(component, WCD934X_CPE_FLL_FLL_MODE,
0x60, 0x00);
/* HW controlled CPE FLL */
- snd_soc_update_bits(codec, WCD934X_CPE_FLL_FLL_MODE,
+ snd_soc_component_update_bits(component, WCD934X_CPE_FLL_FLL_MODE,
0x80, 0x80);
/* Force on CPE FLL */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CFG,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPAR_CFG,
0x04, 0x04);
do {
/* Time for FLL calibration to complete */
usleep_range(1000, 1100);
- lock_det = snd_soc_read(codec, WCD934X_CPE_FLL_STATUS_3);
+ lock_det = snd_soc_component_read32(
+ component, WCD934X_CPE_FLL_STATUS_3);
retry++;
} while (!(lock_det & 0x01) &&
retry <= WCD_CPE_FLL_MAX_RETRIES);
if (!(lock_det & 0x01)) {
- dev_err(codec->dev, "%s: lock detect not set, 0x%02x\n",
+ dev_err(component->dev, "%s: lock detect not set, 0x%02x\n",
__func__, lock_det);
ret = -EIO;
goto err_lock_det;
}
- snd_soc_update_bits(codec, WCD934X_CPE_FLL_FLL_MODE,
+ snd_soc_component_update_bits(component, WCD934X_CPE_FLL_FLL_MODE,
0x60, 0x20);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CFG,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPAR_CFG,
0x04, 0x00);
return ret;
err_lock_det:
/* Undo the register settings */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CFG,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPAR_CFG,
0x04, 0x00);
- snd_soc_update_bits(codec, WCD934X_CPE_FLL_FLL_MODE,
+ snd_soc_component_update_bits(component, WCD934X_CPE_FLL_FLL_MODE,
0x80, 0x00);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPAR_CTL,
0x02, 0x00);
return ret;
}
static void wcd_cntl_config_cpar(struct wcd_dsp_cntl *cntl)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
u8 nom_lo, nom_hi, svs2_lo, svs2_hi;
/* Configure CPAR */
@@ -433,25 +427,30 @@
svs2_lo = 0x3e;
}
- snd_soc_write(codec, WCD934X_TEST_DEBUG_LVAL_NOM_LOW, nom_lo);
- snd_soc_write(codec, WCD934X_TEST_DEBUG_LVAL_NOM_HIGH, nom_hi);
- snd_soc_write(codec, WCD934X_TEST_DEBUG_LVAL_SVS_SVS2_LOW, svs2_lo);
- snd_soc_write(codec, WCD934X_TEST_DEBUG_LVAL_SVS_SVS2_HIGH, svs2_hi);
+ snd_soc_component_write(component, WCD934X_TEST_DEBUG_LVAL_NOM_LOW,
+ nom_lo);
+ snd_soc_component_write(component, WCD934X_TEST_DEBUG_LVAL_NOM_HIGH,
+ nom_hi);
+ snd_soc_component_write(component, WCD934X_TEST_DEBUG_LVAL_SVS_SVS2_LOW,
+ svs2_lo);
+ snd_soc_component_write(component,
+ WCD934X_TEST_DEBUG_LVAL_SVS_SVS2_HIGH,
+ svs2_hi);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_PWR_CPEFLL_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_PWR_CPEFLL_CTL,
0x03, 0x03);
}
static int wcd_cntl_cpe_fll_ctrl(struct wcd_dsp_cntl *cntl,
bool enable)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
int ret = 0;
if (enable) {
ret = wcd_cntl_cpe_fll_calibrate(cntl);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: cpe_fll_cal failed, err = %d\n",
__func__, ret);
goto done;
@@ -460,18 +459,21 @@
wcd_cntl_config_cpar(cntl);
/* Enable AHB CLK and CPE CLK*/
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPE_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPE_CTL,
0x05, 0x05);
} else {
/* Disable AHB CLK and CPE CLK */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPE_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPE_CTL,
0x05, 0x00);
/* Reset the CPAR mode for CPE FLL */
- snd_soc_write(codec, WCD934X_CPE_FLL_FLL_MODE, 0x20);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CFG,
- 0x04, 0x00);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CTL,
- 0x02, 0x00);
+ snd_soc_component_write(component, WCD934X_CPE_FLL_FLL_MODE,
+ 0x20);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_CPAR_CFG,
+ 0x04, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_CPAR_CTL,
+ 0x02, 0x00);
}
done:
return ret;
@@ -479,29 +481,30 @@
static int wcd_cntl_clocks_enable(struct wcd_dsp_cntl *cntl)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
int ret;
- WCD_CNTL_MUTEX_LOCK(codec, cntl->clk_mutex);
+ WCD_CNTL_MUTEX_LOCK(component, cntl->clk_mutex);
/* Enable codec clock */
if (cntl->cdc_cb && cntl->cdc_cb->cdc_clk_en)
- ret = cntl->cdc_cb->cdc_clk_en(codec, true);
+ ret = cntl->cdc_cb->cdc_clk_en(component, true);
else
ret = -EINVAL;
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to enable cdc clk, err = %d\n",
__func__, ret);
goto done;
}
/* Pull CPAR out of reset */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CTL, 0x04, 0x00);
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPAR_CTL,
+ 0x04, 0x00);
/* Configure and Enable CPE FLL clock */
ret = wcd_cntl_cpe_fll_ctrl(cntl, true);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to enable cpe clk, err = %d\n",
__func__, ret);
goto err_cpe_clk;
@@ -509,39 +512,42 @@
cntl->is_clk_enabled = true;
/* Ungate the CPR clock */
- snd_soc_update_bits(codec, WCD934X_CODEC_RPM_CLK_GATE, 0x10, 0x00);
+ snd_soc_component_update_bits(component, WCD934X_CODEC_RPM_CLK_GATE,
+ 0x10, 0x00);
done:
- WCD_CNTL_MUTEX_UNLOCK(codec, cntl->clk_mutex);
+ WCD_CNTL_MUTEX_UNLOCK(component, cntl->clk_mutex);
return ret;
err_cpe_clk:
if (cntl->cdc_cb && cntl->cdc_cb->cdc_clk_en)
- cntl->cdc_cb->cdc_clk_en(codec, false);
+ cntl->cdc_cb->cdc_clk_en(component, false);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CTL, 0x04, 0x04);
- WCD_CNTL_MUTEX_UNLOCK(codec, cntl->clk_mutex);
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPAR_CTL,
+ 0x04, 0x04);
+ WCD_CNTL_MUTEX_UNLOCK(component, cntl->clk_mutex);
return ret;
}
static int wcd_cntl_clocks_disable(struct wcd_dsp_cntl *cntl)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
int ret = 0;
- WCD_CNTL_MUTEX_LOCK(codec, cntl->clk_mutex);
+ WCD_CNTL_MUTEX_LOCK(component, cntl->clk_mutex);
if (!cntl->is_clk_enabled) {
- dev_info(codec->dev, "%s: clocks already disabled\n",
+ dev_info(component->dev, "%s: clocks already disabled\n",
__func__);
goto done;
}
/* Gate the CPR clock */
- snd_soc_update_bits(codec, WCD934X_CODEC_RPM_CLK_GATE, 0x10, 0x10);
+ snd_soc_component_update_bits(component, WCD934X_CODEC_RPM_CLK_GATE,
+ 0x10, 0x10);
/* Disable CPE FLL clock */
ret = wcd_cntl_cpe_fll_ctrl(cntl, false);
if (ret < 0)
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to disable cpe clk, err = %d\n",
__func__, ret);
@@ -550,35 +556,38 @@
* the codec clock
*/
if (cntl->cdc_cb && cntl->cdc_cb->cdc_clk_en)
- ret = cntl->cdc_cb->cdc_clk_en(codec, false);
+ ret = cntl->cdc_cb->cdc_clk_en(component, false);
else
ret = -EINVAL;
cntl->is_clk_enabled = false;
/* Put CPAR in reset */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CTL, 0x04, 0x04);
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPAR_CTL,
+ 0x04, 0x04);
done:
- WCD_CNTL_MUTEX_UNLOCK(codec, cntl->clk_mutex);
+ WCD_CNTL_MUTEX_UNLOCK(component, cntl->clk_mutex);
return ret;
}
static void wcd_cntl_cpar_ctrl(struct wcd_dsp_cntl *cntl,
bool enable)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
if (enable)
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CTL, 0x03, 0x03);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_CPAR_CTL, 0x03, 0x03);
else
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPAR_CTL, 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_CPAR_CTL, 0x03, 0x00);
}
static int wcd_cntl_enable_memory(struct wcd_dsp_cntl *cntl,
enum wcd_mem_type mem_type)
{
- struct snd_soc_codec *codec = cntl->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component = cntl->component;
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
int loop_cnt = 0;
u8 status;
int ret = 0;
@@ -601,23 +610,26 @@
case WCD_MEM_TYPE_SWITCHABLE:
- snd_soc_update_bits(codec, WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL,
- 0x04, 0x00);
- snd_soc_update_bits(codec, WCD934X_TEST_DEBUG_MEM_CTRL,
- 0x80, 0x80);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL,
+ 0x04, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_TEST_DEBUG_MEM_CTRL,
+ 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL,
+ 0x01, 0x01);
do {
loop_cnt++;
/* Time to enable the power domain for memory */
usleep_range(100, 150);
- status = snd_soc_read(codec,
+ status = snd_soc_component_read32(component,
WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL);
} while ((status & 0x02) != 0x02 &&
loop_cnt != WCD_MEM_ENABLE_MAX_RETRIES);
if ((status & 0x02) != 0x02) {
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: power domain not enabled, status = 0x%02x\n",
__func__, status);
ret = -EIO;
@@ -634,20 +646,23 @@
ARRAY_SIZE(mem_enable_values),
mem_enable_values);
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN,
- 0x05);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN,
+ 0x05);
break;
default:
- dev_err(cntl->codec->dev, "%s: Invalid mem_type %d\n",
+ dev_err(cntl->component->dev, "%s: Invalid mem_type %d\n",
__func__, mem_type);
ret = -EINVAL;
break;
}
done:
/* Make sure Deep sleep of memories is enabled for all banks */
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0, 0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1, 0x0F);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0, 0xFF);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1, 0x0F);
return ret;
}
@@ -655,66 +670,76 @@
static void wcd_cntl_disable_memory(struct wcd_dsp_cntl *cntl,
enum wcd_mem_type mem_type)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
u8 val;
switch (mem_type) {
case WCD_MEM_TYPE_ALWAYS_ON:
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_1,
- 0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_0,
- 0xFF);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_1,
+ 0xFF);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_0,
+ 0xFF);
break;
case WCD_MEM_TYPE_SWITCHABLE:
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_3,
- 0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_2,
- 0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN,
- 0x07);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_3,
+ 0xFF);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_2,
+ 0xFF);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN,
+ 0x07);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL,
- 0x01, 0x00);
- val = snd_soc_read(codec, WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL,
+ 0x01, 0x00);
+ val = snd_soc_component_read32(component,
+ WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL);
if (val & 0x02)
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Disable switchable failed, val = 0x%02x",
__func__, val);
- snd_soc_update_bits(codec, WCD934X_TEST_DEBUG_MEM_CTRL,
- 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_TEST_DEBUG_MEM_CTRL,
+ 0x80, 0x00);
break;
default:
- dev_err(cntl->codec->dev, "%s: Invalid mem_type %d\n",
+ dev_err(cntl->component->dev, "%s: Invalid mem_type %d\n",
__func__, mem_type);
break;
}
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0, 0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1, 0x0F);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0, 0xFF);
+ snd_soc_component_write(component,
+ WCD934X_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1, 0x0F);
}
static void wcd_cntl_do_shutdown(struct wcd_dsp_cntl *cntl)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
/* Disable WDOG */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_WDOG_CFG,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_WDOG_CFG,
0x3F, 0x01);
/* Put WDSP in reset state */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPE_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPE_CTL,
0x02, 0x00);
/* If DSP transitions from boot to shutdown, then vote for SVS */
if (cntl->is_wdsp_booted)
- cntl->cdc_cb->cdc_vote_svs(codec, true);
+ cntl->cdc_cb->cdc_vote_svs(component, true);
cntl->is_wdsp_booted = false;
}
static int wcd_cntl_do_boot(struct wcd_dsp_cntl *cntl)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
int ret = 0;
/*
@@ -723,21 +748,25 @@
* will be required for debugging the DSP firmware.
*/
if (cntl->debug_mode) {
- snd_soc_update_bits(codec, WCD934X_CPE_SS_WDOG_CFG,
- 0x3F, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_WDOG_CFG,
+ 0x3F, 0x01);
} else {
- snd_soc_update_bits(codec, WCD934X_CPE_SS_WDOG_CFG,
- 0x3F, 0x21);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_WDOG_CFG,
+ 0x3F, 0x21);
}
/* Make sure all the error interrupts are cleared */
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_CLEAR_0A, 0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_CLEAR_0B, 0xFF);
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_CLEAR_0A,
+ 0xFF);
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_CLEAR_0B,
+ 0xFF);
reinit_completion(&cntl->boot_complete);
/* Remove WDSP out of reset */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_CPE_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_CPE_CTL,
0x02, 0x02);
/*
@@ -746,7 +775,8 @@
*/
if (cntl->debug_mode) {
wait_for_completion(&cntl->boot_complete);
- dev_dbg(codec->dev, "%s: WDSP booted in dbg mode\n", __func__);
+ dev_dbg(component->dev, "%s: WDSP booted in dbg mode\n",
+ __func__);
cntl->is_wdsp_booted = true;
goto done;
}
@@ -755,7 +785,7 @@
ret = wait_for_completion_timeout(&cntl->boot_complete,
msecs_to_jiffies(WCD_DSP_BOOT_TIMEOUT_MS));
if (!ret) {
- dev_err(codec->dev, "%s: WDSP boot timed out\n",
+ dev_err(component->dev, "%s: WDSP boot timed out\n",
__func__);
if (cntl->dbg_dmp_enable)
wcd_cntl_collect_debug_dumps(cntl, true);
@@ -769,16 +799,16 @@
ret = 0;
}
- dev_dbg(codec->dev, "%s: WDSP booted in normal mode\n", __func__);
+ dev_dbg(component->dev, "%s: WDSP booted in normal mode\n", __func__);
cntl->is_wdsp_booted = true;
/* Enable WDOG */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_WDOG_CFG,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_WDOG_CFG,
0x10, 0x10);
done:
/* If dsp booted up, then remove vote on SVS */
if (cntl->is_wdsp_booted)
- cntl->cdc_cb->cdc_vote_svs(codec, false);
+ cntl->cdc_cb->cdc_vote_svs(component, false);
return ret;
err_boot:
@@ -802,7 +832,7 @@
ret = -EINVAL;
if (ret < 0)
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: Failed to handle irq %d\n", __func__, irq);
return IRQ_HANDLED;
@@ -811,19 +841,21 @@
static irqreturn_t wcd_cntl_err_irq(int irq, void *data)
{
struct wcd_dsp_cntl *cntl = data;
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
struct wdsp_err_signal_arg arg;
u16 status = 0;
u8 reg_val;
int rc, ret = 0;
- reg_val = snd_soc_read(codec, WCD934X_CPE_SS_SS_ERROR_INT_STATUS_0A);
+ reg_val = snd_soc_component_read32(component,
+ WCD934X_CPE_SS_SS_ERROR_INT_STATUS_0A);
status = status | reg_val;
- reg_val = snd_soc_read(codec, WCD934X_CPE_SS_SS_ERROR_INT_STATUS_0B);
+ reg_val = snd_soc_component_read32(component,
+ WCD934X_CPE_SS_SS_ERROR_INT_STATUS_0B);
status = status | (reg_val << 8);
- dev_info(codec->dev, "%s: error interrupt status = 0x%x\n",
+ dev_info(component->dev, "%s: error interrupt status = 0x%x\n",
__func__, status);
if ((status & cntl->irqs.fatal_irqs) &&
@@ -840,14 +872,14 @@
ret = cntl->m_ops->signal_handler(cntl->m_dev, WDSP_ERR_INTR,
&arg);
if (ret < 0)
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: Failed to handle fatal irq 0x%x\n",
__func__, status & cntl->irqs.fatal_irqs);
wcd_cntl_change_online_state(cntl, 0);
if (rc == 0)
WCD_CNTL_CLR_ERR_IRQ_FLAG(cntl);
} else {
- dev_err(cntl->codec->dev, "%s: Invalid signal_handler\n",
+ dev_err(cntl->component->dev, "%s: Invalid signal_handler\n",
__func__);
}
@@ -858,7 +890,7 @@
enum wdsp_event_type event, void *data)
{
struct wcd_dsp_cntl *cntl = priv_data;
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
int ret = 0;
switch (event) {
@@ -872,7 +904,7 @@
/* Disable all the clocks */
ret = wcd_cntl_clocks_disable(cntl);
if (ret < 0)
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to disable clocks, err = %d\n",
__func__, ret);
@@ -887,7 +919,7 @@
/* Enable all the clocks */
ret = wcd_cntl_clocks_enable(cntl);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to enable clocks, err = %d\n",
__func__, ret);
goto done;
@@ -906,7 +938,7 @@
ret = wcd_cntl_do_boot(cntl);
if (ret < 0)
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: WDSP boot failed, err = %d\n",
__func__, ret);
break;
@@ -918,7 +950,7 @@
break;
default:
- dev_dbg(codec->dev, "%s: unhandled event %d\n",
+ dev_dbg(component->dev, "%s: unhandled event %d\n",
__func__, event);
}
@@ -928,13 +960,13 @@
static int wcd_cntl_sysfs_init(char *dir, struct wcd_dsp_cntl *cntl)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
int ret = 0;
ret = kobject_init_and_add(&cntl->wcd_kobj, &wcd_cntl_ktype,
kernel_kobj, dir);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to add kobject %s, err = %d\n",
__func__, dir, ret);
goto done;
@@ -942,7 +974,7 @@
ret = sysfs_create_file(&cntl->wcd_kobj, &cntl_attr_boot.attr);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to add wdsp_boot sysfs entry to %s\n",
__func__, dir);
goto fail_create_file;
@@ -964,11 +996,11 @@
static void wcd_cntl_debugfs_init(char *dir, struct wcd_dsp_cntl *cntl)
{
- struct snd_soc_codec *codec = cntl->codec;
+ struct snd_soc_component *component = cntl->component;
cntl->entry = debugfs_create_dir(dir, NULL);
if (IS_ERR_OR_NULL(dir)) {
- dev_err(codec->dev, "%s debugfs_create_dir failed for %s\n",
+ dev_err(component->dev, "%s debugfs_create_dir failed for %s\n",
__func__, dir);
goto done;
}
@@ -995,7 +1027,7 @@
struct wcd_dsp_cntl, miscdev);
if (!cntl->m_dev || !cntl->m_ops ||
!cntl->m_ops->vote_for_dsp) {
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: DSP not ready to boot\n", __func__);
return -EINVAL;
}
@@ -1028,7 +1060,7 @@
ret = copy_from_user(val, ubuf, count);
if (ret < 0) {
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: copy_from_user failed, err = %d\n",
__func__, ret);
ret = -EFAULT;
@@ -1040,7 +1072,7 @@
vote = true;
} else if (val[0] == '0') {
if (cntl->boot_reqs == 0) {
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: WDSP already disabled\n",
__func__);
ret = -EINVAL;
@@ -1050,7 +1082,7 @@
vote = false;
} else if (!strcmp(val, "DEBUG_DUMP")) {
if (cntl->dbg_dmp_enable) {
- dev_dbg(cntl->codec->dev,
+ dev_dbg(cntl->component->dev,
"%s: Collect dumps for debug use\n", __func__);
wcd_cntl_collect_debug_dumps(cntl, false);
}
@@ -1060,13 +1092,13 @@
*/
goto done;
} else {
- dev_err(cntl->codec->dev, "%s: Invalid value %s\n",
+ dev_err(cntl->component->dev, "%s: Invalid value %s\n",
__func__, val);
ret = -EINVAL;
goto done;
}
- dev_dbg(cntl->codec->dev,
+ dev_dbg(cntl->component->dev,
"%s: booted = %s, ref_cnt = %d, vote = %s\n",
__func__, cntl->is_wdsp_booted ? "true" : "false",
cntl->boot_reqs, vote ? "true" : "false");
@@ -1095,7 +1127,7 @@
cntl->miscdev.minor = MISC_DYNAMIC_MINOR;
cntl->miscdev.name = cntl->miscdev_name;
cntl->miscdev.fops = &wcd_miscdev_fops;
- cntl->miscdev.parent = cntl->codec->dev;
+ cntl->miscdev.parent = cntl->component->dev;
return misc_register(&cntl->miscdev);
}
@@ -1108,8 +1140,8 @@
static int wcd_control_init(struct device *dev, void *priv_data)
{
struct wcd_dsp_cntl *cntl = priv_data;
- struct snd_soc_codec *codec = cntl->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component = cntl->component;
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_core_resource *core_res = &wcd9xxx->core_res;
int ret;
bool err_irq_requested = false;
@@ -1119,16 +1151,16 @@
wcd_cntl_ipc_irq, "CPE IPC1",
cntl);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to request cpe ipc irq, err = %d\n",
__func__, ret);
goto done;
}
/* Unmask the fatal irqs */
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A,
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A,
~(cntl->irqs.fatal_irqs & 0xFF));
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B,
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B,
~((cntl->irqs.fatal_irqs >> 8) & 0xFF));
/*
@@ -1138,7 +1170,7 @@
*/
if (wcd9xxx_request_irq(core_res, cntl->irqs.cpe_err_irq,
wcd_cntl_err_irq, "CPE ERR", cntl))
- dev_info(codec->dev, "%s: Failed request_irq(cpe_err_irq)",
+ dev_info(component->dev, "%s: Failed request_irq(cpe_err_irq)",
__func__);
else
err_irq_requested = true;
@@ -1147,7 +1179,7 @@
/* Enable all the clocks */
ret = wcd_cntl_clocks_enable(cntl);
if (ret < 0) {
- dev_err(codec->dev, "%s: Failed to enable clocks, err = %d\n",
+ dev_err(component->dev, "%s: Failed to enable clocks, err = %d\n",
__func__, ret);
goto err_clk_enable;
}
@@ -1157,8 +1189,10 @@
err_clk_enable:
/* Mask all error interrupts */
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A, 0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B, 0xFF);
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A,
+ 0xFF);
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B,
+ 0xFF);
/* Free the irq's requested */
wcd9xxx_free_irq(core_res, cntl->irqs.cpe_ipc1_irq, cntl);
@@ -1172,16 +1206,18 @@
static int wcd_control_deinit(struct device *dev, void *priv_data)
{
struct wcd_dsp_cntl *cntl = priv_data;
- struct snd_soc_codec *codec = cntl->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component = cntl->component;
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_core_resource *core_res = &wcd9xxx->core_res;
wcd_cntl_clocks_disable(cntl);
wcd_cntl_cpar_ctrl(cntl, false);
/* Mask all error interrupts */
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A, 0xFF);
- snd_soc_write(codec, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B, 0xFF);
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A,
+ 0xFF);
+ snd_soc_component_write(component, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0B,
+ 0xFF);
/* Free the irq's requested */
wcd9xxx_free_irq(core_res, cntl->irqs.cpe_err_irq, cntl);
@@ -1201,7 +1237,7 @@
void *data)
{
struct wcd_dsp_cntl *cntl;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct snd_card *card;
struct snd_info_entry *entry;
char proc_name[WCD_PROCFS_ENTRY_MAX_LEN];
@@ -1255,8 +1291,8 @@
wcd_cntl_debugfs_init(wcd_cntl_dir_name, cntl);
- codec = cntl->codec;
- card = codec->component.card->snd_card;
+ component = cntl->component;
+ card = component->card->snd_card;
snprintf(proc_name, WCD_PROCFS_ENTRY_MAX_LEN, "%s%d%s", "cpe",
cntl->dsp_instance, "_state");
entry = snd_info_create_card_entry(card, proc_name, card->proc_root);
@@ -1343,7 +1379,7 @@
}
if (!cntl->m_dev || !cntl->m_ops || !cntl->m_ops->signal_handler) {
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: Invalid signal_handler callback\n", __func__);
return -EINVAL;
}
@@ -1354,7 +1390,7 @@
WDSP_CDC_DOWN_SIGNAL,
NULL);
if (ret < 0)
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: WDSP_CDC_DOWN_SIGNAL failed, err = %d\n",
__func__, ret);
wcd_cntl_change_online_state(cntl, 0);
@@ -1364,12 +1400,12 @@
WDSP_CDC_UP_SIGNAL,
NULL);
if (ret < 0)
- dev_err(cntl->codec->dev,
+ dev_err(cntl->component->dev,
"%s: WDSP_CDC_UP_SIGNAL failed, err = %d\n",
__func__, ret);
break;
default:
- dev_err(cntl->codec->dev, "%s: Invalid event %d\n",
+ dev_err(cntl->component->dev, "%s: Invalid event %d\n",
__func__, event);
ret = -EINVAL;
break;
@@ -1381,23 +1417,23 @@
/*
* wcd_dsp_cntl_init: Initialize the wcd-dsp control
- * @codec: pointer to the codec handle
+ * @component: pointer to the codec component handle
* @params: Parameters required to initialize wcd-dsp control
*
* This API is expected to be invoked by the codec driver and
* provide information essential for the wcd dsp control to
* configure and initialize the dsp
*/
-void wcd_dsp_cntl_init(struct snd_soc_codec *codec,
+void wcd_dsp_cntl_init(struct snd_soc_component *component,
struct wcd_dsp_params *params,
struct wcd_dsp_cntl **cntl)
{
struct wcd_dsp_cntl *control;
int ret;
- if (!codec || !params) {
+ if (!component || !params) {
pr_err("%s: Invalid handle to %s\n", __func__,
- (!codec) ? "codec" : "params");
+ (!component) ? "component" : "params");
*cntl = NULL;
return;
}
@@ -1410,7 +1446,7 @@
if (!params->cb || !params->cb->cdc_clk_en ||
!params->cb->cdc_vote_svs) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: clk_en and vote_svs callbacks must be provided\n",
__func__);
return;
@@ -1420,7 +1456,7 @@
if (!(control))
return;
- control->codec = codec;
+ control->component = component;
control->clk_rate = params->clk_rate;
control->cdc_cb = params->cb;
control->dsp_instance = params->dsp_instance;
@@ -1436,7 +1472,7 @@
* Vote for SVS now, the vote will be removed only
* after DSP is booted up.
*/
- control->cdc_cb->cdc_vote_svs(codec, true);
+ control->cdc_cb->cdc_vote_svs(component, true);
/*
* If this is the last component needed by master to be ready,
@@ -1445,9 +1481,9 @@
* so that we can access it during this component's bind call.
*/
*cntl = control;
- ret = component_add(codec->dev, &wcd_ctrl_component_ops);
+ ret = component_add(component->dev, &wcd_ctrl_component_ops);
if (ret) {
- dev_err(codec->dev, "%s: component_add failed, err = %d\n",
+ dev_err(component->dev, "%s: component_add failed, err = %d\n",
__func__, ret);
kfree(*cntl);
*cntl = NULL;
@@ -1465,12 +1501,12 @@
void wcd_dsp_cntl_deinit(struct wcd_dsp_cntl **cntl)
{
struct wcd_dsp_cntl *control = *cntl;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
/* If control is NULL, there is nothing to de-initialize */
if (!control)
return;
- codec = control->codec;
+ component = control->component;
/*
* Calling shutdown will cleanup all register states,
@@ -1480,7 +1516,7 @@
wcd_cntl_disable_memory(control, WCD_MEM_TYPE_SWITCHABLE);
wcd_cntl_disable_memory(control, WCD_MEM_TYPE_ALWAYS_ON);
- component_del(codec->dev, &wcd_ctrl_component_ops);
+ component_del(component->dev, &wcd_ctrl_component_ops);
mutex_destroy(&control->clk_mutex);
mutex_destroy(&control->ssr_mutex);
diff --git a/asoc/codecs/wcd934x/wcd934x-dsp-cntl.h b/asoc/codecs/wcd934x/wcd934x-dsp-cntl.h
index 5ce4fd8..a4b18a3 100644
--- a/asoc/codecs/wcd934x/wcd934x-dsp-cntl.h
+++ b/asoc/codecs/wcd934x/wcd934x-dsp-cntl.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD934X_DSP_CNTL_H__
@@ -25,9 +17,9 @@
struct wcd_dsp_cdc_cb {
/* Callback to enable codec clock */
- int (*cdc_clk_en)(struct snd_soc_codec *, bool);
+ int (*cdc_clk_en)(struct snd_soc_component *component, bool enable);
/* Callback to vote and unvote for SVS2 mode */
- void (*cdc_vote_svs)(struct snd_soc_codec *, bool);
+ void (*cdc_vote_svs)(struct snd_soc_component *component, bool enable);
};
struct wcd_dsp_irq_info {
@@ -69,7 +61,7 @@
struct wcd_dsp_cntl {
/* Handle to codec */
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
/* Clk rate of the codec clock */
u32 clk_rate;
@@ -117,7 +109,7 @@
#endif
};
-void wcd_dsp_cntl_init(struct snd_soc_codec *codec,
+void wcd_dsp_cntl_init(struct snd_soc_component *component,
struct wcd_dsp_params *params,
struct wcd_dsp_cntl **cntl);
void wcd_dsp_cntl_deinit(struct wcd_dsp_cntl **cntl);
diff --git a/asoc/codecs/wcd934x/wcd934x-mbhc.c b/asoc/codecs/wcd934x/wcd934x-mbhc.c
index bfe1e17..7a91bf3 100644
--- a/asoc/codecs/wcd934x/wcd934x-mbhc.c
+++ b/asoc/codecs/wcd934x/wcd934x-mbhc.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -177,21 +169,21 @@
u16 btn7;
};
-static int tavil_mbhc_request_irq(struct snd_soc_codec *codec,
+static int tavil_mbhc_request_irq(struct snd_soc_component *component,
int irq, irq_handler_t handler,
const char *name, void *data)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
return wcd9xxx_request_irq(core_res, irq, handler, name, data);
}
-static void tavil_mbhc_irq_control(struct snd_soc_codec *codec,
+static void tavil_mbhc_irq_control(struct snd_soc_component *component,
int irq, bool enable)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
if (enable)
@@ -200,10 +192,10 @@
wcd9xxx_disable_irq(core_res, irq);
}
-static int tavil_mbhc_free_irq(struct snd_soc_codec *codec,
+static int tavil_mbhc_free_irq(struct snd_soc_component *component,
int irq, void *data)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
@@ -211,27 +203,28 @@
return 0;
}
-static void tavil_mbhc_clk_setup(struct snd_soc_codec *codec,
+static void tavil_mbhc_clk_setup(struct snd_soc_component *component,
bool enable)
{
if (enable)
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_1,
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_CTL_1,
0x80, 0x80);
else
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_1,
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_CTL_1,
0x80, 0x00);
}
-static int tavil_mbhc_btn_to_num(struct snd_soc_codec *codec)
+static int tavil_mbhc_btn_to_num(struct snd_soc_component *component)
{
- return snd_soc_read(codec, WCD934X_ANA_MBHC_RESULT_3) & 0x7;
+ return snd_soc_component_read32(component, WCD934X_ANA_MBHC_RESULT_3) &
+ 0x7;
}
static int tavil_enable_ext_mb_source(struct wcd_mbhc *mbhc,
bool turn_on)
{
struct wcd934x_mbhc *wcd934x_mbhc;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
struct wcd934x_on_demand_supply *supply;
int ret = 0;
@@ -239,20 +232,21 @@
supply = &wcd934x_mbhc->on_demand_list[WCD934X_ON_DEMAND_MICBIAS];
if (!supply->supply) {
- dev_dbg(codec->dev, "%s: warning supply not present ond for %s\n",
+ dev_dbg(component->dev, "%s: warning supply not present ond for %s\n",
__func__, "onDemand Micbias");
return ret;
}
- dev_dbg(codec->dev, "%s turn_on: %d count: %d\n", __func__, turn_on,
+ dev_dbg(component->dev, "%s turn_on: %d count: %d\n", __func__, turn_on,
supply->ondemand_supply_count);
if (turn_on) {
if (!(supply->ondemand_supply_count)) {
ret = snd_soc_dapm_force_enable_pin(
- snd_soc_codec_get_dapm(codec),
+ snd_soc_component_get_dapm(component),
"MICBIAS_REGULATOR");
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(
+ snd_soc_component_get_dapm(component));
}
supply->ondemand_supply_count++;
} else {
@@ -260,34 +254,34 @@
supply->ondemand_supply_count--;
if (!(supply->ondemand_supply_count)) {
ret = snd_soc_dapm_disable_pin(
- snd_soc_codec_get_dapm(codec),
+ snd_soc_component_get_dapm(component),
"MICBIAS_REGULATOR");
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(snd_soc_component_get_dapm(component));
}
}
if (ret)
- dev_err(codec->dev, "%s: Failed to %s external micbias source\n",
+ dev_err(component->dev, "%s: Failed to %s external micbias source\n",
__func__, turn_on ? "enable" : "disabled");
else
- dev_dbg(codec->dev, "%s: %s external micbias source\n",
+ dev_dbg(component->dev, "%s: %s external micbias source\n",
__func__, turn_on ? "Enabled" : "Disabled");
return ret;
}
-static void tavil_mbhc_mbhc_bias_control(struct snd_soc_codec *codec,
+static void tavil_mbhc_mbhc_bias_control(struct snd_soc_component *component,
bool enable)
{
if (enable)
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_ELECT,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_ELECT,
0x01, 0x01);
else
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_ELECT,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_ELECT,
0x01, 0x00);
}
-static void tavil_mbhc_program_btn_thr(struct snd_soc_codec *codec,
+static void tavil_mbhc_program_btn_thr(struct snd_soc_component *component,
s16 *btn_low, s16 *btn_high,
int num_btn, bool is_micbias)
{
@@ -295,7 +289,7 @@
int vth;
if (num_btn > WCD_MBHC_DEF_BUTTONS) {
- dev_err(codec->dev, "%s: invalid number of buttons: %d\n",
+ dev_err(component->dev, "%s: invalid number of buttons: %d\n",
__func__, num_btn);
return;
}
@@ -307,17 +301,18 @@
*/
for (i = 0; i < num_btn; i++) {
vth = ((btn_high[i] * 2) / 25) & 0x3F;
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_BTN0 + i,
- 0xFC, vth << 2);
- dev_dbg(codec->dev, "%s: btn_high[%d]: %d, vth: %d\n",
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_MBHC_BTN0 + i,
+ 0xFC, vth << 2);
+ dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n",
__func__, i, btn_high[i], vth);
}
}
static bool tavil_mbhc_lock_sleep(struct wcd_mbhc *mbhc, bool lock)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component = mbhc->component;
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
bool ret = 0;
@@ -351,20 +346,22 @@
u8 val;
if (micb_num == MIC_BIAS_2) {
- val = (snd_soc_read(mbhc->codec, WCD934X_ANA_MICB2) >> 6);
+ val = (snd_soc_component_read32(
+ mbhc->component, WCD934X_ANA_MICB2) >> 6);
if (val == 0x01)
return true;
}
return false;
}
-static bool tavil_mbhc_hph_pa_on_status(struct snd_soc_codec *codec)
+static bool tavil_mbhc_hph_pa_on_status(struct snd_soc_component *component)
{
- return (snd_soc_read(codec, WCD934X_ANA_HPH) & 0xC0) ? true : false;
+ return (snd_soc_component_read32(component, WCD934X_ANA_HPH) & 0xC0) ?
+ true : false;
}
static void tavil_mbhc_hph_l_pull_up_control(
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
enum mbhc_hs_pullup_iref pull_up_cur)
{
/* Default pull up current to 2uA */
@@ -372,14 +369,15 @@
pull_up_cur == I_DEFAULT)
pull_up_cur = I_2P0_UA;
- dev_dbg(codec->dev, "%s: HS pull up current:%d\n",
+ dev_dbg(component->dev, "%s: HS pull up current:%d\n",
__func__, pull_up_cur);
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_PLUG_DETECT_CTL,
- 0xC0, pull_up_cur << 6);
+ snd_soc_component_update_bits(component,
+ WCD934X_MBHC_NEW_PLUG_DETECT_CTL,
+ 0xC0, pull_up_cur << 6);
}
-static int tavil_mbhc_request_micbias(struct snd_soc_codec *codec,
+static int tavil_mbhc_request_micbias(struct snd_soc_component *component,
int micb_num, int req)
{
int ret;
@@ -389,32 +387,32 @@
* is vote to enable mclk
*/
if (req == MICB_ENABLE)
- tavil_cdc_mclk_enable(codec, true);
+ tavil_cdc_mclk_enable(component, true);
- ret = tavil_micbias_control(codec, micb_num, req, false);
+ ret = tavil_micbias_control(component, micb_num, req, false);
/*
* Release vote for mclk while requesting for
* micbias disable
*/
if (req == MICB_DISABLE)
- tavil_cdc_mclk_enable(codec, false);
+ tavil_cdc_mclk_enable(component, false);
return ret;
}
-static void tavil_mbhc_micb_ramp_control(struct snd_soc_codec *codec,
+static void tavil_mbhc_micb_ramp_control(struct snd_soc_component *component,
bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD934X_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MICB2_RAMP,
0x1C, 0x0C);
- snd_soc_update_bits(codec, WCD934X_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MICB2_RAMP,
0x80, 0x80);
} else {
- snd_soc_update_bits(codec, WCD934X_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MICB2_RAMP,
0x80, 0x00);
- snd_soc_update_bits(codec, WCD934X_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MICB2_RAMP,
0x1C, 0x00);
}
}
@@ -424,26 +422,27 @@
{
struct wcd934x_mbhc *wcd934x_mbhc;
struct firmware_cal *hwdep_cal;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
wcd934x_mbhc = container_of(mbhc, struct wcd934x_mbhc, wcd_mbhc);
- if (!codec) {
- pr_err("%s: NULL codec pointer\n", __func__);
+ if (!component) {
+ pr_err("%s: NULL component pointer\n", __func__);
return NULL;
}
hwdep_cal = wcdcal_get_fw_cal(wcd934x_mbhc->fw_data, type);
if (!hwdep_cal)
- dev_err(codec->dev, "%s: cal not sent by %d\n",
+ dev_err(component->dev, "%s: cal not sent by %d\n",
__func__, type);
return hwdep_cal;
}
-static int tavil_mbhc_micb_ctrl_threshold_mic(struct snd_soc_codec *codec,
- int micb_num, bool req_en)
+static int tavil_mbhc_micb_ctrl_threshold_mic(
+ struct snd_soc_component *component,
+ int micb_num, bool req_en)
{
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
+ struct wcd9xxx_pdata *pdata = dev_get_platdata(component->dev->parent);
int rc, micb_mv;
if (micb_num != MIC_BIAS_2)
@@ -459,7 +458,7 @@
micb_mv = req_en ? WCD_MBHC_THR_HS_MICB_MV : pdata->micbias.micb2_mv;
- rc = tavil_mbhc_micb_adjust_voltage(codec, micb_mv, MIC_BIAS_2);
+ rc = tavil_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2);
return rc;
}
@@ -520,25 +519,25 @@
}
}
-static void tavil_mbhc_zdet_ramp(struct snd_soc_codec *codec,
+static void tavil_mbhc_zdet_ramp(struct snd_soc_component *component,
struct tavil_mbhc_zdet_param *zdet_param,
int32_t *zl, int32_t *zr, s16 *d1_a)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
int32_t zdet = 0;
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_ZDET_ANA_CTL, 0x70,
- zdet_param->ldo_ctl << 4);
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_BTN5, 0xFC,
- zdet_param->btn5);
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_BTN6, 0xFC,
- zdet_param->btn6);
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_BTN7, 0xFC,
- zdet_param->btn7);
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_ZDET_ANA_CTL, 0x0F,
- zdet_param->noff);
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_ZDET_RAMP_CTL, 0x0F,
- zdet_param->nshift);
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_ZDET_ANA_CTL,
+ 0x70, zdet_param->ldo_ctl << 4);
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_BTN5, 0xFC,
+ zdet_param->btn5);
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_BTN6, 0xFC,
+ zdet_param->btn6);
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_BTN7, 0xFC,
+ zdet_param->btn7);
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_ZDET_ANA_CTL,
+ 0x0F, zdet_param->noff);
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_ZDET_RAMP_CTL,
+ 0x0F, zdet_param->nshift);
if (!zl)
goto z_right;
@@ -568,17 +567,17 @@
*zr = zdet;
}
-static inline void tavil_wcd_mbhc_qfuse_cal(struct snd_soc_codec *codec,
+static inline void tavil_wcd_mbhc_qfuse_cal(struct snd_soc_component *component,
int32_t *z_val, int flag_l_r)
{
s16 q1;
int q1_cal;
if (*z_val < (TAVIL_ZDET_VAL_400/1000))
- q1 = snd_soc_read(codec,
+ q1 = snd_soc_component_read32(component,
WCD934X_CHIP_TIER_CTRL_EFUSE_VAL_OUT1 + (2 * flag_l_r));
else
- q1 = snd_soc_read(codec,
+ q1 = snd_soc_component_read32(component,
WCD934X_CHIP_TIER_CTRL_EFUSE_VAL_OUT2 + (2 * flag_l_r));
if (q1 & 0x80)
q1_cal = (10000 - ((q1 & 0x7F) * 25));
@@ -591,8 +590,8 @@
static void tavil_wcd_mbhc_calc_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
uint32_t *zr)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component = mbhc->component;
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
s16 reg0, reg1, reg2, reg3, reg4;
int32_t z1L, z1R, z1Ls;
int zMono, z_diff1, z_diff2;
@@ -614,13 +613,15 @@
WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
- reg0 = snd_soc_read(codec, WCD934X_ANA_MBHC_BTN5);
- reg1 = snd_soc_read(codec, WCD934X_ANA_MBHC_BTN6);
- reg2 = snd_soc_read(codec, WCD934X_ANA_MBHC_BTN7);
- reg3 = snd_soc_read(codec, WCD934X_MBHC_CTL_CLK);
- reg4 = snd_soc_read(codec, WCD934X_MBHC_NEW_ZDET_ANA_CTL);
+ reg0 = snd_soc_component_read32(component, WCD934X_ANA_MBHC_BTN5);
+ reg1 = snd_soc_component_read32(component, WCD934X_ANA_MBHC_BTN6);
+ reg2 = snd_soc_component_read32(component, WCD934X_ANA_MBHC_BTN7);
+ reg3 = snd_soc_component_read32(component, WCD934X_MBHC_CTL_CLK);
+ reg4 = snd_soc_component_read32(component,
+ WCD934X_MBHC_NEW_ZDET_ANA_CTL);
- if (snd_soc_read(codec, WCD934X_ANA_MBHC_ELECT) & 0x80) {
+ if (snd_soc_component_read32(component, WCD934X_ANA_MBHC_ELECT) &
+ 0x80) {
is_fsm_disable = true;
regmap_update_bits(wcd9xxx->regmap,
WCD934X_ANA_MBHC_ELECT, 0x80, 0x00);
@@ -638,7 +639,7 @@
/* First get impedance on Left */
d1 = d1_a[1];
zdet_param_ptr = &zdet_param[1];
- tavil_mbhc_zdet_ramp(codec, zdet_param_ptr, &z1L, NULL, d1);
+ tavil_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1);
if (!TAVIL_MBHC_IS_SECOND_RAMP_REQUIRED(z1L))
goto left_ch_impedance;
@@ -654,7 +655,7 @@
zdet_param_ptr = &zdet_param[3];
d1 = d1_a[3];
}
- tavil_mbhc_zdet_ramp(codec, zdet_param_ptr, &z1L, NULL, d1);
+ tavil_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1);
left_ch_impedance:
if ((z1L == TAVIL_ZDET_FLOATING_IMPEDANCE) ||
@@ -664,13 +665,13 @@
d1 = d1_a[1];
} else {
*zl = z1L/1000;
- tavil_wcd_mbhc_qfuse_cal(codec, zl, 0);
+ tavil_wcd_mbhc_qfuse_cal(component, zl, 0);
}
- dev_dbg(codec->dev, "%s: impedance on HPH_L = %d(ohms)\n",
+ dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n",
__func__, *zl);
/* Start of right impedance ramp and calculation */
- tavil_mbhc_zdet_ramp(codec, zdet_param_ptr, NULL, &z1R, d1);
+ tavil_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1);
if (TAVIL_MBHC_IS_SECOND_RAMP_REQUIRED(z1R)) {
if (((z1R > TAVIL_ZDET_VAL_1200) &&
(zdet_param_ptr->noff == 0x6)) ||
@@ -688,7 +689,7 @@
zdet_param_ptr = &zdet_param[3];
d1 = d1_a[3];
}
- tavil_mbhc_zdet_ramp(codec, zdet_param_ptr, NULL, &z1R, d1);
+ tavil_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1);
}
right_ch_impedance:
if ((z1R == TAVIL_ZDET_FLOATING_IMPEDANCE) ||
@@ -696,15 +697,15 @@
*zr = TAVIL_ZDET_FLOATING_IMPEDANCE;
} else {
*zr = z1R/1000;
- tavil_wcd_mbhc_qfuse_cal(codec, zr, 1);
+ tavil_wcd_mbhc_qfuse_cal(component, zr, 1);
}
- dev_dbg(codec->dev, "%s: impedance on HPH_R = %d(ohms)\n",
+ dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n",
__func__, *zr);
/* Mono/stereo detection */
if ((*zl == TAVIL_ZDET_FLOATING_IMPEDANCE) &&
(*zr == TAVIL_ZDET_FLOATING_IMPEDANCE)) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: plug type is invalid or extension cable\n",
__func__);
goto zdet_complete;
@@ -713,40 +714,46 @@
(*zr == TAVIL_ZDET_FLOATING_IMPEDANCE) ||
((*zl < WCD_MONO_HS_MIN_THR) && (*zr > WCD_MONO_HS_MIN_THR)) ||
((*zl > WCD_MONO_HS_MIN_THR) && (*zr < WCD_MONO_HS_MIN_THR))) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: Mono plug type with one ch floating or shorted to GND\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_MONO;
goto zdet_complete;
}
- snd_soc_update_bits(codec, WCD934X_HPH_R_ATEST, 0x02, 0x02);
- snd_soc_update_bits(codec, WCD934X_HPH_PA_CTL2, 0x40, 0x01);
+ snd_soc_component_update_bits(component, WCD934X_HPH_R_ATEST,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, WCD934X_HPH_PA_CTL2,
+ 0x40, 0x01);
if (*zl < (TAVIL_ZDET_VAL_32/1000))
- tavil_mbhc_zdet_ramp(codec, &zdet_param[0], &z1Ls, NULL, d1);
+ tavil_mbhc_zdet_ramp(component, &zdet_param[0],
+ &z1Ls, NULL, d1);
else
- tavil_mbhc_zdet_ramp(codec, &zdet_param[1], &z1Ls, NULL, d1);
- snd_soc_update_bits(codec, WCD934X_HPH_PA_CTL2, 0x40, 0x00);
- snd_soc_update_bits(codec, WCD934X_HPH_R_ATEST, 0x02, 0x00);
+ tavil_mbhc_zdet_ramp(component, &zdet_param[1],
+ &z1Ls, NULL, d1);
+ snd_soc_component_update_bits(component, WCD934X_HPH_PA_CTL2,
+ 0x40, 0x00);
+ snd_soc_component_update_bits(component, WCD934X_HPH_R_ATEST,
+ 0x02, 0x00);
z1Ls /= 1000;
- tavil_wcd_mbhc_qfuse_cal(codec, &z1Ls, 0);
+ tavil_wcd_mbhc_qfuse_cal(component, &z1Ls, 0);
/* Parallel of left Z and 9 ohm pull down resistor */
zMono = ((*zl) * 9) / ((*zl) + 9);
z_diff1 = (z1Ls > zMono) ? (z1Ls - zMono) : (zMono - z1Ls);
z_diff2 = ((*zl) > z1Ls) ? ((*zl) - z1Ls) : (z1Ls - (*zl));
if ((z_diff1 * (*zl + z1Ls)) > (z_diff2 * (z1Ls + zMono))) {
- dev_dbg(codec->dev, "%s: stereo plug type detected\n",
+ dev_dbg(component->dev, "%s: stereo plug type detected\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_STEREO;
} else {
- dev_dbg(codec->dev, "%s: MONO plug type detected\n",
+ dev_dbg(component->dev, "%s: MONO plug type detected\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_MONO;
}
zdet_complete:
- snd_soc_write(codec, WCD934X_ANA_MBHC_BTN5, reg0);
- snd_soc_write(codec, WCD934X_ANA_MBHC_BTN6, reg1);
- snd_soc_write(codec, WCD934X_ANA_MBHC_BTN7, reg2);
+ snd_soc_component_write(component, WCD934X_ANA_MBHC_BTN5, reg0);
+ snd_soc_component_write(component, WCD934X_ANA_MBHC_BTN6, reg1);
+ snd_soc_component_write(component, WCD934X_ANA_MBHC_BTN7, reg2);
/* Turn on 100k pull down on HPHL */
regmap_update_bits(wcd9xxx->regmap,
WCD934X_ANA_MBHC_MECH, 0x01, 0x01);
@@ -756,96 +763,99 @@
regmap_update_bits(wcd9xxx->regmap,
WCD934X_ANA_MBHC_MECH, 0x80, 0x80);
- snd_soc_write(codec, WCD934X_MBHC_NEW_ZDET_ANA_CTL, reg4);
- snd_soc_write(codec, WCD934X_MBHC_CTL_CLK, reg3);
+ snd_soc_component_write(component, WCD934X_MBHC_NEW_ZDET_ANA_CTL, reg4);
+ snd_soc_component_write(component, WCD934X_MBHC_CTL_CLK, reg3);
if (is_fsm_disable)
regmap_update_bits(wcd9xxx->regmap,
WCD934X_ANA_MBHC_ELECT, 0x80, 0x80);
}
-static void tavil_mbhc_gnd_det_ctrl(struct snd_soc_codec *codec, bool enable)
+static void tavil_mbhc_gnd_det_ctrl(struct snd_soc_component *component,
+ bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_MECH,
0x02, 0x02);
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_MECH,
0x40, 0x40);
} else {
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_MECH,
0x40, 0x00);
- snd_soc_update_bits(codec, WCD934X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MBHC_MECH,
0x02, 0x00);
}
}
-static void tavil_mbhc_hph_pull_down_ctrl(struct snd_soc_codec *codec,
+static void tavil_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component,
bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD934X_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD934X_HPH_PA_CTL2,
0x40, 0x40);
- snd_soc_update_bits(codec, WCD934X_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD934X_HPH_PA_CTL2,
0x10, 0x10);
} else {
- snd_soc_update_bits(codec, WCD934X_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD934X_HPH_PA_CTL2,
0x40, 0x00);
- snd_soc_update_bits(codec, WCD934X_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD934X_HPH_PA_CTL2,
0x10, 0x00);
}
}
static void tavil_mbhc_moisture_config(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
if ((mbhc->moist_rref == R_OFF) ||
(mbhc->mbhc_cfg->enable_usbc_analog)) {
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_CTL_2,
0x0C, R_OFF << 2);
return;
}
/* Donot enable moisture detection if jack type is NC */
if (!mbhc->hphl_swh) {
- dev_dbg(codec->dev, "%s: disable moisture detection for NC\n",
+ dev_dbg(component->dev, "%s: disable moisture detection for NC\n",
__func__);
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_CTL_2,
0x0C, R_OFF << 2);
return;
}
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_CTL_2,
0x0C, mbhc->moist_rref << 2);
}
static bool tavil_hph_register_recovery(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(codec);
+ struct snd_soc_component *component = mbhc->component;
+ struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(component);
if (!wcd934x_mbhc)
return false;
wcd934x_mbhc->is_hph_recover = false;
- snd_soc_dapm_force_enable_pin(snd_soc_codec_get_dapm(codec),
+ snd_soc_dapm_force_enable_pin(snd_soc_component_get_dapm(component),
"RESET_HPH_REGISTERS");
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(snd_soc_component_get_dapm(component));
- snd_soc_dapm_disable_pin(snd_soc_codec_get_dapm(codec),
+ snd_soc_dapm_disable_pin(snd_soc_component_get_dapm(component),
"RESET_HPH_REGISTERS");
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(snd_soc_component_get_dapm(component));
return wcd934x_mbhc->is_hph_recover;
}
-static void tavil_update_anc_state(struct snd_soc_codec *codec, bool enable,
- int anc_num)
+static void tavil_update_anc_state(struct snd_soc_component *component,
+ bool enable, int anc_num)
{
if (enable)
- snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_CFG0 +
- (20 * anc_num), 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX1_RX_PATH_CFG0 + (20 * anc_num),
+ 0x10, 0x10);
else
- snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_CFG0 +
- (20 * anc_num), 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX1_RX_PATH_CFG0 + (20 * anc_num),
+ 0x10, 0x00);
}
static bool tavil_is_anc_on(struct wcd_mbhc *mbhc)
@@ -854,9 +864,11 @@
u16 ancl, ancr;
ancl =
- (snd_soc_read(mbhc->codec, WCD934X_CDC_RX1_RX_PATH_CFG0)) & 0x10;
+ (snd_soc_component_read32(
+ mbhc->component, WCD934X_CDC_RX1_RX_PATH_CFG0)) & 0x10;
ancr =
- (snd_soc_read(mbhc->codec, WCD934X_CDC_RX2_RX_PATH_CFG0)) & 0x10;
+ (snd_soc_component_read32(
+ mbhc->component, WCD934X_CDC_RX2_RX_PATH_CFG0)) & 0x10;
anc_on = !!(ancl | ancr);
@@ -891,11 +903,11 @@
};
static struct regulator *tavil_codec_find_ondemand_regulator(
- struct snd_soc_codec *codec, const char *name)
+ struct snd_soc_component *component, const char *name)
{
int i;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
+ struct wcd9xxx_pdata *pdata = dev_get_platdata(component->dev->parent);
for (i = 0; i < wcd9xxx->num_of_supplies; ++i) {
if (pdata->regulator[i].ondemand &&
@@ -904,7 +916,7 @@
return wcd9xxx->supplies[i].consumer;
}
- dev_dbg(codec->dev, "Warning: regulator not found:%s\n",
+ dev_dbg(component->dev, "Warning: regulator not found:%s\n",
name);
return NULL;
}
@@ -912,19 +924,22 @@
static int tavil_get_hph_type(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(component);
struct wcd_mbhc *mbhc;
if (!wcd934x_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
mbhc = &wcd934x_mbhc->wcd_mbhc;
ucontrol->value.integer.value[0] = (u32) mbhc->hph_type;
- dev_dbg(codec->dev, "%s: hph_type = %u\n", __func__, mbhc->hph_type);
+ dev_dbg(component->dev, "%s: hph_type = %u\n", __func__,
+ mbhc->hph_type);
return 0;
}
@@ -935,18 +950,21 @@
uint32_t zl, zr;
bool hphr;
struct soc_multi_mixer_control *mc;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(component);
if (!wcd934x_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
mc = (struct soc_multi_mixer_control *)(kcontrol->private_value);
hphr = mc->shift;
wcd_mbhc_get_impedance(&wcd934x_mbhc->wcd_mbhc, &zl, &zr);
- dev_dbg(codec->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr);
+ dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__,
+ zl, zr);
ucontrol->value.integer.value[0] = hphr ? zr : zl;
return 0;
@@ -989,17 +1007,18 @@
/*
* tavil_mbhc_hs_detect: starts mbhc insertion/removal functionality
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @mbhc_cfg: handle to mbhc configuration structure
* return 0 if mbhc_start is success or error code in case of failure
*/
-int tavil_mbhc_hs_detect(struct snd_soc_codec *codec,
+int tavil_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg)
{
- struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(codec);
+ struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(component);
if (!wcd934x_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
@@ -1009,14 +1028,15 @@
/*
* tavil_mbhc_hs_detect_exit: stop mbhc insertion/removal functionality
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*/
-void tavil_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
+void tavil_mbhc_hs_detect_exit(struct snd_soc_component *component)
{
- struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(codec);
+ struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(component);
if (!wcd934x_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return;
}
wcd_mbhc_stop(&wcd934x_mbhc->wcd_mbhc);
@@ -1026,17 +1046,17 @@
/*
* tavil_mbhc_post_ssr_init: initialize mbhc for tavil post subsystem restart
* @mbhc: poniter to wcd934x_mbhc structure
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*
* return 0 if mbhc_init is success or error code in case of failure
*/
int tavil_mbhc_post_ssr_init(struct wcd934x_mbhc *mbhc,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
int ret;
struct wcd_mbhc *wcd_mbhc;
- if (!mbhc || !codec)
+ if (!mbhc || !component)
return -EINVAL;
wcd_mbhc = &mbhc->wcd_mbhc;
@@ -1045,18 +1065,20 @@
return -EINVAL;
}
- tavil_mbhc_hs_detect_exit(codec);
+ tavil_mbhc_hs_detect_exit(component);
wcd_mbhc_deinit(wcd_mbhc);
- ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb, &intr_ids,
+ ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb, &intr_ids,
wcd_mbhc_registers, TAVIL_ZDET_SUPPORTED);
if (ret) {
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
goto done;
}
if (wcd_mbhc->mbhc_detection_logic == WCD_DETECTION_LEGACY) {
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_1, 0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_MBHC_CTL_BCS, 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_CTL_1,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component, WCD934X_MBHC_CTL_BCS,
+ 0x01, 0x01);
}
done:
@@ -1067,12 +1089,13 @@
/*
* tavil_mbhc_init: initialize mbhc for tavil
* @mbhc: poniter to wcd934x_mbhc struct pointer to store the configs
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @fw_data: handle to firmware data
*
* return 0 if mbhc_init is success or error code in case of failure
*/
-int tavil_mbhc_init(struct wcd934x_mbhc **mbhc, struct snd_soc_codec *codec,
+int tavil_mbhc_init(struct wcd934x_mbhc **mbhc,
+ struct snd_soc_component *component,
struct fw_info *fw_data)
{
struct regulator *supply;
@@ -1080,12 +1103,12 @@
struct wcd_mbhc *wcd_mbhc;
int ret;
- wcd934x_mbhc = devm_kzalloc(codec->dev, sizeof(struct wcd934x_mbhc),
+ wcd934x_mbhc = devm_kzalloc(component->dev, sizeof(struct wcd934x_mbhc),
GFP_KERNEL);
if (!wcd934x_mbhc)
return -ENOMEM;
- wcd934x_mbhc->wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ wcd934x_mbhc->wcd9xxx = dev_get_drvdata(component->dev->parent);
wcd934x_mbhc->fw_data = fw_data;
BLOCKING_INIT_NOTIFIER_HEAD(&wcd934x_mbhc->notifier);
wcd_mbhc = &wcd934x_mbhc->wcd_mbhc;
@@ -1099,16 +1122,16 @@
/* Setting default mbhc detection logic to ADC for Tavil */
wcd_mbhc->mbhc_detection_logic = WCD_DETECTION_ADC;
- ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb,
+ ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb,
&intr_ids, wcd_mbhc_registers,
TAVIL_ZDET_SUPPORTED);
if (ret) {
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
goto err;
}
- supply = tavil_codec_find_ondemand_regulator(codec,
+ supply = tavil_codec_find_ondemand_regulator(component,
on_demand_supply_name[WCD934X_ON_DEMAND_MICBIAS]);
if (supply) {
wcd934x_mbhc->on_demand_list[
@@ -1120,34 +1143,36 @@
}
(*mbhc) = wcd934x_mbhc;
- snd_soc_add_codec_controls(codec, impedance_detect_controls,
+ snd_soc_add_component_controls(component, impedance_detect_controls,
ARRAY_SIZE(impedance_detect_controls));
- snd_soc_add_codec_controls(codec, hph_type_detect_controls,
+ snd_soc_add_component_controls(component, hph_type_detect_controls,
ARRAY_SIZE(hph_type_detect_controls));
if (wcd_mbhc->mbhc_detection_logic == WCD_DETECTION_LEGACY) {
- snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_1, 0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_MBHC_CTL_BCS, 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD934X_MBHC_NEW_CTL_1,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component, WCD934X_MBHC_CTL_BCS,
+ 0x01, 0x01);
}
return 0;
err:
- devm_kfree(codec->dev, wcd934x_mbhc);
+ devm_kfree(component->dev, wcd934x_mbhc);
return ret;
}
EXPORT_SYMBOL(tavil_mbhc_init);
/*
* tavil_mbhc_deinit: deinitialize mbhc for tavil
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*/
-void tavil_mbhc_deinit(struct snd_soc_codec *codec)
+void tavil_mbhc_deinit(struct snd_soc_component *component)
{
- struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(codec);
+ struct wcd934x_mbhc *wcd934x_mbhc = tavil_soc_get_mbhc(component);
if (wcd934x_mbhc) {
wcd_mbhc_deinit(&wcd934x_mbhc->wcd_mbhc);
- devm_kfree(codec->dev, wcd934x_mbhc);
+ devm_kfree(component->dev, wcd934x_mbhc);
}
}
EXPORT_SYMBOL(tavil_mbhc_deinit);
diff --git a/asoc/codecs/wcd934x/wcd934x-mbhc.h b/asoc/codecs/wcd934x/wcd934x-mbhc.h
index 53c886d..69cd460 100644
--- a/asoc/codecs/wcd934x/wcd934x-mbhc.h
+++ b/asoc/codecs/wcd934x/wcd934x-mbhc.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __WCD934X_MBHC_H__
#define __WCD934X_MBHC_H__
@@ -37,36 +29,37 @@
#if IS_ENABLED(CONFIG_SND_SOC_WCD934X_MBHC)
extern int tavil_mbhc_init(struct wcd934x_mbhc **mbhc,
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
struct fw_info *fw_data);
-extern void tavil_mbhc_hs_detect_exit(struct snd_soc_codec *codec);
-extern int tavil_mbhc_hs_detect(struct snd_soc_codec *codec,
+extern void tavil_mbhc_hs_detect_exit(struct snd_soc_component *component);
+extern int tavil_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg);
-extern void tavil_mbhc_deinit(struct snd_soc_codec *codec);
+extern void tavil_mbhc_deinit(struct snd_soc_component *component);
extern int tavil_mbhc_post_ssr_init(struct wcd934x_mbhc *mbhc,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
extern int tavil_mbhc_get_impedance(struct wcd934x_mbhc *wcd934x_mbhc,
uint32_t *zl, uint32_t *zr);
#else
static inline int tavil_mbhc_init(struct wcd934x_mbhc **mbhc,
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
struct fw_info *fw_data)
{
return 0;
}
-static inline void tavil_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
+static inline void tavil_mbhc_hs_detect_exit(
+ struct snd_soc_component *component)
{
}
-static inline int tavil_mbhc_hs_detect(struct snd_soc_codec *codec,
+static inline int tavil_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg)
{
return 0;
}
-static inline void tavil_mbhc_deinit(struct snd_soc_codec *codec)
+static inline void tavil_mbhc_deinit(struct snd_soc_component *component)
{
}
static inline int tavil_mbhc_post_ssr_init(struct wcd934x_mbhc *mbhc,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return 0;
}
diff --git a/asoc/codecs/wcd934x/wcd934x-regmap.c b/asoc/codecs/wcd934x/wcd934x-regmap.c
index e62b69c..051586f 100644
--- a/asoc/codecs/wcd934x/wcd934x-regmap.c
+++ b/asoc/codecs/wcd934x/wcd934x-regmap.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/regmap.h>
diff --git a/asoc/codecs/wcd934x/wcd934x-routing.h b/asoc/codecs/wcd934x/wcd934x-routing.h
index 8adeef7..51a3618 100644
--- a/asoc/codecs/wcd934x/wcd934x-routing.h
+++ b/asoc/codecs/wcd934x/wcd934x-routing.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef WCD934X_ROUTING_H
#define WCD934X_ROUTING_H
diff --git a/asoc/codecs/wcd934x/wcd934x-tables.c b/asoc/codecs/wcd934x/wcd934x-tables.c
index 4e6c2fb..afe7939 100644
--- a/asoc/codecs/wcd934x/wcd934x-tables.c
+++ b/asoc/codecs/wcd934x/wcd934x-tables.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/types.h>
diff --git a/asoc/codecs/wcd934x/wcd934x.c b/asoc/codecs/wcd934x/wcd934x.c
index 0ca7dbb..d930ec8 100644
--- a/asoc/codecs/wcd934x/wcd934x.c
+++ b/asoc/codecs/wcd934x/wcd934x.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -51,6 +43,8 @@
#include "../wcdcal-hwdep.h"
#include "wcd934x-dsd.h"
+#define DRV_NAME "tavil_codec"
+
#define WCD934X_RATES_MASK (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\
@@ -493,7 +487,7 @@
module_param(tx_unmute_delay, int, 0664);
MODULE_PARM_DESC(tx_unmute_delay, "delay to unmute the tx path");
-static void tavil_codec_set_tx_hold(struct snd_soc_codec *, u16, bool);
+static void tavil_codec_set_tx_hold(struct snd_soc_component *, u16, bool);
/* Hold instance to soundwire platform device */
struct tavil_swr_ctrl_data {
@@ -551,7 +545,7 @@
struct tavil_priv {
struct device *dev;
struct wcd9xxx *wcd9xxx;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u32 rx_bias_count;
s32 dmic_0_1_clk_cnt;
s32 dmic_2_3_clk_cnt;
@@ -669,14 +663,14 @@
* tavil_set_spkr_gain_offset - offset the speaker path
* gain with the given offset value.
*
- * @codec: codec instance
+ * @component: codec component instance
* @offset: Indicates speaker path gain offset value.
*
* Returns 0 on success or -EINVAL on error.
*/
-int tavil_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset)
+int tavil_set_spkr_gain_offset(struct snd_soc_component *component, int offset)
{
- struct tavil_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *priv = snd_soc_component_get_drvdata(component);
if (!priv)
return -EINVAL;
@@ -690,14 +684,14 @@
* tavil_set_spkr_mode - Configures speaker compander and smartboost
* settings based on speaker mode.
*
- * @codec: codec instance
+ * @component: codec component instance
* @mode: Indicates speaker configuration mode.
*
* Returns 0 on success or -EINVAL on error.
*/
-int tavil_set_spkr_mode(struct snd_soc_codec *codec, int mode)
+int tavil_set_spkr_mode(struct snd_soc_component *component, int mode)
{
- struct tavil_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *priv = snd_soc_component_get_drvdata(component);
int i;
const struct tavil_reg_mask_val *regs;
int size;
@@ -718,7 +712,7 @@
priv->swr.spkr_mode = mode;
for (i = 0; i < size; i++)
- snd_soc_update_bits(codec, regs[i].reg,
+ snd_soc_component_update_bits(component, regs[i].reg,
regs[i].mask, regs[i].val);
return 0;
}
@@ -727,13 +721,13 @@
/**
* tavil_get_afe_config - returns specific codec configuration to afe to write
*
- * @codec: codec instance
+ * @component: codec component instance
* @config_type: Indicates type of configuration to write.
*/
-void *tavil_get_afe_config(struct snd_soc_codec *codec,
+void *tavil_get_afe_config(struct snd_soc_component *component,
enum afe_config_type config_type)
{
- struct tavil_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *priv = snd_soc_component_get_drvdata(component);
switch (config_type) {
case AFE_SLIMBUS_SLAVE_CONFIG:
@@ -747,7 +741,7 @@
case AFE_CDC_REGISTER_PAGE_CONFIG:
return &tavil_cdc_reg_page_cfg;
default:
- dev_info(codec->dev, "%s: Unknown config_type 0x%x\n",
+ dev_info(component->dev, "%s: Unknown config_type 0x%x\n",
__func__, config_type);
return NULL;
}
@@ -818,8 +812,9 @@
static int tavil_get_anc_slot(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tavil->anc_slot;
return 0;
@@ -828,8 +823,9 @@
static int tavil_put_anc_slot(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
tavil->anc_slot = ucontrol->value.integer.value[0];
return 0;
@@ -838,8 +834,9 @@
static int tavil_get_anc_func(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = (tavil->anc_func == true ? 1 : 0);
return 0;
@@ -848,13 +845,15 @@
static int tavil_put_anc_func(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
mutex_lock(&tavil->codec_mutex);
tavil->anc_func = (!ucontrol->value.integer.value[0] ? false : true);
- dev_dbg(codec->dev, "%s: anc_func %x", __func__, tavil->anc_func);
+ dev_dbg(component->dev, "%s: anc_func %x", __func__, tavil->anc_func);
if (tavil->anc_func == true) {
snd_soc_dapm_enable_pin(dapm, "ANC EAR PA");
@@ -894,8 +893,9 @@
static int tavil_codec_enable_anc(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
const char *filename;
const struct firmware *fw;
int i;
@@ -920,28 +920,28 @@
if (hwdep_cal) {
data = hwdep_cal->data;
cal_size = hwdep_cal->size;
- dev_dbg(codec->dev, "%s: using hwdep calibration, cal_size %zd",
+ dev_dbg(component->dev, "%s: using hwdep calibration, cal_size %zd",
__func__, cal_size);
} else {
filename = "WCD934X/WCD934X_anc.bin";
- ret = request_firmware(&fw, filename, codec->dev);
+ ret = request_firmware(&fw, filename, component->dev);
if (ret < 0) {
- dev_err(codec->dev, "%s: Failed to acquire ANC data: %d\n",
+ dev_err(component->dev, "%s: Failed to acquire ANC data: %d\n",
__func__, ret);
return ret;
}
if (!fw) {
- dev_err(codec->dev, "%s: Failed to get anc fw\n",
+ dev_err(component->dev, "%s: Failed to get anc fw\n",
__func__);
return -ENODEV;
}
data = fw->data;
cal_size = fw->size;
- dev_dbg(codec->dev, "%s: using request_firmware calibration\n",
+ dev_dbg(component->dev, "%s: using request_firmware calibration\n",
__func__);
}
if (cal_size < sizeof(struct wcd9xxx_anc_header)) {
- dev_err(codec->dev, "%s: Invalid cal_size %zd\n",
+ dev_err(component->dev, "%s: Invalid cal_size %zd\n",
__func__, cal_size);
ret = -EINVAL;
goto err;
@@ -954,14 +954,14 @@
num_anc_slots = anc_head->num_anc_slots;
if (tavil->anc_slot >= num_anc_slots) {
- dev_err(codec->dev, "%s: Invalid ANC slot selected\n",
+ dev_err(component->dev, "%s: Invalid ANC slot selected\n",
__func__);
ret = -EINVAL;
goto err;
}
for (i = 0; i < num_anc_slots; i++) {
if (anc_size_remaining < WCD934X_PACKED_REG_SIZE) {
- dev_err(codec->dev, "%s: Invalid register format\n",
+ dev_err(component->dev, "%s: Invalid register format\n",
__func__);
ret = -EINVAL;
goto err;
@@ -972,7 +972,7 @@
if ((anc_writes_size * WCD934X_PACKED_REG_SIZE) >
anc_size_remaining) {
- dev_err(codec->dev, "%s: Invalid register format\n",
+ dev_err(component->dev, "%s: Invalid register format\n",
__func__);
ret = -EINVAL;
goto err;
@@ -986,7 +986,7 @@
anc_ptr += anc_writes_size;
}
if (i == num_anc_slots) {
- dev_err(codec->dev, "%s: Selected ANC slot not present\n",
+ dev_err(component->dev, "%s: Selected ANC slot not present\n",
__func__);
ret = -EINVAL;
goto err;
@@ -1003,34 +1003,34 @@
for (; i < anc_writes_size; i++) {
WCD934X_CODEC_UNPACK_ENTRY(anc_ptr[i], reg, mask, val);
- snd_soc_write(codec, reg, (val & mask));
+ snd_soc_component_write(component, reg, (val & mask));
}
/* Rate converter clk enable and set bypass mode */
if (!strcmp(w->name, "RX INT0 DAC") ||
!strcmp(w->name, "RX INT1 DAC") ||
!strcmp(w->name, "ANC SPK1 PA")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_ANC0_RC_COMMON_CTL,
0x05, 0x05);
if (!strcmp(w->name, "RX INT1 DAC")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_ANC0_FIFO_COMMON_CTL,
0x66, 0x66);
}
} else if (!strcmp(w->name, "RX INT2 DAC")) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_ANC1_RC_COMMON_CTL,
0x05, 0x05);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_ANC1_FIFO_COMMON_CTL,
0x66, 0x66);
}
if (!strcmp(w->name, "RX INT1 DAC"))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_ANC0_CLK_RESET_CTL, 0x08, 0x08);
else if (!strcmp(w->name, "RX INT2 DAC"))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_ANC1_CLK_RESET_CTL, 0x08, 0x08);
if (!hwdep_cal)
@@ -1041,10 +1041,10 @@
if (!strcmp(w->name, "ANC HPHL PA") ||
!strcmp(w->name, "ANC HPHR PA")) {
/* Remove ANC Rx from reset */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_ANC0_CLK_RESET_CTL,
0x08, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_ANC1_CLK_RESET_CTL,
0x08, 0x00);
}
@@ -1052,40 +1052,45 @@
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, WCD934X_CDC_ANC0_RC_COMMON_CTL,
- 0x05, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC0_RC_COMMON_CTL,
+ 0x05, 0x00);
if (!strcmp(w->name, "ANC EAR PA") ||
!strcmp(w->name, "ANC SPK1 PA") ||
!strcmp(w->name, "ANC HPHL PA")) {
- snd_soc_update_bits(codec, WCD934X_CDC_ANC0_MODE_1_CTL,
- 0x30, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC0_MODE_1_CTL,
+ 0x30, 0x00);
msleep(50);
- snd_soc_update_bits(codec, WCD934X_CDC_ANC0_MODE_1_CTL,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD934X_CDC_ANC0_CLK_RESET_CTL,
- 0x38, 0x38);
- snd_soc_update_bits(codec,
- WCD934X_CDC_ANC0_CLK_RESET_CTL,
- 0x07, 0x00);
- snd_soc_update_bits(codec,
- WCD934X_CDC_ANC0_CLK_RESET_CTL,
- 0x38, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC0_MODE_1_CTL,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC0_CLK_RESET_CTL,
+ 0x38, 0x38);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC0_CLK_RESET_CTL,
+ 0x07, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC0_CLK_RESET_CTL,
+ 0x38, 0x00);
} else if (!strcmp(w->name, "ANC HPHR PA")) {
- snd_soc_update_bits(codec, WCD934X_CDC_ANC1_MODE_1_CTL,
- 0x30, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC1_MODE_1_CTL,
+ 0x30, 0x00);
msleep(50);
- snd_soc_update_bits(codec, WCD934X_CDC_ANC1_MODE_1_CTL,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD934X_CDC_ANC1_CLK_RESET_CTL,
- 0x38, 0x38);
- snd_soc_update_bits(codec,
- WCD934X_CDC_ANC1_CLK_RESET_CTL,
- 0x07, 0x00);
- snd_soc_update_bits(codec,
- WCD934X_CDC_ANC1_CLK_RESET_CTL,
- 0x38, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC1_MODE_1_CTL,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC1_CLK_RESET_CTL,
+ 0x38, 0x38);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC1_CLK_RESET_CTL,
+ 0x07, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_ANC1_CLK_RESET_CTL,
+ 0x38, 0x00);
}
break;
}
@@ -1100,15 +1105,16 @@
static int tavil_get_clkmode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
if (test_bit(CLK_MODE, &tavil_p->status_mask))
ucontrol->value.enumerated.item[0] = 1;
else
ucontrol->value.enumerated.item[0] = 0;
- dev_dbg(codec->dev, "%s: is_low_power_clock: %s\n", __func__,
+ dev_dbg(component->dev, "%s: is_low_power_clock: %s\n", __func__,
test_bit(CLK_MODE, &tavil_p->status_mask) ? "true" : "false");
return 0;
@@ -1117,15 +1123,16 @@
static int tavil_put_clkmode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
if (ucontrol->value.enumerated.item[0])
set_bit(CLK_MODE, &tavil_p->status_mask);
else
clear_bit(CLK_MODE, &tavil_p->status_mask);
- dev_dbg(codec->dev, "%s: is_low_power_clock: %s\n", __func__,
+ dev_dbg(component->dev, "%s: is_low_power_clock: %s\n", __func__,
test_bit(CLK_MODE, &tavil_p->status_mask) ? "true" : "false");
return 0;
@@ -1136,8 +1143,9 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tavil_p->vi_feed_value;
@@ -1149,16 +1157,17 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx *core = dev_get_drvdata(component->dev->parent);
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
u32 dai_id = widget->shift;
u32 port_id = mixer->shift;
u32 enable = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: enable: %d, port_id:%d, dai_id: %d\n",
+ dev_dbg(component->dev, "%s: enable: %d, port_id:%d, dai_id: %d\n",
__func__, enable, port_id, dai_id);
tavil_p->vi_feed_value = ucontrol->value.integer.value[0];
@@ -1199,9 +1208,10 @@
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tavil_p->tx_port_value;
return 0;
@@ -1211,10 +1221,11 @@
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
+ snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx *core = dev_get_drvdata(component->dev->parent);
struct snd_soc_dapm_update *update = NULL;
struct soc_multi_mixer_control *mixer =
((struct soc_multi_mixer_control *)kcontrol->private_value);
@@ -1223,14 +1234,14 @@
u32 enable = ucontrol->value.integer.value[0];
u32 vtable;
- dev_dbg(codec->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
+ dev_dbg(component->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
__func__,
widget->name, ucontrol->id.name, tavil_p->tx_port_value,
widget->shift, ucontrol->value.integer.value[0]);
mutex_lock(&tavil_p->codec_mutex);
if (dai_id >= ARRAY_SIZE(vport_slim_check_table)) {
- dev_err(codec->dev, "%s: dai_id: %d, out of bounds\n",
+ dev_err(component->dev, "%s: dai_id: %d, out of bounds\n",
__func__, dai_id);
mutex_unlock(&tavil_p->codec_mutex);
return -EINVAL;
@@ -1245,7 +1256,7 @@
if (enable && !(tavil_p->tx_port_value & 1 << port_id)) {
if (wcd9xxx_tx_vport_validation(vtable, port_id,
tavil_p->dai, NUM_CODEC_DAIS)) {
- dev_dbg(codec->dev, "%s: TX%u is used by other virtual port\n",
+ dev_dbg(component->dev, "%s: TX%u is used by other virtual port\n",
__func__, port_id);
mutex_unlock(&tavil_p->codec_mutex);
return 0;
@@ -1259,11 +1270,11 @@
list_del_init(&core->tx_chs[port_id].list);
} else {
if (enable)
- dev_dbg(codec->dev, "%s: TX%u port is used by\n"
+ dev_dbg(component->dev, "%s: TX%u port is used by\n"
"this virtual port\n",
__func__, port_id);
else
- dev_dbg(codec->dev, "%s: TX%u port is not used by\n"
+ dev_dbg(component->dev, "%s: TX%u port is not used by\n"
"this virtual port\n",
__func__, port_id);
/* avoid update power function */
@@ -1274,11 +1285,11 @@
case AIF4_MAD_TX:
break;
default:
- dev_err(codec->dev, "Unknown AIF %d\n", dai_id);
+ dev_err(component->dev, "Unknown AIF %d\n", dai_id);
mutex_unlock(&tavil_p->codec_mutex);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s: name %s sname %s updated value %u shift %d\n",
+ dev_dbg(component->dev, "%s: name %s sname %s updated value %u shift %d\n",
__func__, widget->name, widget->sname, tavil_p->tx_port_value,
widget->shift);
@@ -1293,8 +1304,9 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tavil_p->tx_port_value;
return 0;
@@ -1305,8 +1317,9 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
struct snd_soc_dapm_update *update = NULL;
struct soc_multi_mixer_control *mixer =
(struct soc_multi_mixer_control *)kcontrol->private_value;
@@ -1315,14 +1328,14 @@
u32 enable = ucontrol->value.integer.value[0];
u32 vtable;
- dev_dbg(codec->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
+ dev_dbg(component->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
__func__,
widget->name, ucontrol->id.name, tavil_p->tx_port_value,
widget->shift, ucontrol->value.integer.value[0]);
mutex_lock(&tavil_p->codec_mutex);
if (dai_id >= ARRAY_SIZE(vport_slim_check_table)) {
- dev_err(codec->dev, "%s: dai_id: %d, out of bounds\n",
+ dev_err(component->dev, "%s: dai_id: %d, out of bounds\n",
__func__, dai_id);
mutex_unlock(&tavil_p->codec_mutex);
return -EINVAL;
@@ -1337,7 +1350,7 @@
if (enable && !(tavil_p->tx_port_value & 1 << port_id)) {
if (wcd9xxx_tx_vport_validation(vtable, port_id,
tavil_p->dai, NUM_CODEC_DAIS)) {
- dev_dbg(codec->dev, "%s: TX%u is used by other virtual port\n",
+ dev_dbg(component->dev, "%s: TX%u is used by other virtual port\n",
__func__, port_id);
mutex_unlock(&tavil_p->codec_mutex);
return 0;
@@ -1348,11 +1361,11 @@
tavil_p->tx_port_value &= ~(1 << port_id);
} else {
if (enable)
- dev_dbg(codec->dev, "%s: TX%u port is used by\n"
+ dev_dbg(component->dev, "%s: TX%u port is used by\n"
"this virtual port\n",
__func__, port_id);
else
- dev_dbg(codec->dev, "%s: TX%u port is not used by\n"
+ dev_dbg(component->dev, "%s: TX%u port is not used by\n"
"this virtual port\n",
__func__, port_id);
/* avoid update power function */
@@ -1361,11 +1374,11 @@
}
break;
default:
- dev_err(codec->dev, "Unknown AIF %d\n", dai_id);
+ dev_err(component->dev, "Unknown AIF %d\n", dai_id);
mutex_unlock(&tavil_p->codec_mutex);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s: name %s sname %s updated value %u shift %d\n",
+ dev_dbg(component->dev, "%s: name %s sname %s updated value %u shift %d\n",
__func__, widget->name, widget->sname, tavil_p->tx_port_value,
widget->shift);
@@ -1380,8 +1393,9 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
ucontrol->value.enumerated.item[0] =
tavil_p->rx_port_value[widget->shift];
@@ -1393,9 +1407,10 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx *core = dev_get_drvdata(component->dev->parent);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
struct snd_soc_dapm_update *update = NULL;
unsigned int rx_port_value;
@@ -1405,7 +1420,7 @@
rx_port_value = tavil_p->rx_port_value[port_id];
mutex_lock(&tavil_p->codec_mutex);
- dev_dbg(codec->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
+ dev_dbg(component->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
__func__, widget->name, ucontrol->id.name,
rx_port_value, widget->shift,
ucontrol->value.integer.value[0]);
@@ -1419,7 +1434,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
WCD934X_RX_PORT_START_NUMBER,
&tavil_p->dai[AIF1_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -1430,7 +1445,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
WCD934X_RX_PORT_START_NUMBER,
&tavil_p->dai[AIF2_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -1441,7 +1456,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
WCD934X_RX_PORT_START_NUMBER,
&tavil_p->dai[AIF3_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -1452,7 +1467,7 @@
if (wcd9xxx_rx_vport_validation(port_id +
WCD934X_RX_PORT_START_NUMBER,
&tavil_p->dai[AIF4_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
+ dev_dbg(component->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
__func__, port_id);
goto rtn;
}
@@ -1460,7 +1475,7 @@
&tavil_p->dai[AIF4_PB].wcd9xxx_ch_list);
break;
default:
- dev_err(codec->dev, "Unknown AIF %d\n", rx_port_value);
+ dev_err(component->dev, "Unknown AIF %d\n", rx_port_value);
goto err;
}
rtn:
@@ -1476,7 +1491,7 @@
static void tavil_codec_enable_slim_port_intr(
struct wcd9xxx_codec_dai_data *dai,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct wcd9xxx_ch *ch;
int port_num = 0;
@@ -1484,12 +1499,12 @@
u8 val = 0;
struct tavil_priv *tavil_p;
- if (!dai || !codec) {
+ if (!dai || !component) {
pr_err("%s: Invalid params\n", __func__);
return;
}
- tavil_p = snd_soc_codec_get_drvdata(codec);
+ tavil_p = snd_soc_component_get_drvdata(component);
list_for_each_entry(ch, &dai->wcd9xxx_ch_list, list) {
if (ch->port >= WCD934X_RX_PORT_START_NUMBER) {
port_num = ch->port - WCD934X_RX_PORT_START_NUMBER;
@@ -1551,7 +1566,7 @@
return ret;
}
-static void tavil_codec_mute_dsd(struct snd_soc_codec *codec,
+static void tavil_codec_mute_dsd(struct snd_soc_component *component,
struct list_head *ch_list)
{
u8 dsd0_in;
@@ -1559,8 +1574,10 @@
struct wcd9xxx_ch *ch;
/* Read DSD Input Ports */
- dsd0_in = (snd_soc_read(codec, WCD934X_CDC_DSD0_CFG0) & 0x3C) >> 2;
- dsd1_in = (snd_soc_read(codec, WCD934X_CDC_DSD1_CFG0) & 0x3C) >> 2;
+ dsd0_in = (snd_soc_component_read32(
+ component, WCD934X_CDC_DSD0_CFG0) & 0x3C) >> 2;
+ dsd1_in = (snd_soc_component_read32(
+ component, WCD934X_CDC_DSD1_CFG0) & 0x3C) >> 2;
if ((dsd0_in == 0) && (dsd1_in == 0))
return;
@@ -1571,11 +1588,13 @@
*/
list_for_each_entry(ch, ch_list, list) {
if (ch->port == (dsd0_in + WCD934X_RX_PORT_START_NUMBER - 1))
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_CFG2,
- 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_CFG2,
+ 0x04, 0x04);
if (ch->port == (dsd1_in + WCD934X_RX_PORT_START_NUMBER - 1))
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_CFG2,
- 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_CFG2,
+ 0x04, 0x04);
}
}
@@ -1584,8 +1603,9 @@
{
int rx_fs_rate = -EINVAL;
int i2s_bit_mode;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
struct wcd9xxx_codec_dai_data *dai;
dai = &tavil_p->dai[w->shift];
@@ -1624,14 +1644,14 @@
__func__, dai->rate);
return -EINVAL;
};
- snd_soc_update_bits(codec, i2s_reg,
+ snd_soc_component_update_bits(component, i2s_reg,
0x40, i2s_bit_mode << 6);
- snd_soc_update_bits(codec, i2s_reg,
+ snd_soc_component_update_bits(component, i2s_reg,
0x3c, (rx_fs_rate << 2));
} else {
- snd_soc_update_bits(codec, i2s_reg,
+ snd_soc_component_update_bits(component, i2s_reg,
0x40, 0x00);
- snd_soc_update_bits(codec, i2s_reg,
+ snd_soc_component_update_bits(component, i2s_reg,
0x3c, 0x00);
}
return 0;
@@ -1642,8 +1662,9 @@
{
int tx_fs_rate = -EINVAL;
int i2s_bit_mode;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
struct wcd9xxx_codec_dai_data *dai;
dai = &tavil_p->dai[w->shift];
@@ -1653,7 +1674,8 @@
else
i2s_bit_mode = 0x00;
- snd_soc_update_bits(codec, i2s_reg, 0x40, i2s_bit_mode << 6);
+ snd_soc_component_update_bits(
+ component, i2s_reg, 0x40, i2s_bit_mode << 6);
switch (dai->rate) {
case 8000:
@@ -1683,40 +1705,41 @@
return -EINVAL;
};
- snd_soc_update_bits(codec, i2s_reg, 0x3c, tx_fs_rate << 2);
+ snd_soc_component_update_bits(
+ component, i2s_reg, 0x3c, tx_fs_rate << 2);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_DATA_HUB_I2S_TX0_CFG,
0x03, 0x01);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_DATA_HUB_I2S_TX0_CFG,
0x0C, 0x01);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_DATA_HUB_I2S_TX1_0_CFG,
0x03, 0x01);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_DATA_HUB_I2S_TX1_1_CFG,
0x05, 0x05);
} else {
- snd_soc_update_bits(codec, i2s_reg, 0x40, 0x00);
- snd_soc_update_bits(codec, i2s_reg, 0x3c, 0x00);
+ snd_soc_component_update_bits(component, i2s_reg, 0x40, 0x00);
+ snd_soc_component_update_bits(component, i2s_reg, 0x3c, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_DATA_HUB_I2S_TX0_CFG,
0x03, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_DATA_HUB_I2S_TX0_CFG,
0x0C, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_DATA_HUB_I2S_TX1_0_CFG,
0x03, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_DATA_HUB_I2S_TX1_1_CFG,
0x05, 0x00);
}
@@ -1727,8 +1750,9 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
int ret = -EINVAL;
u32 i2s_reg;
@@ -1746,7 +1770,7 @@
i2s_reg = WCD934X_DATA_HUB_I2S_2_CTL;
break;
default:
- dev_err(codec->dev, "%s Invalid i2s Id received", __func__);
+ dev_err(component->dev, "%s Invalid i2s Id received", __func__);
return -EINVAL;
}
@@ -1767,21 +1791,22 @@
int event)
{
struct wcd9xxx *core;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
int ret = 0;
struct wcd9xxx_codec_dai_data *dai;
struct tavil_dsd_config *dsd_conf = tavil_p->dsd_config;
- core = dev_get_drvdata(codec->dev->parent);
+ core = dev_get_drvdata(component->dev->parent);
- dev_dbg(codec->dev, "%s: event called! codec name %s num_dai %d\n"
+ dev_dbg(component->dev, "%s: event called! codec name %s num_dai %d\n"
"stream name %s event %d\n",
- __func__, codec->component.name,
- codec->component.num_dai, w->sname, event);
+ __func__, component->name,
+ component->num_dai, w->sname, event);
dai = &tavil_p->dai[w->shift];
- dev_dbg(codec->dev, "%s: w->name %s w->shift %d event %d\n",
+ dev_dbg(component->dev, "%s: w->name %s w->shift %d event %d\n",
__func__, w->name, w->shift, event);
if (tavil_p->intf_type == WCD9XXX_INTERFACE_TYPE_I2C) {
@@ -1792,7 +1817,7 @@
switch (event) {
case SND_SOC_DAPM_POST_PMU:
dai->bus_down_in_recovery = false;
- tavil_codec_enable_slim_port_intr(dai, codec);
+ tavil_codec_enable_slim_port_intr(dai, component);
(void) tavil_codec_enable_slim_chmask(dai, true);
ret = wcd9xxx_cfg_slim_sch_rx(core, &dai->wcd9xxx_ch_list,
dai->rate, dai->bit_width,
@@ -1800,17 +1825,17 @@
break;
case SND_SOC_DAPM_POST_PMD:
if (dsd_conf)
- tavil_codec_mute_dsd(codec, &dai->wcd9xxx_ch_list);
+ tavil_codec_mute_dsd(component, &dai->wcd9xxx_ch_list);
ret = wcd9xxx_disconnect_port(core, &dai->wcd9xxx_ch_list,
dai->grph);
- dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
+ dev_dbg(component->dev, "%s: Disconnect RX port, ret = %d\n",
__func__, ret);
if (!dai->bus_down_in_recovery)
ret = tavil_codec_enable_slim_chmask(dai, false);
else
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: bus in recovery skip enable slim_chmask",
__func__);
ret = wcd9xxx_close_slim_sch_rx(core, &dai->wcd9xxx_ch_list,
@@ -1824,8 +1849,9 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
int ret = -EINVAL;
u32 i2s_reg;
@@ -1843,7 +1869,7 @@
i2s_reg = WCD934X_DATA_HUB_I2S_2_CTL;
break;
default:
- dev_err(codec->dev, "%s Invalid i2s Id received", __func__);
+ dev_err(component->dev, "%s Invalid i2s Id received", __func__);
return -EINVAL;
}
@@ -1863,19 +1889,20 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
struct wcd9xxx_codec_dai_data *dai;
struct wcd9xxx *core;
int ret = 0;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: w->name %s, w->shift = %d, num_dai %d stream name %s\n",
__func__, w->name, w->shift,
- codec->component.num_dai, w->sname);
+ component->num_dai, w->sname);
dai = &tavil_p->dai[w->shift];
- core = dev_get_drvdata(codec->dev->parent);
+ core = dev_get_drvdata(component->dev->parent);
if (tavil_p->intf_type == WCD9XXX_INTERFACE_TYPE_I2C) {
ret = tavil_codec_enable_tx_i2c(w, kcontrol, event);
@@ -1885,7 +1912,7 @@
switch (event) {
case SND_SOC_DAPM_POST_PMU:
dai->bus_down_in_recovery = false;
- tavil_codec_enable_slim_port_intr(dai, codec);
+ tavil_codec_enable_slim_port_intr(dai, component);
(void) tavil_codec_enable_slim_chmask(dai, true);
ret = wcd9xxx_cfg_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
dai->rate, dai->bit_width,
@@ -1900,7 +1927,7 @@
ret = wcd9xxx_disconnect_port(core,
&dai->wcd9xxx_ch_list,
dai->grph);
- dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
+ dev_dbg(component->dev, "%s: Disconnect RX port, ret = %d\n",
__func__, ret);
}
break;
@@ -1913,18 +1940,18 @@
int event)
{
struct wcd9xxx *core = NULL;
- struct snd_soc_codec *codec = NULL;
+ struct snd_soc_component *component = NULL;
struct tavil_priv *tavil_p = NULL;
int ret = 0;
struct wcd9xxx_codec_dai_data *dai = NULL;
- codec = snd_soc_dapm_to_codec(w->dapm);
- tavil_p = snd_soc_codec_get_drvdata(codec);
- core = dev_get_drvdata(codec->dev->parent);
+ component = snd_soc_dapm_to_component(w->dapm);
+ tavil_p = snd_soc_component_get_drvdata(component);
+ core = dev_get_drvdata(component->dev->parent);
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: num_dai %d stream name %s w->name %s event %d shift %d\n",
- __func__, codec->component.num_dai, w->sname,
+ __func__, component->num_dai, w->sname,
w->name, event, w->shift);
if (w->shift != AIF4_VIFEED) {
@@ -1936,59 +1963,60 @@
switch (event) {
case SND_SOC_DAPM_POST_PMU:
if (test_bit(VI_SENSE_1, &tavil_p->status_mask)) {
- dev_dbg(codec->dev, "%s: spkr1 enabled\n", __func__);
+ dev_dbg(component->dev, "%s: spkr1 enabled\n",
+ __func__);
/* Enable V&I sensing */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX9_SPKR_PROT_PATH_CTL, 0x0F, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX10_SPKR_PROT_PATH_CTL, 0x0F,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX9_SPKR_PROT_PATH_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX10_SPKR_PROT_PATH_CTL, 0x10,
0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
0x00);
}
if (test_bit(VI_SENSE_2, &tavil_p->status_mask)) {
pr_debug("%s: spkr2 enabled\n", __func__);
/* Enable V&I sensing */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX11_SPKR_PROT_PATH_CTL, 0x0F,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX12_SPKR_PROT_PATH_CTL, 0x0F,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX11_SPKR_PROT_PATH_CTL, 0x10,
0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX12_SPKR_PROT_PATH_CTL, 0x10,
0x10);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
0x00);
}
dai->bus_down_in_recovery = false;
- tavil_codec_enable_slim_port_intr(dai, codec);
+ tavil_codec_enable_slim_port_intr(dai, component);
(void) tavil_codec_enable_slim_chmask(dai, true);
ret = wcd9xxx_cfg_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
dai->rate, dai->bit_width,
@@ -1998,7 +2026,7 @@
ret = wcd9xxx_close_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
dai->grph);
if (ret)
- dev_err(codec->dev, "%s error in close_slim_sch_tx %d\n",
+ dev_err(component->dev, "%s error in close_slim_sch_tx %d\n",
__func__, ret);
if (!dai->bus_down_in_recovery)
ret = tavil_codec_enable_slim_chmask(dai, false);
@@ -2006,36 +2034,38 @@
ret = wcd9xxx_disconnect_port(core,
&dai->wcd9xxx_ch_list,
dai->grph);
- dev_dbg(codec->dev, "%s: Disconnect TX port, ret = %d\n",
+ dev_dbg(component->dev, "%s: Disconnect TX port, ret = %d\n",
__func__, ret);
}
if (test_bit(VI_SENSE_1, &tavil_p->status_mask)) {
/* Disable V&I sensing */
- dev_dbg(codec->dev, "%s: spkr1 disabled\n", __func__);
- snd_soc_update_bits(codec,
+ dev_dbg(component->dev, "%s: spkr1 disabled\n",
+ __func__);
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX9_SPKR_PROT_PATH_CTL, 0x10, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX10_SPKR_PROT_PATH_CTL, 0x10,
0x00);
}
if (test_bit(VI_SENSE_2, &tavil_p->status_mask)) {
/* Disable V&I sensing */
- dev_dbg(codec->dev, "%s: spkr2 disabled\n", __func__);
- snd_soc_update_bits(codec,
+ dev_dbg(component->dev, "%s: spkr2 disabled\n",
+ __func__);
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
0x20);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX11_SPKR_PROT_PATH_CTL, 0x10,
0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_TX12_SPKR_PROT_PATH_CTL, 0x10,
0x00);
}
@@ -2048,28 +2078,31 @@
static int tavil_codec_enable_rx_bias(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
tavil->rx_bias_count++;
if (tavil->rx_bias_count == 1) {
- snd_soc_update_bits(codec, WCD934X_ANA_RX_SUPPLIES,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_RX_SUPPLIES,
+ 0x01, 0x01);
}
break;
case SND_SOC_DAPM_POST_PMD:
tavil->rx_bias_count--;
if (!tavil->rx_bias_count)
- snd_soc_update_bits(codec, WCD934X_ANA_RX_SUPPLIES,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_RX_SUPPLIES,
+ 0x01, 0x00);
break;
};
- dev_dbg(codec->dev, "%s: Current RX BIAS user count: %d\n", __func__,
- tavil->rx_bias_count);
+ dev_dbg(component->dev, "%s: Current RX BIAS user count: %d\n",
+ __func__, tavil->rx_bias_count);
return 0;
}
@@ -2079,14 +2112,15 @@
struct spk_anc_work *spk_anc_dwork;
struct tavil_priv *tavil;
struct delayed_work *delayed_work;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
delayed_work = to_delayed_work(work);
spk_anc_dwork = container_of(delayed_work, struct spk_anc_work, dwork);
tavil = spk_anc_dwork->tavil;
- codec = tavil->codec;
+ component = tavil->component;
- snd_soc_update_bits(codec, WCD934X_CDC_RX7_RX_PATH_CFG0, 0x10, 0x10);
+ snd_soc_component_update_bits(component, WCD934X_CDC_RX7_RX_PATH_CFG0,
+ 0x10, 0x10);
}
static int tavil_codec_enable_spkr_anc(struct snd_soc_dapm_widget *w,
@@ -2094,13 +2128,14 @@
int event)
{
int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
if (!tavil->anc_func)
return 0;
- dev_dbg(codec->dev, "%s: w: %s event: %d anc: %d\n", __func__,
+ dev_dbg(component->dev, "%s: w: %s event: %d anc: %d\n", __func__,
w->name, event, tavil->anc_func);
switch (event) {
@@ -2111,8 +2146,9 @@
break;
case SND_SOC_DAPM_POST_PMD:
cancel_delayed_work_sync(&tavil->spk_anc_dwork.dwork);
- snd_soc_update_bits(codec, WCD934X_CDC_RX7_RX_PATH_CFG0,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_CFG0,
+ 0x10, 0x00);
ret = tavil_codec_enable_anc(w, kcontrol, event);
break;
}
@@ -2124,9 +2160,10 @@
int event)
{
int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
@@ -2135,12 +2172,14 @@
* HW requirement
*/
usleep_range(5000, 5500);
- snd_soc_update_bits(codec, WCD934X_CDC_RX0_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX0_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, WCD934X_CDC_RX0_RX_PATH_MIX_CTL)) &
+ if ((snd_soc_component_read32(component,
+ WCD934X_CDC_RX0_RX_PATH_MIX_CTL)) &
0x10)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX0_RX_PATH_MIX_CTL,
0x10, 0x00);
break;
@@ -2153,8 +2192,9 @@
if (!(strcmp(w->name, "ANC EAR PA"))) {
ret = tavil_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec, WCD934X_CDC_RX0_RX_PATH_CFG0,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX0_RX_PATH_CFG0,
+ 0x10, 0x00);
}
break;
};
@@ -2162,18 +2202,18 @@
return ret;
}
-static void tavil_codec_override(struct snd_soc_codec *codec, int mode,
+static void tavil_codec_override(struct snd_soc_component *component, int mode,
int event)
{
if (mode == CLS_AB || mode == CLS_AB_HIFI) {
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_ANA_RX_SUPPLIES, 0x02, 0x02);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_ANA_RX_SUPPLIES, 0x02, 0x00);
break;
}
@@ -2183,24 +2223,32 @@
static void tavil_codec_clear_anc_tx_hold(struct tavil_priv *tavil)
{
if (test_and_clear_bit(ANC_MIC_AMIC1, &tavil->status_mask))
- tavil_codec_set_tx_hold(tavil->codec, WCD934X_ANA_AMIC1, false);
+ tavil_codec_set_tx_hold(tavil->component,
+ WCD934X_ANA_AMIC1, false);
if (test_and_clear_bit(ANC_MIC_AMIC2, &tavil->status_mask))
- tavil_codec_set_tx_hold(tavil->codec, WCD934X_ANA_AMIC2, false);
+ tavil_codec_set_tx_hold(tavil->component,
+ WCD934X_ANA_AMIC2, false);
if (test_and_clear_bit(ANC_MIC_AMIC3, &tavil->status_mask))
- tavil_codec_set_tx_hold(tavil->codec, WCD934X_ANA_AMIC3, false);
+ tavil_codec_set_tx_hold(tavil->component,
+ WCD934X_ANA_AMIC3, false);
if (test_and_clear_bit(ANC_MIC_AMIC4, &tavil->status_mask))
- tavil_codec_set_tx_hold(tavil->codec, WCD934X_ANA_AMIC4, false);
+ tavil_codec_set_tx_hold(tavil->component,
+ WCD934X_ANA_AMIC4, false);
}
-static void tavil_ocp_control(struct snd_soc_codec *codec, bool enable)
+static void tavil_ocp_control(struct snd_soc_component *component, bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD934X_HPH_OCP_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec, WCD934X_RX_OCP_CTL, 0x0F, 0x02);
+ snd_soc_component_update_bits(component, WCD934X_HPH_OCP_CTL,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component, WCD934X_RX_OCP_CTL,
+ 0x0F, 0x02);
} else {
- snd_soc_update_bits(codec, WCD934X_RX_OCP_CTL, 0x0F, 0x0F);
- snd_soc_update_bits(codec, WCD934X_HPH_OCP_CTL, 0x10, 0x00);
+ snd_soc_component_update_bits(component, WCD934X_RX_OCP_CTL,
+ 0x0F, 0x0F);
+ snd_soc_component_update_bits(component, WCD934X_HPH_OCP_CTL,
+ 0x10, 0x00);
}
}
@@ -2208,36 +2256,41 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
struct tavil_dsd_config *dsd_conf = tavil->dsd_config;
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- tavil_ocp_control(codec, false);
+ tavil_ocp_control(component, false);
if (TAVIL_IS_1_0(tavil->wcd9xxx))
- snd_soc_update_bits(codec, WCD934X_HPH_REFBUFF_LP_CTL,
- 0x06, (0x03 << 1));
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_REFBUFF_LP_CTL,
+ 0x06, (0x03 << 1));
if ((!(strcmp(w->name, "ANC HPHR PA"))) &&
(test_bit(HPH_PA_DELAY, &tavil->status_mask)))
- snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0xC0, 0xC0);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_HPH, 0xC0, 0xC0);
set_bit(HPH_PA_DELAY, &tavil->status_mask);
if (dsd_conf &&
- (snd_soc_read(codec, WCD934X_CDC_DSD1_PATH_CTL) & 0x01)) {
+ (snd_soc_component_read32(component,
+ WCD934X_CDC_DSD1_PATH_CTL) & 0x01)) {
/* Set regulator mode to AB if DSD is enabled */
- snd_soc_update_bits(codec, WCD934X_ANA_RX_SUPPLIES,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_RX_SUPPLIES,
+ 0x02, 0x02);
}
break;
case SND_SOC_DAPM_POST_PMU:
if ((!(strcmp(w->name, "ANC HPHR PA")))) {
- if ((snd_soc_read(codec, WCD934X_ANA_HPH) & 0xC0)
- != 0xC0)
+ if ((snd_soc_component_read32(component,
+ WCD934X_ANA_HPH) & 0xC0) != 0xC0)
/*
* If PA_EN is not set (potentially in ANC case)
* then do nothing for POST_PMU and let left
@@ -2259,80 +2312,92 @@
}
if (tavil->anc_func) {
/* Clear Tx FE HOLD if both PAs are enabled */
- if ((snd_soc_read(tavil->codec, WCD934X_ANA_HPH) &
- 0xC0) == 0xC0)
+ if ((snd_soc_component_read32(tavil->component,
+ WCD934X_ANA_HPH) & 0xC0) == 0xC0)
tavil_codec_clear_anc_tx_hold(tavil);
}
- snd_soc_update_bits(codec, WCD934X_HPH_R_TEST, 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD934X_HPH_R_TEST,
+ 0x01, 0x01);
/* Remove mute */
- snd_soc_update_bits(codec, WCD934X_CDC_RX2_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX2_RX_PATH_CTL,
+ 0x10, 0x00);
/* Enable GM3 boost */
- snd_soc_update_bits(codec, WCD934X_HPH_CNP_WG_CTL,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component, WCD934X_HPH_CNP_WG_CTL,
+ 0x80, 0x80);
/* Enable AutoChop timer at the end of power up */
- snd_soc_update_bits(codec, WCD934X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x02);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, WCD934X_CDC_RX2_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(component,
+ WCD934X_CDC_RX2_RX_PATH_MIX_CTL)) & 0x10)
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX2_RX_PATH_MIX_CTL,
0x10, 0x00);
if (dsd_conf &&
- (snd_soc_read(codec, WCD934X_CDC_DSD1_PATH_CTL) & 0x01))
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_CFG2,
- 0x04, 0x00);
+ (snd_soc_component_read32(
+ component, WCD934X_CDC_DSD1_PATH_CTL) & 0x01))
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_CFG2, 0x04, 0x00);
if (!(strcmp(w->name, "ANC HPHR PA"))) {
pr_debug("%s:Do everything needed for left channel\n",
__func__);
/* Do everything needed for left channel */
- snd_soc_update_bits(codec, WCD934X_HPH_L_TEST,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_L_TEST,
+ 0x01, 0x01);
/* Remove mute */
- snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX1_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec,
+ if ((snd_soc_component_read32(component,
WCD934X_CDC_RX1_RX_PATH_MIX_CTL)) &
0x10)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX1_RX_PATH_MIX_CTL,
0x10, 0x00);
- if (dsd_conf && (snd_soc_read(codec,
+ if (dsd_conf && (snd_soc_component_read32(component,
WCD934X_CDC_DSD0_PATH_CTL) &
0x01))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_DSD0_CFG2,
0x04, 0x00);
/* Remove ANC Rx from reset */
ret = tavil_codec_enable_anc(w, kcontrol, event);
}
- tavil_codec_override(codec, tavil->hph_mode, event);
- tavil_ocp_control(codec, true);
+ tavil_codec_override(component, tavil->hph_mode, event);
+ tavil_ocp_control(component, true);
break;
case SND_SOC_DAPM_PRE_PMD:
- tavil_ocp_control(codec, false);
+ tavil_ocp_control(component, false);
blocking_notifier_call_chain(&tavil->mbhc->notifier,
WCD_EVENT_PRE_HPHR_PA_OFF,
&tavil->mbhc->wcd_mbhc);
/* Enable DSD Mute before PA disable */
if (dsd_conf &&
- (snd_soc_read(codec, WCD934X_CDC_DSD1_PATH_CTL) & 0x01))
- snd_soc_update_bits(codec, WCD934X_CDC_DSD1_CFG2,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_HPH_R_TEST, 0x01, 0x00);
- snd_soc_update_bits(codec, WCD934X_CDC_RX2_RX_PATH_CTL,
- 0x10, 0x10);
- snd_soc_update_bits(codec, WCD934X_CDC_RX2_RX_PATH_MIX_CTL,
- 0x10, 0x10);
+ (snd_soc_component_read32(component,
+ WCD934X_CDC_DSD1_PATH_CTL) & 0x01))
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD1_CFG2,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component, WCD934X_HPH_R_TEST,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX2_RX_PATH_CTL,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX2_RX_PATH_MIX_CTL,
+ 0x10, 0x10);
if (!(strcmp(w->name, "ANC HPHR PA")))
- snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x40, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_HPH, 0x40, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
/*
@@ -2343,20 +2408,21 @@
usleep_range(20000, 20100);
else
usleep_range(5000, 5100);
- tavil_codec_override(codec, tavil->hph_mode, event);
+ tavil_codec_override(component, tavil->hph_mode, event);
blocking_notifier_call_chain(&tavil->mbhc->notifier,
WCD_EVENT_POST_HPHR_PA_OFF,
&tavil->mbhc->wcd_mbhc);
if (TAVIL_IS_1_0(tavil->wcd9xxx))
- snd_soc_update_bits(codec, WCD934X_HPH_REFBUFF_LP_CTL,
- 0x06, 0x0);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_REFBUFF_LP_CTL,
+ 0x06, 0x0);
if (!(strcmp(w->name, "ANC HPHR PA"))) {
ret = tavil_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX2_RX_PATH_CFG0,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX2_RX_PATH_CFG0,
+ 0x10, 0x00);
}
- tavil_ocp_control(codec, true);
+ tavil_ocp_control(component, true);
break;
};
@@ -2367,35 +2433,40 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
struct tavil_dsd_config *dsd_conf = tavil->dsd_config;
int ret = 0;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- tavil_ocp_control(codec, false);
+ tavil_ocp_control(component, false);
if (TAVIL_IS_1_0(tavil->wcd9xxx))
- snd_soc_update_bits(codec, WCD934X_HPH_REFBUFF_LP_CTL,
- 0x06, (0x03 << 1));
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_REFBUFF_LP_CTL,
+ 0x06, (0x03 << 1));
if ((!(strcmp(w->name, "ANC HPHL PA"))) &&
(test_bit(HPH_PA_DELAY, &tavil->status_mask)))
- snd_soc_update_bits(codec, WCD934X_ANA_HPH,
- 0xC0, 0xC0);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_HPH,
+ 0xC0, 0xC0);
set_bit(HPH_PA_DELAY, &tavil->status_mask);
if (dsd_conf &&
- (snd_soc_read(codec, WCD934X_CDC_DSD0_PATH_CTL) & 0x01)) {
+ (snd_soc_component_read32(component,
+ WCD934X_CDC_DSD0_PATH_CTL) & 0x01)) {
/* Set regulator mode to AB if DSD is enabled */
- snd_soc_update_bits(codec, WCD934X_ANA_RX_SUPPLIES,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_RX_SUPPLIES,
+ 0x02, 0x02);
}
break;
case SND_SOC_DAPM_POST_PMU:
if (!(strcmp(w->name, "ANC HPHL PA"))) {
- if ((snd_soc_read(codec, WCD934X_ANA_HPH) & 0xC0)
- != 0xC0)
+ if ((snd_soc_component_read32(
+ component, WCD934X_ANA_HPH) & 0xC0) != 0xC0)
/*
* If PA_EN is not set (potentially in ANC
* case) then do nothing for POST_PMU and
@@ -2417,80 +2488,95 @@
}
if (tavil->anc_func) {
/* Clear Tx FE HOLD if both PAs are enabled */
- if ((snd_soc_read(tavil->codec, WCD934X_ANA_HPH) &
- 0xC0) == 0xC0)
+ if ((snd_soc_component_read32(
+ tavil->component, WCD934X_ANA_HPH) & 0xC0) ==
+ 0xC0)
tavil_codec_clear_anc_tx_hold(tavil);
}
- snd_soc_update_bits(codec, WCD934X_HPH_L_TEST, 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD934X_HPH_L_TEST,
+ 0x01, 0x01);
/* Remove Mute on primary path */
- snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX1_RX_PATH_CTL,
+ 0x10, 0x00);
/* Enable GM3 boost */
- snd_soc_update_bits(codec, WCD934X_HPH_CNP_WG_CTL,
- 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_CNP_WG_CTL,
+ 0x80, 0x80);
/* Enable AutoChop timer at the end of power up */
- snd_soc_update_bits(codec, WCD934X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x02);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, WCD934X_CDC_RX1_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(component,
+ WCD934X_CDC_RX1_RX_PATH_MIX_CTL)) & 0x10)
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX1_RX_PATH_MIX_CTL,
0x10, 0x00);
if (dsd_conf &&
- (snd_soc_read(codec, WCD934X_CDC_DSD0_PATH_CTL) & 0x01))
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_CFG2,
- 0x04, 0x00);
+ (snd_soc_component_read32(
+ component, WCD934X_CDC_DSD0_PATH_CTL) & 0x01))
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_CFG2,
+ 0x04, 0x00);
if (!(strcmp(w->name, "ANC HPHL PA"))) {
pr_debug("%s:Do everything needed for right channel\n",
__func__);
/* Do everything needed for right channel */
- snd_soc_update_bits(codec, WCD934X_HPH_R_TEST,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_R_TEST,
+ 0x01, 0x01);
/* Remove mute */
- snd_soc_update_bits(codec, WCD934X_CDC_RX2_RX_PATH_CTL,
- 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX2_RX_PATH_CTL,
+ 0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec,
+ if ((snd_soc_component_read32(component,
WCD934X_CDC_RX2_RX_PATH_MIX_CTL)) &
0x10)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX2_RX_PATH_MIX_CTL,
0x10, 0x00);
- if (dsd_conf && (snd_soc_read(codec,
+ if (dsd_conf && (snd_soc_component_read32(component,
WCD934X_CDC_DSD1_PATH_CTL) & 0x01))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_DSD1_CFG2,
0x04, 0x00);
/* Remove ANC Rx from reset */
ret = tavil_codec_enable_anc(w, kcontrol, event);
}
- tavil_codec_override(codec, tavil->hph_mode, event);
- tavil_ocp_control(codec, true);
+ tavil_codec_override(component, tavil->hph_mode, event);
+ tavil_ocp_control(component, true);
break;
case SND_SOC_DAPM_PRE_PMD:
- tavil_ocp_control(codec, false);
+ tavil_ocp_control(component, false);
blocking_notifier_call_chain(&tavil->mbhc->notifier,
WCD_EVENT_PRE_HPHL_PA_OFF,
&tavil->mbhc->wcd_mbhc);
/* Enable DSD Mute before PA disable */
if (dsd_conf &&
- (snd_soc_read(codec, WCD934X_CDC_DSD0_PATH_CTL) & 0x01))
- snd_soc_update_bits(codec, WCD934X_CDC_DSD0_CFG2,
+ (snd_soc_component_read32(component,
+ WCD934X_CDC_DSD0_PATH_CTL) & 0x01))
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_DSD0_CFG2,
0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_HPH_L_TEST, 0x01, 0x00);
- snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_CTL,
- 0x10, 0x10);
- snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_MIX_CTL,
- 0x10, 0x10);
+ snd_soc_component_update_bits(component, WCD934X_HPH_L_TEST,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX1_RX_PATH_CTL,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX1_RX_PATH_MIX_CTL,
+ 0x10, 0x10);
if (!(strcmp(w->name, "ANC HPHL PA")))
- snd_soc_update_bits(codec, WCD934X_ANA_HPH,
- 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_ANA_HPH,
+ 0x80, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
/*
@@ -2501,19 +2587,20 @@
usleep_range(20000, 20100);
else
usleep_range(5000, 5100);
- tavil_codec_override(codec, tavil->hph_mode, event);
+ tavil_codec_override(component, tavil->hph_mode, event);
blocking_notifier_call_chain(&tavil->mbhc->notifier,
WCD_EVENT_POST_HPHL_PA_OFF,
&tavil->mbhc->wcd_mbhc);
if (TAVIL_IS_1_0(tavil->wcd9xxx))
- snd_soc_update_bits(codec, WCD934X_HPH_REFBUFF_LP_CTL,
- 0x06, 0x0);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_REFBUFF_LP_CTL,
+ 0x06, 0x0);
if (!(strcmp(w->name, "ANC HPHL PA"))) {
ret = tavil_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX1_RX_PATH_CFG0, 0x10, 0x00);
}
- tavil_ocp_control(codec, true);
+ tavil_ocp_control(component, true);
break;
};
@@ -2524,13 +2611,14 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 lineout_vol_reg = 0, lineout_mix_vol_reg = 0;
u16 dsd_mute_reg = 0, dsd_clk_reg = 0;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
struct tavil_dsd_config *dsd_conf = tavil->dsd_config;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
if (w->reg == WCD934X_ANA_LO_1_2) {
if (w->shift == 7) {
@@ -2545,14 +2633,14 @@
dsd_clk_reg = WCD934X_CDC_DSD1_PATH_CTL;
}
} else {
- dev_err(codec->dev, "%s: Error enabling lineout PA\n",
+ dev_err(component->dev, "%s: Error enabling lineout PA\n",
__func__);
return -EINVAL;
}
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- tavil_codec_override(codec, CLS_AB, event);
+ tavil_codec_override(component, CLS_AB, event);
break;
case SND_SOC_DAPM_POST_PMU:
/*
@@ -2560,19 +2648,24 @@
* HW requirement
*/
usleep_range(5000, 5500);
- snd_soc_update_bits(codec, lineout_vol_reg,
+ snd_soc_component_update_bits(component, lineout_vol_reg,
0x10, 0x00);
/* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, lineout_mix_vol_reg)) & 0x10)
- snd_soc_update_bits(codec,
+ if ((snd_soc_component_read32(
+ component, lineout_mix_vol_reg)) & 0x10)
+ snd_soc_component_update_bits(component,
lineout_mix_vol_reg,
0x10, 0x00);
- if (dsd_conf && (snd_soc_read(codec, dsd_clk_reg) & 0x01))
- snd_soc_update_bits(codec, dsd_mute_reg, 0x04, 0x00);
+ if (dsd_conf && (snd_soc_component_read32(
+ component, dsd_clk_reg) & 0x01))
+ snd_soc_component_update_bits(component, dsd_mute_reg,
+ 0x04, 0x00);
break;
case SND_SOC_DAPM_PRE_PMD:
- if (dsd_conf && (snd_soc_read(codec, dsd_clk_reg) & 0x01))
- snd_soc_update_bits(codec, dsd_mute_reg, 0x04, 0x04);
+ if (dsd_conf && (snd_soc_component_read32(
+ component, dsd_clk_reg) & 0x01))
+ snd_soc_component_update_bits(component, dsd_mute_reg,
+ 0x04, 0x04);
break;
case SND_SOC_DAPM_POST_PMD:
/*
@@ -2580,7 +2673,7 @@
* HW requirement
*/
usleep_range(5000, 5500);
- tavil_codec_override(codec, CLS_AB, event);
+ tavil_codec_override(component, CLS_AB, event);
default:
break;
};
@@ -2593,8 +2686,9 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
ucontrol->value.enumerated.item[0] =
tavil_p->rx_port_value[widget->shift];
@@ -2606,8 +2700,9 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
struct snd_soc_dapm_update *update = NULL;
unsigned int rx_port_value;
@@ -2616,7 +2711,7 @@
tavil_p->rx_port_value[port_id] = ucontrol->value.enumerated.item[0];
rx_port_value = tavil_p->rx_port_value[port_id];
- dev_dbg(codec->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
+ dev_dbg(component->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
__func__, widget->name, ucontrol->id.name,
rx_port_value, widget->shift,
ucontrol->value.integer.value[0]);
@@ -2632,8 +2727,9 @@
{
int ret = 0;
u32 i2s_reg;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
switch (tavil_p->rx_port_value[w->shift]) {
case AIF1_PB:
@@ -2649,16 +2745,18 @@
i2s_reg = WCD934X_DATA_HUB_I2S_2_CTL;
break;
default:
- dev_err(codec->dev, "%s Invalid i2s Id received", __func__);
+ dev_err(component->dev, "%s Invalid i2s Id received", __func__);
return -EINVAL;
}
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- ret = snd_soc_update_bits(codec, i2s_reg, 0x01, 0x01);
+ ret = snd_soc_component_update_bits(component, i2s_reg,
+ 0x01, 0x01);
break;
case SND_SOC_DAPM_POST_PMD:
- ret = snd_soc_update_bits(codec, i2s_reg, 0x01, 0x00);
+ ret = snd_soc_component_update_bits(component, i2s_reg,
+ 0x01, 0x00);
break;
}
@@ -2670,30 +2768,33 @@
int event)
{
int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Disable AutoChop timer during power up */
- snd_soc_update_bits(codec, WCD934X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x00);
if (tavil->anc_func)
ret = tavil_codec_enable_anc(w, kcontrol, event);
- wcd_clsh_fsm(codec, &tavil->clsh_d,
+ wcd_clsh_fsm(component, &tavil->clsh_d,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_EAR,
CLS_H_NORMAL);
if (tavil->anc_func)
- snd_soc_update_bits(codec, WCD934X_CDC_RX0_RX_PATH_CFG0,
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX0_RX_PATH_CFG0,
0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd_clsh_fsm(codec, &tavil->clsh_d,
+ wcd_clsh_fsm(component, &tavil->clsh_d,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_EAR,
CLS_H_NORMAL);
@@ -2709,15 +2810,16 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int hph_mode = tavil->hph_mode;
u8 dem_inp;
struct tavil_dsd_config *dsd_conf = tavil->dsd_config;
int ret = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d hph_mode: %d\n", __func__,
- w->name, event, hph_mode);
+ dev_dbg(component->dev, "%s wname: %s event: %d hph_mode: %d\n",
+ __func__, w->name, event, hph_mode);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
@@ -2727,55 +2829,57 @@
msleep(40);
}
/* Read DEM INP Select */
- dem_inp = snd_soc_read(codec, WCD934X_CDC_RX2_RX_PATH_SEC0) &
- 0x03;
+ dem_inp = snd_soc_component_read32(component,
+ WCD934X_CDC_RX2_RX_PATH_SEC0) & 0x03;
if (((hph_mode == CLS_H_HIFI) || (hph_mode == CLS_H_LOHIFI) ||
(hph_mode == CLS_H_LP)) && (dem_inp != 0x01)) {
- dev_err(codec->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
+ dev_err(component->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
__func__, hph_mode);
return -EINVAL;
}
if ((hph_mode != CLS_H_LP) && (hph_mode != CLS_H_ULP))
/* Ripple freq control enable */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_SIDO_NEW_VOUT_D_FREQ2,
0x01, 0x01);
/* Disable AutoChop timer during power up */
- snd_soc_update_bits(codec, WCD934X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x00);
/* Set RDAC gain */
if (TAVIL_IS_1_0(tavil->wcd9xxx))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL,
0xF0, 0x40);
if (dsd_conf &&
- (snd_soc_read(codec, WCD934X_CDC_DSD1_PATH_CTL) & 0x01))
+ (snd_soc_component_read32(component,
+ WCD934X_CDC_DSD1_PATH_CTL) & 0x01))
hph_mode = CLS_H_HIFI;
- wcd_clsh_fsm(codec, &tavil->clsh_d,
+ wcd_clsh_fsm(component, &tavil->clsh_d,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_HPHR,
hph_mode);
if (tavil->anc_func)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX2_RX_PATH_CFG0,
0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMD:
/* 1000us required as per HW requirement */
usleep_range(1000, 1100);
- wcd_clsh_fsm(codec, &tavil->clsh_d,
+ wcd_clsh_fsm(component, &tavil->clsh_d,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_HPHR,
hph_mode);
if ((hph_mode != CLS_H_LP) && (hph_mode != CLS_H_ULP))
/* Ripple freq control disable */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_SIDO_NEW_VOUT_D_FREQ2,
0x01, 0x0);
/* Re-set RDAC gain */
if (TAVIL_IS_1_0(tavil->wcd9xxx))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL,
0xF0, 0x0);
break;
@@ -2790,16 +2894,17 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int hph_mode = tavil->hph_mode;
u8 dem_inp;
int ret = 0;
struct tavil_dsd_config *dsd_conf = tavil->dsd_config;
uint32_t impedl = 0, impedr = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d hph_mode: %d\n", __func__,
- w->name, event, hph_mode);
+ dev_dbg(component->dev, "%s wname: %s event: %d hph_mode: %d\n",
+ __func__, w->name, event, hph_mode);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
@@ -2809,48 +2914,50 @@
msleep(40);
}
/* Read DEM INP Select */
- dem_inp = snd_soc_read(codec, WCD934X_CDC_RX1_RX_PATH_SEC0) &
- 0x03;
+ dem_inp = snd_soc_component_read32(component,
+ WCD934X_CDC_RX1_RX_PATH_SEC0) & 0x03;
if (((hph_mode == CLS_H_HIFI) || (hph_mode == CLS_H_LOHIFI) ||
(hph_mode == CLS_H_LP)) && (dem_inp != 0x01)) {
- dev_err(codec->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
+ dev_err(component->dev, "%s: DEM Input not set correctly, hph_mode: %d\n",
__func__, hph_mode);
return -EINVAL;
}
if ((hph_mode != CLS_H_LP) && (hph_mode != CLS_H_ULP))
/* Ripple freq control enable */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_SIDO_NEW_VOUT_D_FREQ2,
0x01, 0x01);
/* Disable AutoChop timer during power up */
- snd_soc_update_bits(codec, WCD934X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x00);
/* Set RDAC gain */
if (TAVIL_IS_1_0(tavil->wcd9xxx))
- snd_soc_update_bits(codec,
- WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL,
- 0xF0, 0x40);
+ snd_soc_component_update_bits(component,
+ WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL,
+ 0xF0, 0x40);
if (dsd_conf &&
- (snd_soc_read(codec, WCD934X_CDC_DSD0_PATH_CTL) & 0x01))
+ (snd_soc_component_read32(component,
+ WCD934X_CDC_DSD0_PATH_CTL) & 0x01))
hph_mode = CLS_H_HIFI;
- wcd_clsh_fsm(codec, &tavil->clsh_d,
+ wcd_clsh_fsm(component, &tavil->clsh_d,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_HPHL,
hph_mode);
if (tavil->anc_func)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_RX1_RX_PATH_CFG0,
0x10, 0x10);
ret = tavil_mbhc_get_impedance(tavil->mbhc,
&impedl, &impedr);
if (!ret) {
- wcd_clsh_imped_config(codec, impedl, false);
+ wcd_clsh_imped_config(component, impedl, false);
set_bit(CLSH_Z_CONFIG, &tavil->status_mask);
} else {
- dev_dbg(codec->dev, "%s: Failed to get mbhc impedance %d\n",
+ dev_dbg(component->dev, "%s: Failed to get mbhc impedance %d\n",
__func__, ret);
ret = 0;
}
@@ -2859,23 +2966,23 @@
case SND_SOC_DAPM_POST_PMD:
/* 1000us required as per HW requirement */
usleep_range(1000, 1100);
- wcd_clsh_fsm(codec, &tavil->clsh_d,
+ wcd_clsh_fsm(component, &tavil->clsh_d,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_HPHL,
hph_mode);
if ((hph_mode != CLS_H_LP) && (hph_mode != CLS_H_ULP))
/* Ripple freq control disable */
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_SIDO_NEW_VOUT_D_FREQ2,
0x01, 0x0);
/* Re-set RDAC gain */
if (TAVIL_IS_1_0(tavil->wcd9xxx))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL,
0xF0, 0x0);
if (test_bit(CLSH_Z_CONFIG, &tavil->status_mask)) {
- wcd_clsh_imped_config(codec, impedl, true);
+ wcd_clsh_imped_config(component, impedl, true);
clear_bit(CLSH_Z_CONFIG, &tavil->status_mask);
}
break;
@@ -2890,20 +2997,21 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd_clsh_fsm(codec, &tavil->clsh_d,
+ wcd_clsh_fsm(component, &tavil->clsh_d,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_LO,
CLS_AB);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd_clsh_fsm(codec, &tavil->clsh_d,
+ wcd_clsh_fsm(component, &tavil->clsh_d,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_LO,
CLS_AB);
@@ -2917,11 +3025,12 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 boost_path_ctl, boost_path_cfg1;
u16 reg, reg_mix;
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
if (!strcmp(w->name, "RX INT7 CHAIN")) {
boost_path_ctl = WCD934X_CDC_BOOST0_BOOST_PATH_CTL;
@@ -2934,22 +3043,27 @@
reg = WCD934X_CDC_RX8_RX_PATH_CTL;
reg_mix = WCD934X_CDC_RX8_RX_PATH_MIX_CTL;
} else {
- dev_err(codec->dev, "%s: unknown widget: %s\n",
+ dev_err(component->dev, "%s: unknown widget: %s\n",
__func__, w->name);
return -EINVAL;
}
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x01);
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x10);
- snd_soc_update_bits(codec, reg, 0x10, 0x00);
- if ((snd_soc_read(codec, reg_mix)) & 0x10)
- snd_soc_update_bits(codec, reg_mix, 0x10, 0x00);
+ snd_soc_component_update_bits(component, boost_path_cfg1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, boost_path_ctl,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component, reg, 0x10, 0x00);
+ if ((snd_soc_component_read32(component, reg_mix)) & 0x10)
+ snd_soc_component_update_bits(component, reg_mix,
+ 0x10, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x00);
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x00);
+ snd_soc_component_update_bits(component, boost_path_ctl,
+ 0x10, 0x00);
+ snd_soc_component_update_bits(component, boost_path_cfg1,
+ 0x01, 0x00);
break;
};
@@ -2958,11 +3072,12 @@
static int __tavil_codec_enable_swr(struct snd_soc_dapm_widget *w, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
struct tavil_priv *tavil;
int ch_cnt = 0;
- tavil = snd_soc_codec_get_drvdata(codec);
+ tavil = snd_soc_component_get_drvdata(component);
if (!tavil->swr.ctrl_data)
return -EINVAL;
@@ -3018,7 +3133,7 @@
return __tavil_codec_enable_swr(w, event);
}
-static int tavil_codec_config_mad(struct snd_soc_codec *codec)
+static int tavil_codec_config_mad(struct snd_soc_component *component)
{
int ret = 0;
int idx;
@@ -3027,31 +3142,31 @@
struct wcd_mad_audio_cal *mad_cal = NULL;
const void *data;
const char *filename = WCD934X_MAD_AUDIO_FIRMWARE_PATH;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
size_t cal_size;
hwdep_cal = wcdcal_get_fw_cal(tavil->fw_data, WCD9XXX_MAD_CAL);
if (hwdep_cal) {
data = hwdep_cal->data;
cal_size = hwdep_cal->size;
- dev_dbg(codec->dev, "%s: using hwdep calibration\n",
+ dev_dbg(component->dev, "%s: using hwdep calibration\n",
__func__);
} else {
- ret = request_firmware(&fw, filename, codec->dev);
+ ret = request_firmware(&fw, filename, component->dev);
if (ret || !fw) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: MAD firmware acquire failed, err = %d\n",
__func__, ret);
return -ENODEV;
}
data = fw->data;
cal_size = fw->size;
- dev_dbg(codec->dev, "%s: using request_firmware calibration\n",
+ dev_dbg(component->dev, "%s: using request_firmware calibration\n",
__func__);
}
if (cal_size < sizeof(*mad_cal)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Incorrect size %zd for MAD Cal, expected %zd\n",
__func__, cal_size, sizeof(*mad_cal));
ret = -ENOMEM;
@@ -3060,80 +3175,87 @@
mad_cal = (struct wcd_mad_audio_cal *) (data);
if (!mad_cal) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid calibration data\n",
__func__);
ret = -EINVAL;
goto done;
}
- snd_soc_write(codec, WCD934X_SOC_MAD_MAIN_CTL_2,
+ snd_soc_component_write(component, WCD934X_SOC_MAD_MAIN_CTL_2,
mad_cal->microphone_info.cycle_time);
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_MAIN_CTL_1, 0xFF << 3,
- ((uint16_t)mad_cal->microphone_info.settle_time)
- << 3);
+ snd_soc_component_update_bits(component, WCD934X_SOC_MAD_MAIN_CTL_1,
+ 0xFF << 3,
+ ((uint16_t)mad_cal->microphone_info.settle_time) << 3);
/* Audio */
- snd_soc_write(codec, WCD934X_SOC_MAD_AUDIO_CTL_8,
+ snd_soc_component_write(component, WCD934X_SOC_MAD_AUDIO_CTL_8,
mad_cal->audio_info.rms_omit_samples);
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_AUDIO_CTL_1,
+ snd_soc_component_update_bits(component, WCD934X_SOC_MAD_AUDIO_CTL_1,
0x07 << 4, mad_cal->audio_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_AUDIO_CTL_2, 0x03 << 2,
- mad_cal->audio_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD934X_SOC_MAD_AUDIO_CTL_7,
- mad_cal->audio_info.rms_diff_threshold & 0x3F);
- snd_soc_write(codec, WCD934X_SOC_MAD_AUDIO_CTL_5,
- mad_cal->audio_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD934X_SOC_MAD_AUDIO_CTL_6,
- mad_cal->audio_info.rms_threshold_msb);
+ snd_soc_component_update_bits(component, WCD934X_SOC_MAD_AUDIO_CTL_2,
+ 0x03 << 2,
+ mad_cal->audio_info.detection_mechanism << 2);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_AUDIO_CTL_7,
+ mad_cal->audio_info.rms_diff_threshold & 0x3F);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_AUDIO_CTL_5,
+ mad_cal->audio_info.rms_threshold_lsb);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_AUDIO_CTL_6,
+ mad_cal->audio_info.rms_threshold_msb);
for (idx = 0; idx < ARRAY_SIZE(mad_cal->audio_info.iir_coefficients);
idx++) {
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_AUDIO_IIR_CTL_PTR,
+ snd_soc_component_update_bits(component,
+ WCD934X_SOC_MAD_AUDIO_IIR_CTL_PTR,
0x3F, idx);
- snd_soc_write(codec, WCD934X_SOC_MAD_AUDIO_IIR_CTL_VAL,
- mad_cal->audio_info.iir_coefficients[idx]);
- dev_dbg(codec->dev, "%s:MAD Audio IIR Coef[%d] = 0X%x",
+ snd_soc_component_write(component,
+ WCD934X_SOC_MAD_AUDIO_IIR_CTL_VAL,
+ mad_cal->audio_info.iir_coefficients[idx]);
+ dev_dbg(component->dev, "%s:MAD Audio IIR Coef[%d] = 0X%x",
__func__, idx,
mad_cal->audio_info.iir_coefficients[idx]);
}
/* Beacon */
- snd_soc_write(codec, WCD934X_SOC_MAD_BEACON_CTL_8,
- mad_cal->beacon_info.rms_omit_samples);
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_BEACON_CTL_1,
- 0x07 << 4, mad_cal->beacon_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_BEACON_CTL_2, 0x03 << 2,
- mad_cal->beacon_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD934X_SOC_MAD_BEACON_CTL_7,
- mad_cal->beacon_info.rms_diff_threshold & 0x1F);
- snd_soc_write(codec, WCD934X_SOC_MAD_BEACON_CTL_5,
- mad_cal->beacon_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD934X_SOC_MAD_BEACON_CTL_6,
- mad_cal->beacon_info.rms_threshold_msb);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_BEACON_CTL_8,
+ mad_cal->beacon_info.rms_omit_samples);
+ snd_soc_component_update_bits(component, WCD934X_SOC_MAD_BEACON_CTL_1,
+ 0x07 << 4, mad_cal->beacon_info.rms_comp_time << 4);
+ snd_soc_component_update_bits(component, WCD934X_SOC_MAD_BEACON_CTL_2,
+ 0x03 << 2,
+ mad_cal->beacon_info.detection_mechanism << 2);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_BEACON_CTL_7,
+ mad_cal->beacon_info.rms_diff_threshold & 0x1F);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_BEACON_CTL_5,
+ mad_cal->beacon_info.rms_threshold_lsb);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_BEACON_CTL_6,
+ mad_cal->beacon_info.rms_threshold_msb);
for (idx = 0; idx < ARRAY_SIZE(mad_cal->beacon_info.iir_coefficients);
idx++) {
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_BEACON_IIR_CTL_PTR,
- 0x3F, idx);
- snd_soc_write(codec, WCD934X_SOC_MAD_BEACON_IIR_CTL_VAL,
- mad_cal->beacon_info.iir_coefficients[idx]);
- dev_dbg(codec->dev, "%s:MAD Beacon IIR Coef[%d] = 0X%x",
+ snd_soc_component_update_bits(component,
+ WCD934X_SOC_MAD_BEACON_IIR_CTL_PTR,
+ 0x3F, idx);
+ snd_soc_component_write(component,
+ WCD934X_SOC_MAD_BEACON_IIR_CTL_VAL,
+ mad_cal->beacon_info.iir_coefficients[idx]);
+ dev_dbg(component->dev, "%s:MAD Beacon IIR Coef[%d] = 0X%x",
__func__, idx,
mad_cal->beacon_info.iir_coefficients[idx]);
}
/* Ultrasound */
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_ULTR_CTL_1,
- 0x07 << 4,
- mad_cal->ultrasound_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_ULTR_CTL_2, 0x03 << 2,
- mad_cal->ultrasound_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD934X_SOC_MAD_ULTR_CTL_7,
- mad_cal->ultrasound_info.rms_diff_threshold & 0x1F);
- snd_soc_write(codec, WCD934X_SOC_MAD_ULTR_CTL_5,
+ snd_soc_component_update_bits(component, WCD934X_SOC_MAD_ULTR_CTL_1,
+ 0x07 << 4,
+ mad_cal->ultrasound_info.rms_comp_time << 4);
+ snd_soc_component_update_bits(component, WCD934X_SOC_MAD_ULTR_CTL_2,
+ 0x03 << 2,
+ mad_cal->ultrasound_info.detection_mechanism << 2);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_ULTR_CTL_7,
+ mad_cal->ultrasound_info.rms_diff_threshold & 0x1F);
+ snd_soc_component_write(component, WCD934X_SOC_MAD_ULTR_CTL_5,
mad_cal->ultrasound_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD934X_SOC_MAD_ULTR_CTL_6,
+ snd_soc_component_write(component, WCD934X_SOC_MAD_ULTR_CTL_6,
mad_cal->ultrasound_info.rms_threshold_msb);
done:
@@ -3143,46 +3265,54 @@
return ret;
}
-static int __tavil_codec_enable_mad(struct snd_soc_codec *codec, bool enable)
+static int __tavil_codec_enable_mad(struct snd_soc_component *component,
+ bool enable)
{
int rc = 0;
/* Return if CPE INPUT is DEC1 */
- if (snd_soc_read(codec, WCD934X_CPE_SS_SVA_CFG) & 0x04) {
- dev_dbg(codec->dev, "%s: MAD is bypassed, skip mad %s\n",
+ if (snd_soc_component_read32(
+ component, WCD934X_CPE_SS_SVA_CFG) & 0x04) {
+ dev_dbg(component->dev, "%s: MAD is bypassed, skip mad %s\n",
__func__, enable ? "enable" : "disable");
return rc;
}
- dev_dbg(codec->dev, "%s: enable = %s\n", __func__,
+ dev_dbg(component->dev, "%s: enable = %s\n", __func__,
enable ? "enable" : "disable");
if (enable) {
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_AUDIO_CTL_2,
- 0x03, 0x03);
- rc = tavil_codec_config_mad(codec);
+ snd_soc_component_update_bits(component,
+ WCD934X_SOC_MAD_AUDIO_CTL_2,
+ 0x03, 0x03);
+ rc = tavil_codec_config_mad(component);
if (rc < 0) {
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_AUDIO_CTL_2,
- 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_SOC_MAD_AUDIO_CTL_2,
+ 0x03, 0x00);
goto done;
}
/* Turn on MAD clk */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_MAD_CTL,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_MAD_CTL,
+ 0x01, 0x01);
/* Undo reset for MAD */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_MAD_CTL,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_MAD_CTL,
+ 0x02, 0x00);
} else {
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_AUDIO_CTL_2,
- 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_SOC_MAD_AUDIO_CTL_2,
+ 0x03, 0x00);
/* Reset the MAD block */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_MAD_CTL,
- 0x02, 0x02);
- /* Turn off MAD clk */
- snd_soc_update_bits(codec, WCD934X_CPE_SS_MAD_CTL,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_MAD_CTL,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_MAD_CTL,
+ 0x01, 0x00);
}
done:
return rc;
@@ -3192,18 +3322,21 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int rc = 0;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, WCD934X_CPE_SS_SVA_CFG, 0x40, 0x40);
- rc = __tavil_codec_enable_mad(codec, true);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_SVA_CFG, 0x40, 0x40);
+ rc = __tavil_codec_enable_mad(component, true);
break;
case SND_SOC_DAPM_PRE_PMD:
- snd_soc_update_bits(codec, WCD934X_CPE_SS_SVA_CFG, 0x40, 0x00);
- __tavil_codec_enable_mad(codec, false);
+ snd_soc_component_update_bits(component,
+ WCD934X_CPE_SS_SVA_CFG, 0x40, 0x00);
+ __tavil_codec_enable_mad(component, false);
break;
}
@@ -3214,8 +3347,9 @@
static int tavil_codec_cpe_mad_ctl(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int rc = 0;
switch (event) {
@@ -3224,8 +3358,9 @@
if (tavil->mad_switch_cnt != 1)
goto done;
- snd_soc_update_bits(codec, WCD934X_CPE_SS_SVA_CFG, 0x20, 0x20);
- rc = __tavil_codec_enable_mad(codec, true);
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_SVA_CFG,
+ 0x20, 0x20);
+ rc = __tavil_codec_enable_mad(component, true);
if (rc < 0) {
tavil->mad_switch_cnt--;
goto done;
@@ -3237,8 +3372,9 @@
if (tavil->mad_switch_cnt != 0)
goto done;
- snd_soc_update_bits(codec, WCD934X_CPE_SS_SVA_CFG, 0x20, 0x00);
- __tavil_codec_enable_mad(codec, false);
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_SVA_CFG,
+ 0x20, 0x00);
+ __tavil_codec_enable_mad(component, false);
break;
}
done:
@@ -3289,24 +3425,25 @@
static int tavil_codec_wdma3_ctl(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
/* Fix to 16KHz */
- snd_soc_update_bits(codec, WCD934X_DMA_WDMA_CTL_3,
+ snd_soc_component_update_bits(component, WCD934X_DMA_WDMA_CTL_3,
0xF0, 0x10);
/* Select mclk_1 */
- snd_soc_update_bits(codec, WCD934X_DMA_WDMA_CTL_3,
+ snd_soc_component_update_bits(component, WCD934X_DMA_WDMA_CTL_3,
0x02, 0x00);
/* Enable DMA */
- snd_soc_update_bits(codec, WCD934X_DMA_WDMA_CTL_3,
+ snd_soc_component_update_bits(component, WCD934X_DMA_WDMA_CTL_3,
0x01, 0x01);
break;
case SND_SOC_DAPM_POST_PMD:
/* Disable DMA */
- snd_soc_update_bits(codec, WCD934X_DMA_WDMA_CTL_3,
+ snd_soc_component_update_bits(component, WCD934X_DMA_WDMA_CTL_3,
0x01, 0x00);
break;
@@ -3315,10 +3452,10 @@
return 0;
}
-static int tavil_codec_enable_asrc(struct snd_soc_codec *codec,
+static int tavil_codec_enable_asrc(struct snd_soc_component *component,
int asrc_in, int event)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
u16 cfg_reg, ctl_reg, clk_reg, asrc_ctl, mix_ctl_reg, paired_reg;
int asrc, ret = 0;
u8 main_sr, mix_sr, asrc_mode = 0;
@@ -3373,8 +3510,8 @@
asrc = ASRC3;
break;
default:
- dev_err(codec->dev, "%s: Invalid asrc input :%d\n", __func__,
- asrc_in);
+ dev_err(component->dev, "%s: Invalid asrc input :%d\n",
+ __func__, asrc_in);
ret = -EINVAL;
goto done;
};
@@ -3382,23 +3519,30 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (tavil->asrc_users[asrc] == 0) {
- if ((snd_soc_read(codec, clk_reg) & 0x02) ||
- (snd_soc_read(codec, paired_reg) & 0x02)) {
- snd_soc_update_bits(codec, clk_reg,
- 0x02, 0x00);
- snd_soc_update_bits(codec, paired_reg,
- 0x02, 0x00);
+ if ((snd_soc_component_read32(
+ component, clk_reg) & 0x02) ||
+ (snd_soc_component_read32(
+ component, paired_reg) & 0x02)) {
+ snd_soc_component_update_bits(
+ component, clk_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(
+ component, paired_reg, 0x02, 0x00);
}
- snd_soc_update_bits(codec, cfg_reg, 0x80, 0x80);
- snd_soc_update_bits(codec, clk_reg, 0x01, 0x01);
- main_sr = snd_soc_read(codec, ctl_reg) & 0x0F;
+ snd_soc_component_update_bits(
+ component, cfg_reg, 0x80, 0x80);
+ snd_soc_component_update_bits(
+ component, clk_reg, 0x01, 0x01);
+ main_sr = snd_soc_component_read32(
+ component, ctl_reg) & 0x0F;
mix_ctl_reg = ctl_reg + 5;
- mix_sr = snd_soc_read(codec, mix_ctl_reg) & 0x0F;
+ mix_sr = snd_soc_component_read32(
+ component, mix_ctl_reg) & 0x0F;
asrc_mode = tavil_get_asrc_mode(tavil, asrc,
main_sr, mix_sr);
- dev_dbg(codec->dev, "%s: main_sr:%d mix_sr:%d asrc_mode %d\n",
+ dev_dbg(component->dev, "%s: main_sr:%d mix_sr:%d asrc_mode %d\n",
__func__, main_sr, mix_sr, asrc_mode);
- snd_soc_update_bits(codec, asrc_ctl, 0x07, asrc_mode);
+ snd_soc_component_update_bits(component, asrc_ctl,
+ 0x07, asrc_mode);
}
tavil->asrc_users[asrc]++;
break;
@@ -3406,14 +3550,17 @@
tavil->asrc_users[asrc]--;
if (tavil->asrc_users[asrc] <= 0) {
tavil->asrc_users[asrc] = 0;
- snd_soc_update_bits(codec, asrc_ctl, 0x07, 0x00);
- snd_soc_update_bits(codec, cfg_reg, 0x80, 0x00);
- snd_soc_update_bits(codec, clk_reg, 0x03, 0x02);
+ snd_soc_component_update_bits(component, asrc_ctl,
+ 0x07, 0x00);
+ snd_soc_component_update_bits(component, cfg_reg,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component, clk_reg,
+ 0x03, 0x02);
}
break;
};
- dev_dbg(codec->dev, "%s: ASRC%d, users: %d\n",
+ dev_dbg(component->dev, "%s: ASRC%d, users: %d\n",
__func__, asrc, tavil->asrc_users[asrc]);
done:
@@ -3424,13 +3571,15 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int ret = 0;
u8 cfg, asrc_in;
- cfg = snd_soc_read(codec, WCD934X_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0);
+ cfg = snd_soc_component_read32(component,
+ WCD934X_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0);
if (!(cfg & 0xFF)) {
- dev_err(codec->dev, "%s: ASRC%u input not selected\n",
+ dev_err(component->dev, "%s: ASRC%u input not selected\n",
__func__, w->shift);
return -EINVAL;
}
@@ -3438,22 +3587,22 @@
switch (w->shift) {
case ASRC0:
asrc_in = ((cfg & 0x03) == 1) ? ASRC_IN_HPHL : ASRC_IN_LO1;
- ret = tavil_codec_enable_asrc(codec, asrc_in, event);
+ ret = tavil_codec_enable_asrc(component, asrc_in, event);
break;
case ASRC1:
asrc_in = ((cfg & 0x0C) == 4) ? ASRC_IN_HPHR : ASRC_IN_LO2;
- ret = tavil_codec_enable_asrc(codec, asrc_in, event);
+ ret = tavil_codec_enable_asrc(component, asrc_in, event);
break;
case ASRC2:
asrc_in = ((cfg & 0x30) == 0x20) ? ASRC_IN_SPKR1 : ASRC_INVALID;
- ret = tavil_codec_enable_asrc(codec, asrc_in, event);
+ ret = tavil_codec_enable_asrc(component, asrc_in, event);
break;
case ASRC3:
asrc_in = ((cfg & 0xC0) == 0x80) ? ASRC_IN_SPKR2 : ASRC_INVALID;
- ret = tavil_codec_enable_asrc(codec, asrc_in, event);
+ ret = tavil_codec_enable_asrc(component, asrc_in, event);
break;
default:
- dev_err(codec->dev, "%s: Invalid asrc:%u\n", __func__,
+ dev_err(component->dev, "%s: Invalid asrc:%u\n", __func__,
w->shift);
ret = -EINVAL;
break;
@@ -3465,26 +3614,31 @@
static int tavil_enable_native_supply(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (++tavil->native_clk_users == 1) {
- snd_soc_update_bits(codec, WCD934X_CLK_SYS_PLL_ENABLES,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CLK_SYS_PLL_ENABLES,
+ 0x01, 0x01);
usleep_range(100, 120);
- snd_soc_update_bits(codec, WCD934X_CLK_SYS_MCLK2_PRG1,
- 0x06, 0x02);
- snd_soc_update_bits(codec, WCD934X_CLK_SYS_MCLK2_PRG1,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD934X_CODEC_RPM_CLK_GATE,
- 0x04, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CLK_SYS_MCLK2_PRG1,
+ 0x06, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD934X_CLK_SYS_MCLK2_PRG1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CODEC_RPM_CLK_GATE,
+ 0x04, 0x00);
usleep_range(30, 50);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x02, 0x02);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
0x10, 0x10);
}
@@ -3492,39 +3646,42 @@
case SND_SOC_DAPM_PRE_PMD:
if (tavil->native_clk_users &&
(--tavil->native_clk_users == 0)) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
0x10, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD934X_CDC_CLK_RST_CTRL_MCLK_CONTROL,
0x02, 0x00);
- snd_soc_update_bits(codec, WCD934X_CODEC_RPM_CLK_GATE,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD934X_CLK_SYS_MCLK2_PRG1,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD934X_CLK_SYS_MCLK2_PRG1,
- 0x06, 0x00);
- snd_soc_update_bits(codec, WCD934X_CLK_SYS_PLL_ENABLES,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CODEC_RPM_CLK_GATE,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD934X_CLK_SYS_MCLK2_PRG1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CLK_SYS_MCLK2_PRG1,
+ 0x06, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CLK_SYS_PLL_ENABLES,
+ 0x01, 0x00);
}
break;
}
- dev_dbg(codec->dev, "%s: native_clk_users: %d, event: %d\n",
+ dev_dbg(component->dev, "%s: native_clk_users: %d, event: %d\n",
__func__, tavil->native_clk_users, event);
return 0;
}
-static void tavil_codec_hphdelay_lutbypass(struct snd_soc_codec *codec,
+static void tavil_codec_hphdelay_lutbypass(struct snd_soc_component *component,
u16 interp_idx, int event)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
u8 hph_dly_mask;
u16 hph_lut_bypass_reg = 0;
u16 hph_comp_ctrl7 = 0;
-
switch (interp_idx) {
case INTERP_HPHL:
hph_dly_mask = 1;
@@ -3541,18 +3698,22 @@
}
if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, WCD934X_CDC_CLSH_TEST0,
+ snd_soc_component_update_bits(component, WCD934X_CDC_CLSH_TEST0,
hph_dly_mask, 0x0);
- snd_soc_update_bits(codec, hph_lut_bypass_reg, 0x80, 0x80);
+ snd_soc_component_update_bits(component, hph_lut_bypass_reg,
+ 0x80, 0x80);
if (tavil->hph_mode == CLS_H_ULP)
- snd_soc_update_bits(codec, hph_comp_ctrl7, 0x20, 0x20);
+ snd_soc_component_update_bits(component, hph_comp_ctrl7,
+ 0x20, 0x20);
}
if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, WCD934X_CDC_CLSH_TEST0,
+ snd_soc_component_update_bits(component, WCD934X_CDC_CLSH_TEST0,
hph_dly_mask, hph_dly_mask);
- snd_soc_update_bits(codec, hph_lut_bypass_reg, 0x80, 0x00);
- snd_soc_update_bits(codec, hph_comp_ctrl7, 0x20, 0x0);
+ snd_soc_component_update_bits(component, hph_lut_bypass_reg,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component, hph_comp_ctrl7,
+ 0x20, 0x0);
}
}
@@ -3561,7 +3722,7 @@
{
u16 hd2_scale_reg;
u16 hd2_enable_reg = 0;
- struct snd_soc_codec *codec = priv->codec;
+ struct snd_soc_component *component = priv->component;
if (TAVIL_IS_1_1(priv->wcd9xxx))
return;
@@ -3578,21 +3739,25 @@
}
if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x14);
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x04);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x3C, 0x14);
+ snd_soc_component_update_bits(component, hd2_enable_reg,
+ 0x04, 0x04);
}
if (hd2_enable_reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x00);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x00);
+ snd_soc_component_update_bits(component, hd2_enable_reg,
+ 0x04, 0x00);
+ snd_soc_component_update_bits(component, hd2_scale_reg,
+ 0x3C, 0x00);
}
}
-static int tavil_codec_config_ear_spkr_gain(struct snd_soc_codec *codec,
+static int tavil_codec_config_ear_spkr_gain(struct snd_soc_component *component,
int event, int gain_reg)
{
int comp_gain_offset, val;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
switch (tavil->swr.spkr_mode) {
/* Compander gain in SPKR_MODE1 case is 12 dB */
@@ -3614,9 +3779,9 @@
(tavil->ear_spkr_gain != 0)) {
/* For example, val is -8(-12+5-1) for 4dB of gain */
val = comp_gain_offset + tavil->ear_spkr_gain - 1;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
- dev_dbg(codec->dev, "%s: RX7 Volume %d dB\n",
+ dev_dbg(component->dev, "%s: RX7 Volume %d dB\n",
__func__, val);
}
break;
@@ -3629,9 +3794,9 @@
(gain_reg == WCD934X_CDC_RX7_RX_VOL_CTL ||
gain_reg == WCD934X_CDC_RX7_RX_VOL_MIX_CTL) &&
(tavil->ear_spkr_gain != 0)) {
- snd_soc_write(codec, gain_reg, 0x0);
+ snd_soc_component_write(component, gain_reg, 0x0);
- dev_dbg(codec->dev, "%s: Reset RX7 Volume to 0 dB\n",
+ dev_dbg(component->dev, "%s: Reset RX7 Volume to 0 dB\n",
__func__);
}
break;
@@ -3640,10 +3805,10 @@
return 0;
}
-static int tavil_config_compander(struct snd_soc_codec *codec, int interp_n,
- int event)
+static int tavil_config_compander(struct snd_soc_component *component,
+ int interp_n, int event)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int comp;
u16 comp_ctl0_reg, rx_path_cfg0_reg;
@@ -3652,7 +3817,7 @@
return 0;
comp = interp_n - 1;
- dev_dbg(codec->dev, "%s: event %d compander %d, enabled %d\n",
+ dev_dbg(component->dev, "%s: event %d compander %d, enabled %d\n",
__func__, event, comp + 1, tavil->comp_enabled[comp]);
if (!tavil->comp_enabled[comp])
@@ -3663,29 +3828,39 @@
if (SND_SOC_DAPM_EVENT_ON(event)) {
/* Enable Compander Clock */
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, rx_path_cfg0_reg,
+ 0x02, 0x02);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x04);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x00);
+ snd_soc_component_update_bits(component, rx_path_cfg0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component, comp_ctl0_reg,
+ 0x04, 0x00);
}
return 0;
}
-static void tavil_codec_idle_detect_control(struct snd_soc_codec *codec,
+static void tavil_codec_idle_detect_control(struct snd_soc_component *component,
int interp, int event)
{
int reg = 0, mask, val;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
if (!tavil->idle_det_cfg.hph_idle_detect_en)
return;
@@ -3702,12 +3877,13 @@
}
if (reg && SND_SOC_DAPM_EVENT_ON(event))
- snd_soc_update_bits(codec, reg, mask, val);
+ snd_soc_component_update_bits(component, reg, mask, val);
if (reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, reg, mask, 0x00);
+ snd_soc_component_update_bits(component, reg, mask, 0x00);
tavil->idle_det_cfg.hph_idle_thr = 0;
- snd_soc_write(codec, WCD934X_CDC_RX_IDLE_DET_CFG3, 0x0);
+ snd_soc_component_write(component, WCD934X_CDC_RX_IDLE_DET_CFG3,
+ 0x0);
}
}
@@ -3715,37 +3891,39 @@
* tavil_codec_enable_interp_clk - Enable main path Interpolator
* clock.
*
- * @codec: Codec instance
+ * @component: Codec component instance
* @event: Indicates speaker path gain offset value
* @intp_idx: Interpolator index
* Returns number of main clock users
*/
-int tavil_codec_enable_interp_clk(struct snd_soc_codec *codec,
+int tavil_codec_enable_interp_clk(struct snd_soc_component *component,
int event, int interp_idx)
{
struct tavil_priv *tavil;
u16 main_reg;
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
- tavil = snd_soc_codec_get_drvdata(codec);
+ tavil = snd_soc_component_get_drvdata(component);
main_reg = WCD934X_CDC_RX0_RX_PATH_CTL + (interp_idx * 20);
if (SND_SOC_DAPM_EVENT_ON(event)) {
if (tavil->main_clk_users[interp_idx] == 0) {
/* Main path PGA mute enable */
- snd_soc_update_bits(codec, main_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x10, 0x10);
/* Clk enable */
- snd_soc_update_bits(codec, main_reg, 0x20, 0x20);
- tavil_codec_idle_detect_control(codec, interp_idx,
+ snd_soc_component_update_bits(component, main_reg,
+ 0x20, 0x20);
+ tavil_codec_idle_detect_control(component, interp_idx,
event);
tavil_codec_hd2_control(tavil, interp_idx, event);
- tavil_codec_hphdelay_lutbypass(codec, interp_idx,
+ tavil_codec_hphdelay_lutbypass(component, interp_idx,
event);
- tavil_config_compander(codec, interp_idx, event);
+ tavil_config_compander(component, interp_idx, event);
}
tavil->main_clk_users[interp_idx]++;
}
@@ -3754,23 +3932,27 @@
tavil->main_clk_users[interp_idx]--;
if (tavil->main_clk_users[interp_idx] <= 0) {
tavil->main_clk_users[interp_idx] = 0;
- tavil_config_compander(codec, interp_idx, event);
- tavil_codec_hphdelay_lutbypass(codec, interp_idx,
+ tavil_config_compander(component, interp_idx, event);
+ tavil_codec_hphdelay_lutbypass(component, interp_idx,
event);
tavil_codec_hd2_control(tavil, interp_idx, event);
- tavil_codec_idle_detect_control(codec, interp_idx,
+ tavil_codec_idle_detect_control(component, interp_idx,
event);
/* Clk Disable */
- snd_soc_update_bits(codec, main_reg, 0x20, 0x00);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x20, 0x00);
/* Reset enable and disable */
- snd_soc_update_bits(codec, main_reg, 0x40, 0x40);
- snd_soc_update_bits(codec, main_reg, 0x40, 0x00);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x40, 0x40);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x40, 0x00);
/* Reset rate to 48K*/
- snd_soc_update_bits(codec, main_reg, 0x0F, 0x04);
+ snd_soc_component_update_bits(component, main_reg,
+ 0x0F, 0x04);
}
}
- dev_dbg(codec->dev, "%s event %d main_clk_users %d\n",
+ dev_dbg(component->dev, "%s event %d main_clk_users %d\n",
__func__, event, tavil->main_clk_users[interp_idx]);
return tavil->main_clk_users[interp_idx];
@@ -3780,20 +3962,21 @@
static int tavil_anc_out_switch_cb(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- tavil_codec_enable_interp_clk(codec, event, w->shift);
+ tavil_codec_enable_interp_clk(component, event, w->shift);
return 0;
}
-static int tavil_codec_set_idle_detect_thr(struct snd_soc_codec *codec,
+static int tavil_codec_set_idle_detect_thr(struct snd_soc_component *component,
int interp, int path_type)
{
int port_id[4] = { 0, 0, 0, 0 };
int *port_ptr, num_ports;
int bit_width = 0, i;
int mux_reg, mux_reg_val;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int dai_id, idle_thr;
if ((interp != INTERP_HPHL) && (interp != INTERP_HPHR))
@@ -3813,7 +3996,8 @@
if (path_type == INTERP_MIX_PATH) {
mux_reg = WCD934X_CDC_RX_INP_MUX_RX_INT1_CFG1 +
2 * (interp - 1);
- mux_reg_val = snd_soc_read(codec, mux_reg) & 0x0f;
+ mux_reg_val = snd_soc_component_read32(component, mux_reg) &
+ 0x0f;
if ((mux_reg_val >= INTn_2_INP_SEL_RX0) &&
(mux_reg_val < INTn_2_INP_SEL_PROXIMITY)) {
@@ -3826,7 +4010,8 @@
if (path_type == INTERP_MAIN_PATH) {
mux_reg = WCD934X_CDC_RX_INP_MUX_RX_INT1_CFG0 +
2 * (interp - 1);
- mux_reg_val = snd_soc_read(codec, mux_reg) & 0x0f;
+ mux_reg_val = snd_soc_component_read32(component, mux_reg) &
+ 0x0f;
i = WCD934X_INTERP_MUX_NUM_INPUTS;
while (i) {
@@ -3837,14 +4022,14 @@
INTn_1_INP_SEL_RX0;
num_ports++;
}
- mux_reg_val = (snd_soc_read(codec, mux_reg) &
- 0xf0) >> 4;
+ mux_reg_val = (snd_soc_component_read32(
+ component, mux_reg) & 0xf0) >> 4;
mux_reg += 1;
i--;
}
}
- dev_dbg(codec->dev, "%s: num_ports: %d, ports[%d %d %d %d]\n",
+ dev_dbg(component->dev, "%s: num_ports: %d, ports[%d %d %d %d]\n",
__func__, num_ports, port_id[0], port_id[1],
port_id[2], port_id[3]);
@@ -3854,7 +4039,7 @@
tavil);
if ((dai_id >= 0) && (dai_id < NUM_CODEC_DAIS)) {
- dev_dbg(codec->dev, "%s: dai_id: %d bit_width: %d\n",
+ dev_dbg(component->dev, "%s: dai_id: %d bit_width: %d\n",
__func__, dai_id,
tavil->dai[dai_id].bit_width);
@@ -3878,12 +4063,13 @@
break;
}
- dev_dbg(codec->dev, "%s: (new) idle_thr: %d, (cur) idle_thr: %d\n",
+ dev_dbg(component->dev, "%s: (new) idle_thr: %d, (cur) idle_thr: %d\n",
__func__, idle_thr, tavil->idle_det_cfg.hph_idle_thr);
if ((tavil->idle_det_cfg.hph_idle_thr == 0) ||
(idle_thr < tavil->idle_det_cfg.hph_idle_thr)) {
- snd_soc_write(codec, WCD934X_CDC_RX_IDLE_DET_CFG3, idle_thr);
+ snd_soc_component_write(component, WCD934X_CDC_RX_IDLE_DET_CFG3,
+ idle_thr);
tavil->idle_det_cfg.hph_idle_thr = idle_thr;
}
@@ -3894,15 +4080,16 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
u16 gain_reg, mix_reg;
int offset_val = 0;
int val = 0;
if (w->shift >= WCD934X_NUM_INTERPOLATORS ||
w->shift == INTERP_LO3_NA || w->shift == INTERP_LO4_NA) {
- dev_err(codec->dev, "%s: Invalid Interpolator value %d for name %s\n",
+ dev_err(component->dev, "%s: Invalid Interpolator value %d for name %s\n",
__func__, w->shift, w->name);
return -EINVAL;
};
@@ -3917,11 +4104,11 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- tavil_codec_set_idle_detect_thr(codec, w->shift,
+ tavil_codec_set_idle_detect_thr(component, w->shift,
INTERP_MIX_PATH);
- tavil_codec_enable_interp_clk(codec, event, w->shift);
+ tavil_codec_enable_interp_clk(component, event, w->shift);
/* Clk enable */
- snd_soc_update_bits(codec, mix_reg, 0x20, 0x20);
+ snd_soc_component_update_bits(component, mix_reg, 0x20, 0x20);
break;
case SND_SOC_DAPM_POST_PMU:
if ((tavil->swr.spkr_gain_offset ==
@@ -3930,30 +4117,32 @@
tavil->comp_enabled[COMPANDER_8]) &&
(gain_reg == WCD934X_CDC_RX7_RX_VOL_MIX_CTL ||
gain_reg == WCD934X_CDC_RX8_RX_VOL_MIX_CTL)) {
- snd_soc_update_bits(codec, WCD934X_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD934X_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
offset_val = -2;
}
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- tavil_codec_config_ear_spkr_gain(codec, event, gain_reg);
+ snd_soc_component_write(component, gain_reg, val);
+ tavil_codec_config_ear_spkr_gain(component, event, gain_reg);
break;
case SND_SOC_DAPM_POST_PMD:
/* Clk Disable */
- snd_soc_update_bits(codec, mix_reg, 0x20, 0x00);
- tavil_codec_enable_interp_clk(codec, event, w->shift);
+ snd_soc_component_update_bits(component, mix_reg, 0x20, 0x00);
+ tavil_codec_enable_interp_clk(component, event, w->shift);
/* Reset enable and disable */
- snd_soc_update_bits(codec, mix_reg, 0x40, 0x40);
- snd_soc_update_bits(codec, mix_reg, 0x40, 0x00);
+ snd_soc_component_update_bits(component, mix_reg, 0x40, 0x40);
+ snd_soc_component_update_bits(component, mix_reg, 0x40, 0x00);
if ((tavil->swr.spkr_gain_offset ==
WCD934X_RX_GAIN_OFFSET_M1P5_DB) &&
@@ -3961,25 +4150,28 @@
tavil->comp_enabled[COMPANDER_8]) &&
(gain_reg == WCD934X_CDC_RX7_RX_VOL_MIX_CTL ||
gain_reg == WCD934X_CDC_RX8_RX_VOL_MIX_CTL)) {
- snd_soc_update_bits(codec, WCD934X_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD934X_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
offset_val = 2;
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
}
- tavil_codec_config_ear_spkr_gain(codec, event, gain_reg);
+ tavil_codec_config_ear_spkr_gain(component, event, gain_reg);
break;
};
- dev_dbg(codec->dev, "%s event %d name %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s event %d name %s\n", __func__,
+ event, w->name);
return 0;
}
@@ -3987,18 +4179,19 @@
/**
* tavil_get_dsd_config - Get pointer to dsd config structure
*
- * @codec: pointer to snd_soc_codec structure
+ * @component: pointer to snd_soc_component structure
*
* Returns pointer to tavil_dsd_config structure
*/
-struct tavil_dsd_config *tavil_get_dsd_config(struct snd_soc_codec *codec)
+struct tavil_dsd_config *tavil_get_dsd_config(
+ struct snd_soc_component *component)
{
struct tavil_priv *tavil;
- if (!codec)
+ if (!component)
return NULL;
- tavil = snd_soc_codec_get_drvdata(codec);
+ tavil = snd_soc_component_get_drvdata(component);
if (!tavil)
return NULL;
@@ -4011,18 +4204,19 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
u16 gain_reg;
u16 reg;
int val;
int offset_val = 0;
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
+ dev_dbg(component->dev, "%s %d %s\n", __func__, event, w->name);
if (w->shift >= WCD934X_NUM_INTERPOLATORS ||
w->shift == INTERP_LO3_NA || w->shift == INTERP_LO4_NA) {
- dev_err(codec->dev, "%s: Invalid Interpolator value %d for name %s\n",
+ dev_err(component->dev, "%s: Invalid Interpolator value %d for name %s\n",
__func__, w->shift, w->name);
return -EINVAL;
};
@@ -4034,9 +4228,9 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- tavil_codec_set_idle_detect_thr(codec, w->shift,
+ tavil_codec_set_idle_detect_thr(component, w->shift,
INTERP_MAIN_PATH);
- tavil_codec_enable_interp_clk(codec, event, w->shift);
+ tavil_codec_enable_interp_clk(component, event, w->shift);
break;
case SND_SOC_DAPM_POST_PMU:
/* apply gain after int clk is enabled */
@@ -4046,25 +4240,27 @@
tavil->comp_enabled[COMPANDER_8]) &&
(gain_reg == WCD934X_CDC_RX7_RX_VOL_CTL ||
gain_reg == WCD934X_CDC_RX8_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, WCD934X_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD934X_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_SEC1,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_MIX_SEC0,
+ 0x01, 0x01);
offset_val = -2;
}
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- tavil_codec_config_ear_spkr_gain(codec, event, gain_reg);
+ snd_soc_component_write(component, gain_reg, val);
+ tavil_codec_config_ear_spkr_gain(component, event, gain_reg);
break;
case SND_SOC_DAPM_POST_PMD:
- tavil_codec_enable_interp_clk(codec, event, w->shift);
+ tavil_codec_enable_interp_clk(component, event, w->shift);
if ((tavil->swr.spkr_gain_offset ==
WCD934X_RX_GAIN_OFFSET_M1P5_DB) &&
@@ -4072,22 +4268,24 @@
tavil->comp_enabled[COMPANDER_8]) &&
(gain_reg == WCD934X_CDC_RX7_RX_VOL_CTL ||
gain_reg == WCD934X_CDC_RX8_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, WCD934X_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD934X_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD934X_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX7_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_SEC1,
+ 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CDC_RX8_RX_PATH_MIX_SEC0,
+ 0x01, 0x00);
offset_val = 2;
- val = snd_soc_read(codec, gain_reg);
+ val = snd_soc_component_read32(component, gain_reg);
val += offset_val;
- snd_soc_write(codec, gain_reg, val);
+ snd_soc_component_write(component, gain_reg, val);
}
- tavil_codec_config_ear_spkr_gain(codec, event, gain_reg);
+ tavil_codec_config_ear_spkr_gain(component, event, gain_reg);
break;
};
@@ -4097,42 +4295,43 @@
static int tavil_codec_set_iir_gain(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s: event = %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event = %d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU: /* fall through */
case SND_SOC_DAPM_PRE_PMD:
if (strnstr(w->name, "IIR0", sizeof("IIR0"))) {
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL));
} else {
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B1_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B1_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B2_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B2_CTL));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B3_CTL,
- snd_soc_read(codec,
+ snd_soc_component_read32(component,
WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B3_CTL));
}
break;
@@ -4140,7 +4339,7 @@
return 0;
}
-static int tavil_codec_find_amic_input(struct snd_soc_codec *codec,
+static int tavil_codec_find_amic_input(struct snd_soc_component *component,
int adc_mux_n)
{
u16 mask, shift, adc_mux_in_reg;
@@ -4200,15 +4399,16 @@
adc_mux_n - 5;
}
- is_amic = (((snd_soc_read(codec, adc_mux_in_reg) & mask) >> shift)
+ is_amic = (((snd_soc_component_read32(component, adc_mux_in_reg) &
+ mask) >> shift)
== 1);
if (!is_amic)
return 0;
- return snd_soc_read(codec, amic_mux_sel_reg) & 0x07;
+ return snd_soc_component_read32(component, amic_mux_sel_reg) & 0x07;
}
-static void tavil_codec_set_tx_hold(struct snd_soc_codec *codec,
+static void tavil_codec_set_tx_hold(struct snd_soc_component *component,
u16 amic_reg, bool set)
{
u8 mask = 0x20;
@@ -4223,14 +4423,16 @@
switch (amic_reg) {
case WCD934X_ANA_AMIC1:
case WCD934X_ANA_AMIC2:
- snd_soc_update_bits(codec, WCD934X_ANA_AMIC2, mask, val);
+ snd_soc_component_update_bits(component, WCD934X_ANA_AMIC2,
+ mask, val);
break;
case WCD934X_ANA_AMIC3:
case WCD934X_ANA_AMIC4:
- snd_soc_update_bits(codec, WCD934X_ANA_AMIC4, mask, val);
+ snd_soc_component_update_bits(component, WCD934X_ANA_AMIC4,
+ mask, val);
break;
default:
- dev_dbg(codec->dev, "%s: invalid amic: %d\n",
+ dev_dbg(component->dev, "%s: invalid amic: %d\n",
__func__, amic_reg);
break;
}
@@ -4240,15 +4442,16 @@
struct snd_kcontrol *kcontrol, int event)
{
int adc_mux_n = w->shift;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int amic_n;
- dev_dbg(codec->dev, "%s: event: %d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event: %d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- amic_n = tavil_codec_find_amic_input(codec, adc_mux_n);
+ amic_n = tavil_codec_find_amic_input(component, adc_mux_n);
if (amic_n) {
/*
* Prevent ANC Rx pop by leaving Tx FE in HOLD
@@ -4266,7 +4469,8 @@
return 0;
}
-static u16 tavil_codec_get_amic_pwlvl_reg(struct snd_soc_codec *codec, int amic)
+static u16 tavil_codec_get_amic_pwlvl_reg(struct snd_soc_component *component,
+ int amic)
{
u16 pwr_level_reg = 0;
@@ -4281,7 +4485,7 @@
pwr_level_reg = WCD934X_ANA_AMIC3;
break;
default:
- dev_dbg(codec->dev, "%s: invalid amic: %d\n",
+ dev_dbg(component->dev, "%s: invalid amic: %d\n",
__func__, amic);
break;
}
@@ -4299,7 +4503,7 @@
struct delayed_work *hpf_delayed_work;
struct hpf_work *hpf_work;
struct tavil_priv *tavil;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u16 dec_cfg_reg, amic_reg, go_bit_reg;
u8 hpf_cut_off_freq;
int amic_n;
@@ -4307,26 +4511,27 @@
hpf_delayed_work = to_delayed_work(work);
hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork);
tavil = hpf_work->tavil;
- codec = tavil->codec;
+ component = tavil->component;
hpf_cut_off_freq = hpf_work->hpf_cut_off_freq;
dec_cfg_reg = WCD934X_CDC_TX0_TX_PATH_CFG0 + 16 * hpf_work->decimator;
go_bit_reg = dec_cfg_reg + 7;
- dev_dbg(codec->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
+ dev_dbg(component->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
__func__, hpf_work->decimator, hpf_cut_off_freq);
- amic_n = tavil_codec_find_amic_input(codec, hpf_work->decimator);
+ amic_n = tavil_codec_find_amic_input(component, hpf_work->decimator);
if (amic_n) {
amic_reg = WCD934X_ANA_AMIC1 + amic_n - 1;
- tavil_codec_set_tx_hold(codec, amic_reg, false);
+ tavil_codec_set_tx_hold(component, amic_reg, false);
}
- snd_soc_update_bits(codec, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, go_bit_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ snd_soc_component_update_bits(component, go_bit_reg, 0x02, 0x02);
/* Minimum 1 clk cycle delay is required as per HW spec */
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, go_bit_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(component, go_bit_reg, 0x02, 0x00);
}
static void tavil_tx_mute_update_callback(struct work_struct *work)
@@ -4334,40 +4539,43 @@
struct tx_mute_work *tx_mute_dwork;
struct tavil_priv *tavil;
struct delayed_work *delayed_work;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
u16 tx_vol_ctl_reg, hpf_gate_reg;
delayed_work = to_delayed_work(work);
tx_mute_dwork = container_of(delayed_work, struct tx_mute_work, dwork);
tavil = tx_mute_dwork->tavil;
- codec = tavil->codec;
+ component = tavil->component;
tx_vol_ctl_reg = WCD934X_CDC_TX0_TX_PATH_CTL +
16 * tx_mute_dwork->decimator;
hpf_gate_reg = WCD934X_CDC_TX0_TX_PATH_SEC2 +
16 * tx_mute_dwork->decimator;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg, 0x10, 0x00);
}
static int tavil_codec_enable_rx_path_clk(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
u16 sidetone_reg;
- dev_dbg(codec->dev, "%s %d %d\n", __func__, event, w->shift);
+ dev_dbg(component->dev, "%s %d %d\n", __func__, event, w->shift);
sidetone_reg = WCD934X_CDC_RX0_RX_PATH_CFG1 + 0x14*(w->shift);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (!strcmp(w->name, "RX INT7 MIX2 INP"))
__tavil_codec_enable_swr(w, event);
- tavil_codec_enable_interp_clk(codec, event, w->shift);
- snd_soc_update_bits(codec, sidetone_reg, 0x10, 0x10);
+ tavil_codec_enable_interp_clk(component, event, w->shift);
+ snd_soc_component_update_bits(component, sidetone_reg,
+ 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, sidetone_reg, 0x10, 0x00);
- tavil_codec_enable_interp_clk(codec, event, w->shift);
+ snd_soc_component_update_bits(component, sidetone_reg,
+ 0x10, 0x00);
+ tavil_codec_enable_interp_clk(component, event, w->shift);
if (!strcmp(w->name, "RX INT7 MIX2 INP"))
__tavil_codec_enable_swr(w, event);
break;
@@ -4380,8 +4588,9 @@
static int tavil_codec_enable_dec(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
unsigned int decimator;
char *dec_adc_mux_name = NULL;
char *widget_name = NULL;
@@ -4392,7 +4601,7 @@
char *dec;
u8 hpf_cut_off_freq;
- dev_dbg(codec->dev, "%s %d\n", __func__, event);
+ dev_dbg(component->dev, "%s %d\n", __func__, event);
widget_name = kstrndup(w->name, 15, GFP_KERNEL);
if (!widget_name)
@@ -4401,7 +4610,7 @@
wname = widget_name;
dec_adc_mux_name = strsep(&widget_name, " ");
if (!dec_adc_mux_name) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
+ dev_err(component->dev, "%s: Invalid decimator = %s\n",
__func__, w->name);
ret = -EINVAL;
goto out;
@@ -4410,7 +4619,7 @@
dec = strpbrk(dec_adc_mux_name, "012345678");
if (!dec) {
- dev_err(codec->dev, "%s: decimator index not found\n",
+ dev_err(component->dev, "%s: decimator index not found\n",
__func__);
ret = -EINVAL;
goto out;
@@ -4418,13 +4627,13 @@
ret = kstrtouint(dec, 10, &decimator);
if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
+ dev_err(component->dev, "%s: Invalid decimator = %s\n",
__func__, wname);
ret = -EINVAL;
goto out;
}
- dev_dbg(codec->dev, "%s(): widget = %s decimator = %u\n", __func__,
+ dev_dbg(component->dev, "%s(): widget = %s decimator = %u\n", __func__,
w->name, decimator);
tx_vol_ctl_reg = WCD934X_CDC_TX0_TX_PATH_CTL + 16 * decimator;
@@ -4434,55 +4643,63 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- amic_n = tavil_codec_find_amic_input(codec, decimator);
+ amic_n = tavil_codec_find_amic_input(component, decimator);
if (amic_n)
- pwr_level_reg = tavil_codec_get_amic_pwlvl_reg(codec,
- amic_n);
+ pwr_level_reg = tavil_codec_get_amic_pwlvl_reg(
+ component, amic_n);
if (pwr_level_reg) {
- switch ((snd_soc_read(codec, pwr_level_reg) &
- WCD934X_AMIC_PWR_LVL_MASK) >>
- WCD934X_AMIC_PWR_LVL_SHIFT) {
+ switch ((snd_soc_component_read32(
+ component, pwr_level_reg) &
+ WCD934X_AMIC_PWR_LVL_MASK) >>
+ WCD934X_AMIC_PWR_LVL_SHIFT) {
case WCD934X_AMIC_PWR_LEVEL_LP:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD934X_DEC_PWR_LVL_MASK,
- WCD934X_DEC_PWR_LVL_LP);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ WCD934X_DEC_PWR_LVL_MASK,
+ WCD934X_DEC_PWR_LVL_LP);
break;
case WCD934X_AMIC_PWR_LEVEL_HP:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD934X_DEC_PWR_LVL_MASK,
- WCD934X_DEC_PWR_LVL_HP);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ WCD934X_DEC_PWR_LVL_MASK,
+ WCD934X_DEC_PWR_LVL_HP);
break;
case WCD934X_AMIC_PWR_LEVEL_DEFAULT:
case WCD934X_AMIC_PWR_LEVEL_HYBRID:
default:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD934X_DEC_PWR_LVL_MASK,
- WCD934X_DEC_PWR_LVL_DF);
+ snd_soc_component_update_bits(
+ component, dec_cfg_reg,
+ WCD934X_DEC_PWR_LVL_MASK,
+ WCD934X_DEC_PWR_LVL_DF);
break;
}
}
/* Enable TX PGA Mute */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x10);
break;
case SND_SOC_DAPM_POST_PMU:
- hpf_cut_off_freq = (snd_soc_read(codec, dec_cfg_reg) &
- TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
+ hpf_cut_off_freq = (snd_soc_component_read32(
+ component, dec_cfg_reg) &
+ TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
tavil->tx_hpf_work[decimator].hpf_cut_off_freq =
hpf_cut_off_freq;
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
+ snd_soc_component_update_bits(component, dec_cfg_reg,
TX_HPF_CUT_OFF_FREQ_MASK,
CF_MIN_3DB_150HZ << 5);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x02);
+ snd_soc_component_update_bits(component, hpf_gate_reg,
+ 0x02, 0x02);
/*
* Minimum 1 clk cycle delay is required as per
* HW spec.
*/
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x00);
+ snd_soc_component_update_bits(component, hpf_gate_reg,
+ 0x02, 0x00);
}
/* schedule work queue to Remove Mute */
schedule_delayed_work(&tavil->tx_mute_dwork[decimator].dwork,
@@ -4493,36 +4710,42 @@
&tavil->tx_hpf_work[decimator].dwork,
msecs_to_jiffies(300));
/* apply gain after decimator is enabled */
- snd_soc_write(codec, tx_gain_ctl_reg,
- snd_soc_read(codec, tx_gain_ctl_reg));
+ snd_soc_component_write(component, tx_gain_ctl_reg,
+ snd_soc_component_read32(
+ component, tx_gain_ctl_reg));
break;
case SND_SOC_DAPM_PRE_PMD:
hpf_cut_off_freq =
tavil->tx_hpf_work[decimator].hpf_cut_off_freq;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x10);
if (cancel_delayed_work_sync(
&tavil->tx_hpf_work[decimator].dwork)) {
if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
- TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, hpf_gate_reg,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ dec_cfg_reg,
+ TX_HPF_CUT_OFF_FREQ_MASK,
+ hpf_cut_off_freq << 5);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg,
+ 0x02, 0x02);
/*
* Minimum 1 clk cycle delay is required as per
* HW spec.
*/
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ hpf_gate_reg,
+ 0x02, 0x00);
}
}
cancel_delayed_work_sync(
&tavil->tx_mute_dwork[decimator].dwork);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
- snd_soc_update_bits(codec, dec_cfg_reg,
+ snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+ 0x10, 0x00);
+ snd_soc_component_update_bits(component, dec_cfg_reg,
WCD934X_DEC_PWR_LVL_MASK,
WCD934X_DEC_PWR_LVL_DF);
break;
@@ -4532,7 +4755,7 @@
return ret;
}
-static u32 tavil_get_dmic_sample_rate(struct snd_soc_codec *codec,
+static u32 tavil_get_dmic_sample_rate(struct snd_soc_component *component,
unsigned int dmic,
struct wcd9xxx_pdata *pdata)
{
@@ -4553,7 +4776,8 @@
++adc_mux_index;
continue;
}
- adc_mux_sel = ((snd_soc_read(codec, adc_mux_ctl_reg) &
+ adc_mux_sel = ((snd_soc_component_read32(
+ component, adc_mux_ctl_reg) &
0xF8) >> 3) - 1;
if (adc_mux_sel == dmic) {
@@ -4566,7 +4790,8 @@
if (dec_found && adc_mux_index <= 8) {
tx_fs_reg = WCD934X_CDC_TX0_TX_PATH_CTL + (16 * adc_mux_index);
- tx_stream_fs = snd_soc_read(codec, tx_fs_reg) & 0x0F;
+ tx_stream_fs = snd_soc_component_read32(
+ component, tx_fs_reg) & 0x0F;
if (tx_stream_fs <= 4) {
if (pdata->dmic_sample_rate <=
WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ)
@@ -4582,13 +4807,13 @@
return dmic_fs;
}
-static u8 tavil_get_dmic_clk_val(struct snd_soc_codec *codec,
+static u8 tavil_get_dmic_clk_val(struct snd_soc_component *component,
u32 mclk_rate, u32 dmic_clk_rate)
{
u32 div_factor;
u8 dmic_ctl_val;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: mclk_rate = %d, dmic_sample_rate = %d\n",
__func__, mclk_rate, dmic_clk_rate);
@@ -4599,7 +4824,7 @@
dmic_ctl_val = WCD934X_DMIC_CLK_DIV_3;
if (dmic_clk_rate == 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: dmic_sample_rate cannot be 0\n",
__func__);
goto done;
@@ -4626,7 +4851,7 @@
dmic_ctl_val = WCD934X_DMIC_CLK_DIV_16;
break;
default:
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid div_factor %u, clk_rate(%u), dmic_rate(%u)\n",
__func__, div_factor, mclk_rate, dmic_clk_rate);
break;
@@ -4639,13 +4864,14 @@
static int tavil_codec_enable_adc(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s: event:%d\n", __func__, event);
+ dev_dbg(component->dev, "%s: event:%d\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- tavil_codec_set_tx_hold(codec, w->reg, true);
+ tavil_codec_set_tx_hold(component, w->reg, true);
break;
default:
break;
@@ -4657,9 +4883,10 @@
static int tavil_codec_enable_dmic(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx_pdata *pdata = dev_get_platdata(component->dev->parent);
u8 dmic_clk_en = 0x01;
u16 dmic_clk_reg;
s32 *dmic_clk_cnt;
@@ -4671,13 +4898,13 @@
wname = strpbrk(w->name, "012345");
if (!wname) {
- dev_err(codec->dev, "%s: widget not found\n", __func__);
+ dev_err(component->dev, "%s: widget not found\n", __func__);
return -EINVAL;
}
ret = kstrtouint(wname, 10, &dmic);
if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid DMIC line on the codec\n",
+ dev_err(component->dev, "%s: Invalid DMIC line on the codec\n",
__func__);
return -EINVAL;
}
@@ -4699,42 +4926,42 @@
dmic_clk_reg = WCD934X_CPE_SS_DMIC2_CTL;
break;
default:
- dev_err(codec->dev, "%s: Invalid DMIC Selection\n",
+ dev_err(component->dev, "%s: Invalid DMIC Selection\n",
__func__);
return -EINVAL;
};
- dev_dbg(codec->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
+ dev_dbg(component->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
__func__, event, dmic, *dmic_clk_cnt);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- dmic_sample_rate = tavil_get_dmic_sample_rate(codec, dmic,
+ dmic_sample_rate = tavil_get_dmic_sample_rate(component, dmic,
pdata);
dmic_rate_val =
- tavil_get_dmic_clk_val(codec,
+ tavil_get_dmic_clk_val(component,
pdata->mclk_rate,
dmic_sample_rate);
(*dmic_clk_cnt)++;
if (*dmic_clk_cnt == 1) {
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
0x07 << dmic_rate_shift,
dmic_rate_val << dmic_rate_shift);
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
dmic_clk_en, dmic_clk_en);
}
break;
case SND_SOC_DAPM_POST_PMD:
dmic_rate_val =
- tavil_get_dmic_clk_val(codec,
+ tavil_get_dmic_clk_val(component,
pdata->mclk_rate,
pdata->mad_dmic_sample_rate);
(*dmic_clk_cnt)--;
if (*dmic_clk_cnt == 0) {
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
dmic_clk_en, 0);
- snd_soc_update_bits(codec, dmic_clk_reg,
+ snd_soc_component_update_bits(component, dmic_clk_reg,
0x07 << dmic_rate_shift,
dmic_rate_val << dmic_rate_shift);
}
@@ -4746,16 +4973,16 @@
/*
* tavil_mbhc_micb_adjust_voltage: adjust specific micbias voltage
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @req_volt: micbias voltage to be set
* @micb_num: micbias to be set, e.g. micbias1 or micbias2
*
* return 0 if adjustment is success or error code in case of failure
*/
-int tavil_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
+int tavil_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int req_volt, int micb_num)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int cur_vout_ctl, req_vout_ctl;
int micb_reg, micb_val, micb_en;
int ret = 0;
@@ -4786,7 +5013,7 @@
* momentarily, change the micbias value and then re-enable
* micbias.
*/
- micb_val = snd_soc_read(codec, micb_reg);
+ micb_val = snd_soc_component_read32(component, micb_reg);
micb_en = (micb_val & 0xC0) >> 6;
cur_vout_ctl = micb_val & 0x3F;
@@ -4800,17 +5027,17 @@
goto exit;
}
- dev_dbg(codec->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n",
+ dev_dbg(component->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n",
__func__, micb_num, WCD_VOUT_CTL_TO_MICB(cur_vout_ctl),
req_volt, micb_en);
if (micb_en == 0x1)
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg, 0xC0, 0x80);
- snd_soc_update_bits(codec, micb_reg, 0x3F, req_vout_ctl);
+ snd_soc_component_update_bits(component, micb_reg, 0x3F, req_vout_ctl);
if (micb_en == 0x1) {
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
+ snd_soc_component_update_bits(component, micb_reg, 0xC0, 0x40);
/*
* Add 2ms delay as per HW requirement after enabling
* micbias
@@ -4825,17 +5052,17 @@
/*
* tavil_micbias_control: enable/disable micbias
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @micb_num: micbias to be enabled/disabled, e.g. micbias1 or micbias2
* @req: control requested, enable/disable or pullup enable/disable
* @is_dapm: triggered by dapm or not
*
* return 0 if control is success or error code in case of failure
*/
-int tavil_micbias_control(struct snd_soc_codec *codec,
+int tavil_micbias_control(struct snd_soc_component *component,
int micb_num, int req, bool is_dapm)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int micb_index = micb_num - 1;
u16 micb_reg;
int pre_off_event = 0, post_off_event = 0;
@@ -4843,7 +5070,7 @@
int post_dapm_on = 0;
if ((micb_index < 0) || (micb_index > TAVIL_MAX_MICBIAS - 1)) {
- dev_err(codec->dev, "%s: Invalid micbias index, micb_ind:%d\n",
+ dev_err(component->dev, "%s: Invalid micbias index, micb_ind:%d\n",
__func__, micb_index);
return -EINVAL;
}
@@ -4867,7 +5094,7 @@
micb_reg = WCD934X_ANA_MICB4;
break;
default:
- dev_err(codec->dev, "%s: Invalid micbias number: %d\n",
+ dev_err(component->dev, "%s: Invalid micbias number: %d\n",
__func__, micb_num);
return -EINVAL;
}
@@ -4878,14 +5105,16 @@
tavil->pullup_ref[micb_index]++;
if ((tavil->pullup_ref[micb_index] == 1) &&
(tavil->micb_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x80);
break;
case MICB_PULLUP_DISABLE:
if (tavil->pullup_ref[micb_index] > 0)
tavil->pullup_ref[micb_index]--;
if ((tavil->pullup_ref[micb_index] == 0) &&
(tavil->micb_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x00);
break;
case MICB_ENABLE:
tavil->micb_ref[micb_index]++;
@@ -4893,7 +5122,8 @@
if (tavil->micb_load)
regulator_set_load(tavil->micb_load,
tavil->micb_load_high);
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x40);
if (post_on_event && tavil->mbhc)
blocking_notifier_call_chain(
&tavil->mbhc->notifier,
@@ -4909,7 +5139,8 @@
tavil->micb_ref[micb_index]--;
if ((tavil->micb_ref[micb_index] == 0) &&
(tavil->pullup_ref[micb_index] > 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x80);
else if ((tavil->micb_ref[micb_index] == 0) &&
(tavil->pullup_ref[micb_index] == 0)) {
if (pre_off_event && tavil->mbhc)
@@ -4917,7 +5148,8 @@
&tavil->mbhc->notifier,
pre_off_event,
&tavil->mbhc->wcd_mbhc);
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x00);
if (post_off_event && tavil->mbhc)
blocking_notifier_call_chain(
&tavil->mbhc->notifier,
@@ -4933,7 +5165,7 @@
break;
};
- dev_dbg(codec->dev, "%s: micb_num:%d, micb_ref: %d, pullup_ref: %d\n",
+ dev_dbg(component->dev, "%s: micb_num:%d, micb_ref: %d, pullup_ref: %d\n",
__func__, micb_num, tavil->micb_ref[micb_index],
tavil->pullup_ref[micb_index]);
@@ -4946,10 +5178,11 @@
static int __tavil_codec_enable_micbias(struct snd_soc_dapm_widget *w,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int micb_num;
- dev_dbg(codec->dev, "%s: wname: %s, event: %d\n",
+ dev_dbg(component->dev, "%s: wname: %s, event: %d\n",
__func__, w->name, event);
if (strnstr(w->name, "MIC BIAS1", sizeof("MIC BIAS1")))
@@ -4970,14 +5203,14 @@
* so use ref count to handle micbias pullup
* and enable requests
*/
- tavil_micbias_control(codec, micb_num, MICB_ENABLE, true);
+ tavil_micbias_control(component, micb_num, MICB_ENABLE, true);
break;
case SND_SOC_DAPM_POST_PMU:
/* wait for cnp time */
usleep_range(1000, 1100);
break;
case SND_SOC_DAPM_POST_PMD:
- tavil_micbias_control(codec, micb_num, MICB_DISABLE, true);
+ tavil_micbias_control(component, micb_num, MICB_DISABLE, true);
break;
};
@@ -4986,7 +5219,7 @@
/*
* tavil_codec_enable_standalone_micbias - enable micbias standalone
- * @codec: pointer to codec instance
+ * @component: pointer to codec component instance
* @micb_num: number of micbias to be enabled
* @enable: true to enable micbias or false to disable
*
@@ -4995,7 +5228,7 @@
*
* Return: error code in case of failure or 0 for success
*/
-int tavil_codec_enable_standalone_micbias(struct snd_soc_codec *codec,
+int tavil_codec_enable_standalone_micbias(struct snd_soc_component *component,
int micb_num,
bool enable)
{
@@ -5006,29 +5239,30 @@
int micb_index = micb_num - 1;
int rc;
- if (!codec) {
- pr_err("%s: Codec memory is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: Component memory is NULL\n", __func__);
return -EINVAL;
}
if ((micb_index < 0) || (micb_index > TAVIL_MAX_MICBIAS - 1)) {
- dev_err(codec->dev, "%s: Invalid micbias index, micb_ind:%d\n",
+ dev_err(component->dev, "%s: Invalid micbias index, micb_ind:%d\n",
__func__, micb_index);
return -EINVAL;
}
if (enable)
rc = snd_soc_dapm_force_enable_pin(
- snd_soc_codec_get_dapm(codec),
- micb_names[micb_index]);
+ snd_soc_component_get_dapm(component),
+ micb_names[micb_index]);
else
- rc = snd_soc_dapm_disable_pin(snd_soc_codec_get_dapm(codec),
- micb_names[micb_index]);
+ rc = snd_soc_dapm_disable_pin(
+ snd_soc_component_get_dapm(component),
+ micb_names[micb_index]);
if (!rc)
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
+ snd_soc_dapm_sync(snd_soc_component_get_dapm(component));
else
- dev_err(codec->dev, "%s: micbias%d force %s pin failed\n",
+ dev_err(component->dev, "%s: micbias%d force %s pin failed\n",
__func__, micb_num, (enable ? "enable" : "disable"));
return rc;
@@ -5040,17 +5274,18 @@
int event)
{
int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
wcd_resmgr_enable_master_bias(tavil->resmgr);
- tavil_cdc_mclk_enable(codec, true);
+ tavil_cdc_mclk_enable(component, true);
ret = __tavil_codec_enable_micbias(w, SND_SOC_DAPM_PRE_PMU);
/* Wait for 1ms for better cnp */
usleep_range(1000, 1100);
- tavil_cdc_mclk_enable(codec, false);
+ tavil_cdc_mclk_enable(component, false);
break;
case SND_SOC_DAPM_POST_PMD:
ret = __tavil_codec_enable_micbias(w, SND_SOC_DAPM_POST_PMD);
@@ -5326,9 +5561,10 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
u8 cache_val[TAVIL_HPH_TOTAL_REG];
u8 hw_val[TAVIL_HPH_TOTAL_REG];
int pa_status;
@@ -5355,12 +5591,12 @@
/* If both the values are same, it means no corruption */
if (ret) {
- dev_dbg(codec->dev, "%s: cache and hw reg are not same\n",
+ dev_dbg(component->dev, "%s: cache and hw reg are not same\n",
__func__);
tavil_codec_hph_reg_recover(tavil, wcd9xxx->regmap,
pa_status);
} else {
- dev_dbg(codec->dev, "%s: cache and hw reg are same\n",
+ dev_dbg(component->dev, "%s: cache and hw reg are same\n",
__func__);
tavil->mbhc->is_hph_recover = false;
}
@@ -5405,7 +5641,8 @@
static int tavil_iir_enable_audio_mixer_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -5413,10 +5650,11 @@
/* IIR filter band registers are at integer multiples of 16 */
u16 iir_reg = WCD934X_CDC_SIDETONE_IIR0_IIR_CTL + 16 * iir_idx;
- ucontrol->value.integer.value[0] = (snd_soc_read(codec, iir_reg) &
- (1 << band_idx)) != 0;
+ ucontrol->value.integer.value[0] =
+ (snd_soc_component_read32(component, iir_reg) &
+ (1 << band_idx)) != 0;
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
+ dev_dbg(component->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
iir_idx, band_idx,
(uint32_t)ucontrol->value.integer.value[0]);
return 0;
@@ -5425,8 +5663,9 @@
static int tavil_iir_enable_audio_mixer_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -5438,56 +5677,56 @@
tavil_restore_iir_coeff(tavil, iir_idx, band_idx);
/* Mask first 5 bits, 6-8 are reserved */
- snd_soc_update_bits(codec, iir_reg, (1 << band_idx),
+ snd_soc_component_update_bits(component, iir_reg, (1 << band_idx),
(value << band_idx));
- iir_band_en_status = ((snd_soc_read(codec, iir_reg) &
+ iir_band_en_status = ((snd_soc_component_read32(component, iir_reg) &
(1 << band_idx)) != 0);
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
+ dev_dbg(component->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
iir_idx, band_idx, iir_band_en_status);
return 0;
}
-static uint32_t get_iir_band_coeff(struct snd_soc_codec *codec,
+static uint32_t get_iir_band_coeff(struct snd_soc_component *component,
int iir_idx, int band_idx,
int coeff_idx)
{
uint32_t value = 0;
/* Address does not automatically update if reading */
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t)) & 0x7F);
- value |= snd_soc_read(codec,
+ value |= snd_soc_component_read32(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 1) & 0x7F);
- value |= (snd_soc_read(codec,
+ value |= (snd_soc_component_read32(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
16 * iir_idx)) << 8);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 2) & 0x7F);
- value |= (snd_soc_read(codec,
+ value |= (snd_soc_component_read32(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
16 * iir_idx)) << 16);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
((band_idx * BAND_MAX + coeff_idx)
* sizeof(uint32_t) + 3) & 0x7F);
/* Mask bits top 2 bits since they are reserved */
- value |= ((snd_soc_read(codec,
+ value |= ((snd_soc_component_read32(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
16 * iir_idx)) & 0x3F) << 24);
@@ -5497,24 +5736,25 @@
static int tavil_iir_band_audio_mixer_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
ucontrol->value.integer.value[0] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 0);
+ get_iir_band_coeff(component, iir_idx, band_idx, 0);
ucontrol->value.integer.value[1] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 1);
+ get_iir_band_coeff(component, iir_idx, band_idx, 1);
ucontrol->value.integer.value[2] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 2);
+ get_iir_band_coeff(component, iir_idx, band_idx, 2);
ucontrol->value.integer.value[3] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 3);
+ get_iir_band_coeff(component, iir_idx, band_idx, 3);
ucontrol->value.integer.value[4] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 4);
+ get_iir_band_coeff(component, iir_idx, band_idx, 4);
- dev_dbg(codec->dev, "%s: IIR #%d band #%d b0 = 0x%x\n"
+ dev_dbg(component->dev, "%s: IIR #%d band #%d b0 = 0x%x\n"
"%s: IIR #%d band #%d b1 = 0x%x\n"
"%s: IIR #%d band #%d b2 = 0x%x\n"
"%s: IIR #%d band #%d a1 = 0x%x\n"
@@ -5532,24 +5772,24 @@
return 0;
}
-static void set_iir_band_coeff(struct snd_soc_codec *codec,
+static void set_iir_band_coeff(struct snd_soc_component *component,
int iir_idx, int band_idx,
uint32_t value)
{
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
(value & 0xFF));
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
(value >> 8) & 0xFF);
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
(value >> 16) & 0xFF);
/* Mask top 2 bits, 7-8 are reserved */
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
(value >> 24) & 0x3F);
}
@@ -5557,8 +5797,9 @@
static int tavil_iir_band_audio_mixer_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int iir_idx = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->reg;
int band_idx = ((struct soc_multi_mixer_control *)
@@ -5569,7 +5810,7 @@
* Mask top bit it is reserved
* Updates addr automatically for each B2 write
*/
- snd_soc_write(codec,
+ snd_soc_component_write(component,
(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
(band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F);
@@ -5578,7 +5819,7 @@
coeff_idx++) {
uint32_t value = ucontrol->value.integer.value[coeff_idx];
- set_iir_band_coeff(codec, iir_idx, band_idx, value);
+ set_iir_band_coeff(component, iir_idx, band_idx, value);
/* Four 8 bit values(one 32 bit) per coefficient */
tavil->sidetone_coeff_array[iir_idx][band_idx][idx++] =
@@ -5597,15 +5838,15 @@
"%s: IIR #%d band #%d a1 = 0x%x\n"
"%s: IIR #%d band #%d a2 = 0x%x\n",
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 0),
+ get_iir_band_coeff(component, iir_idx, band_idx, 0),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 1),
+ get_iir_band_coeff(component, iir_idx, band_idx, 1),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 2),
+ get_iir_band_coeff(component, iir_idx, band_idx, 2),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 3),
+ get_iir_band_coeff(component, iir_idx, band_idx, 3),
__func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 4));
+ get_iir_band_coeff(component, iir_idx, band_idx, 4));
return 0;
}
@@ -5613,10 +5854,11 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tavil->comp_enabled[comp];
return 0;
@@ -5625,13 +5867,14 @@
static int tavil_compander_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int comp = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
int value = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: Compander %d enable current %d, new %d\n",
+ dev_dbg(component->dev, "%s: Compander %d enable current %d, new %d\n",
__func__, comp + 1, tavil->comp_enabled[comp], value);
tavil->comp_enabled[comp] = value;
@@ -5639,11 +5882,11 @@
switch (comp) {
case COMPANDER_1:
/* Set Gain Source Select based on compander enable/disable */
- snd_soc_update_bits(codec, WCD934X_HPH_L_EN, 0x20,
+ snd_soc_component_update_bits(component, WCD934X_HPH_L_EN, 0x20,
(value ? 0x00:0x20));
break;
case COMPANDER_2:
- snd_soc_update_bits(codec, WCD934X_HPH_R_EN, 0x20,
+ snd_soc_component_update_bits(component, WCD934X_HPH_R_EN, 0x20,
(value ? 0x00:0x20));
break;
case COMPANDER_3:
@@ -5657,7 +5900,7 @@
* it does not cause any audio failure, so do not
* return error in this case, but just print a log
*/
- dev_warn(codec->dev, "%s: unknown compander: %d\n",
+ dev_warn(component->dev, "%s: unknown compander: %d\n",
__func__, comp);
};
return 0;
@@ -5666,8 +5909,9 @@
static int tavil_hph_asrc_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int index = -EINVAL;
if (!strcmp(kcontrol->id.name, "ASRC0 Output Mode"))
@@ -5685,8 +5929,9 @@
static int tavil_hph_asrc_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int val = 0;
int index = -EINVAL;
@@ -5706,8 +5951,9 @@
static int tavil_hph_idle_detect_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int val = 0;
if (tavil)
@@ -5721,8 +5967,9 @@
static int tavil_hph_idle_detect_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
if (tavil)
tavil->idle_det_cfg.hph_idle_detect_en =
@@ -5734,7 +5981,8 @@
static int tavil_dmic_pin_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u16 dmic_pin;
u8 reg_val, pinctl_position;
@@ -5742,7 +5990,7 @@
kcontrol->private_value)->shift;
dmic_pin = pinctl_position & 0x07;
- reg_val = snd_soc_read(codec,
+ reg_val = snd_soc_component_read32(component,
WCD934X_TLMM_DMIC1_CLK_PINCFG + dmic_pin - 1);
ucontrol->value.integer.value[0] = !!reg_val;
@@ -5753,8 +6001,9 @@
static int tavil_dmic_pin_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
u16 ctl_reg, cfg_reg, dmic_pin;
u8 ctl_val, cfg_val, pinctl_position, pinctl_mode, mask;
@@ -5777,14 +6026,14 @@
ctl_reg = WCD934X_TEST_DEBUG_PIN_CTL_OE_3;
break;
default:
- dev_err(codec->dev, "%s: Invalid pinctl position = %d\n",
+ dev_err(component->dev, "%s: Invalid pinctl position = %d\n",
__func__, pinctl_position);
return -EINVAL;
}
ctl_val = ~(pinctl_mode << (pinctl_position & 0x07));
mask = 1 << (pinctl_position & 0x07);
- snd_soc_update_bits(codec, ctl_reg, mask, ctl_val);
+ snd_soc_component_update_bits(component, ctl_reg, mask, ctl_val);
dmic_pin = pinctl_position & 0x07;
cfg_reg = WCD934X_TLMM_DMIC1_CLK_PINCFG + dmic_pin - 1;
@@ -5795,9 +6044,9 @@
cfg_val = 0xD;
} else
cfg_val = 0;
- snd_soc_update_bits(codec, cfg_reg, 0x1F, cfg_val);
+ snd_soc_component_update_bits(component, cfg_reg, 0x1F, cfg_val);
- dev_dbg(codec->dev, "%s: reg=0x%x mask=0x%x val=%d reg=0x%x val=%d\n",
+ dev_dbg(component->dev, "%s: reg=0x%x mask=0x%x val=%d reg=0x%x val=%d\n",
__func__, ctl_reg, mask, ctl_val, cfg_reg, cfg_val);
return 0;
@@ -5806,7 +6055,8 @@
static int tavil_amic_pwr_lvl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u16 amic_reg = 0;
if (!strcmp(kcontrol->id.name, "AMIC_1_2 PWR MODE"))
@@ -5816,7 +6066,7 @@
if (amic_reg)
ucontrol->value.integer.value[0] =
- (snd_soc_read(codec, amic_reg) &
+ (snd_soc_component_read32(component, amic_reg) &
WCD934X_AMIC_PWR_LVL_MASK) >>
WCD934X_AMIC_PWR_LVL_SHIFT;
return 0;
@@ -5825,13 +6075,14 @@
static int tavil_amic_pwr_lvl_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u32 mode_val;
u16 amic_reg = 0;
mode_val = ucontrol->value.enumerated.item[0];
- dev_dbg(codec->dev, "%s: mode: %d\n", __func__, mode_val);
+ dev_dbg(component->dev, "%s: mode: %d\n", __func__, mode_val);
if (!strcmp(kcontrol->id.name, "AMIC_1_2 PWR MODE"))
amic_reg = WCD934X_ANA_AMIC1;
@@ -5839,8 +6090,9 @@
amic_reg = WCD934X_ANA_AMIC3;
if (amic_reg)
- snd_soc_update_bits(codec, amic_reg, WCD934X_AMIC_PWR_LVL_MASK,
- mode_val << WCD934X_AMIC_PWR_LVL_SHIFT);
+ snd_soc_component_update_bits(component, amic_reg,
+ WCD934X_AMIC_PWR_LVL_MASK,
+ mode_val << WCD934X_AMIC_PWR_LVL_SHIFT);
return 0;
}
@@ -5857,13 +6109,15 @@
static int tavil_mad_input_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u8 tavil_mad_input;
- tavil_mad_input = snd_soc_read(codec, WCD934X_SOC_MAD_INP_SEL) & 0x0F;
+ tavil_mad_input = snd_soc_component_read32(
+ component, WCD934X_SOC_MAD_INP_SEL) & 0x0F;
ucontrol->value.integer.value[0] = tavil_mad_input;
- dev_dbg(codec->dev, "%s: tavil_mad_input = %s\n", __func__,
+ dev_dbg(component->dev, "%s: tavil_mad_input = %s\n", __func__,
tavil_conn_mad_text[tavil_mad_input]);
return 0;
@@ -5872,8 +6126,9 @@
static int tavil_mad_input_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct snd_soc_card *card = codec->component.card;
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_card *card = component->card;
u8 tavil_mad_input;
char mad_amic_input_widget[6];
const char *mad_input_widget;
@@ -5887,7 +6142,7 @@
if (tavil_mad_input >= sizeof(tavil_conn_mad_text)/
sizeof(tavil_conn_mad_text[0])) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: tavil_mad_input = %d out of bounds\n",
__func__, tavil_mad_input);
return -EINVAL;
@@ -5895,11 +6150,11 @@
if (strnstr(tavil_conn_mad_text[tavil_mad_input], "NOTUSED",
sizeof("NOTUSED"))) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: Unsupported tavil_mad_input = %s\n",
__func__, tavil_conn_mad_text[tavil_mad_input]);
/* Make sure the MAD register is updated */
- snd_soc_update_bits(codec, WCD934X_ANA_MAD_SETUP,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MAD_SETUP,
0x88, 0x00);
return -EINVAL;
}
@@ -5909,21 +6164,23 @@
mad_input = strpbrk(tavil_conn_mad_text[tavil_mad_input],
"1234");
if (!mad_input) {
- dev_err(codec->dev, "%s: Invalid MAD input %s\n",
+ dev_err(component->dev, "%s: Invalid MAD input %s\n",
__func__, tavil_conn_mad_text[tavil_mad_input]);
return -EINVAL;
}
ret = kstrtouint(mad_input, 10, &adc);
if ((ret < 0) || (adc > 4)) {
- dev_err(codec->dev, "%s: Invalid ADC = %s\n", __func__,
+ dev_err(component->dev, "%s: Invalid ADC = %s\n",
+ __func__,
tavil_conn_mad_text[tavil_mad_input]);
return -EINVAL;
}
/*AMIC4 and AMIC5 share ADC4*/
if ((adc == 4) &&
- (snd_soc_read(codec, WCD934X_TX_NEW_AMIC_4_5_SEL) & 0x10))
+ (snd_soc_component_read32(
+ component, WCD934X_TX_NEW_AMIC_4_5_SEL) & 0x10))
adc = 5;
snprintf(mad_amic_input_widget, 6, "%s%u", "AMIC", adc);
@@ -5935,7 +6192,7 @@
mad_input_widget = tavil_conn_mad_text[tavil_mad_input];
}
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: tavil input widget = %s, adc_input = %s\n", __func__,
mad_input_widget, is_adc_input ? "true" : "false");
@@ -5943,7 +6200,7 @@
if (!strcmp(card->of_dapm_routes[i].sink, mad_input_widget)) {
source_widget = card->of_dapm_routes[i].source;
if (!source_widget) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: invalid source widget\n",
__func__);
return -EINVAL;
@@ -5970,24 +6227,24 @@
}
if (!mic_bias_found) {
- dev_err(codec->dev, "%s: mic bias not found for input %s\n",
+ dev_err(component->dev, "%s: mic bias not found for input %s\n",
__func__, mad_input_widget);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s: mic_bias found = %d\n", __func__,
+ dev_dbg(component->dev, "%s: mic_bias found = %d\n", __func__,
mic_bias_found);
- snd_soc_update_bits(codec, WCD934X_SOC_MAD_INP_SEL,
+ snd_soc_component_update_bits(component, WCD934X_SOC_MAD_INP_SEL,
0x0F, tavil_mad_input);
- snd_soc_update_bits(codec, WCD934X_ANA_MAD_SETUP,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MAD_SETUP,
0x07, mic_bias_found);
/* for all adc inputs, mad should be in micbias mode with BG enabled */
if (is_adc_input)
- snd_soc_update_bits(codec, WCD934X_ANA_MAD_SETUP,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MAD_SETUP,
0x88, 0x88);
else
- snd_soc_update_bits(codec, WCD934X_ANA_MAD_SETUP,
+ snd_soc_component_update_bits(component, WCD934X_ANA_MAD_SETUP,
0x88, 0x00);
return 0;
}
@@ -5996,15 +6253,16 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 ear_pa_gain;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- ear_pa_gain = snd_soc_read(codec, WCD934X_ANA_EAR);
+ ear_pa_gain = snd_soc_component_read32(component, WCD934X_ANA_EAR);
ear_pa_gain = (ear_pa_gain & 0x70) >> 4;
ucontrol->value.integer.value[0] = ear_pa_gain;
- dev_dbg(codec->dev, "%s: ear_pa_gain = 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: ear_pa_gain = 0x%x\n", __func__,
ear_pa_gain);
return 0;
@@ -6014,26 +6272,29 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 ear_pa_gain;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
ear_pa_gain = ucontrol->value.integer.value[0] << 4;
- snd_soc_update_bits(codec, WCD934X_ANA_EAR, 0x70, ear_pa_gain);
+ snd_soc_component_update_bits(component, WCD934X_ANA_EAR,
+ 0x70, ear_pa_gain);
return 0;
}
static int tavil_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tavil->ear_spkr_gain;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -6042,12 +6303,14 @@
static int tavil_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
tavil->ear_spkr_gain = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: gain = %d\n", __func__, tavil->ear_spkr_gain);
+ dev_dbg(component->dev, "%s: gain = %d\n", __func__,
+ tavil->ear_spkr_gain);
return 0;
}
@@ -6056,12 +6319,14 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- bst_state_max = snd_soc_read(codec, WCD934X_CDC_BOOST0_BOOST_CTL);
+ bst_state_max = snd_soc_component_read32(
+ component, WCD934X_CDC_BOOST0_BOOST_CTL);
bst_state_max = (bst_state_max & 0x0c) >> 2;
ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -6071,12 +6336,13 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, WCD934X_CDC_BOOST0_BOOST_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CDC_BOOST0_BOOST_CTL,
0x0c, bst_state_max);
return 0;
@@ -6086,12 +6352,14 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- bst_state_max = snd_soc_read(codec, WCD934X_CDC_BOOST1_BOOST_CTL);
+ bst_state_max = snd_soc_component_read32(component,
+ WCD934X_CDC_BOOST1_BOOST_CTL);
bst_state_max = (bst_state_max & 0x0c) >> 2;
ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
@@ -6101,12 +6369,13 @@
struct snd_ctl_elem_value *ucontrol)
{
u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, WCD934X_CDC_BOOST1_BOOST_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CDC_BOOST1_BOOST_CTL,
0x0c, bst_state_max);
return 0;
@@ -6115,8 +6384,9 @@
static int tavil_rx_hph_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = tavil->hph_mode;
return 0;
@@ -6125,16 +6395,17 @@
static int tavil_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
u32 mode_val;
mode_val = ucontrol->value.enumerated.item[0];
- dev_dbg(codec->dev, "%s: mode: %d\n", __func__, mode_val);
+ dev_dbg(component->dev, "%s: mode: %d\n", __func__, mode_val);
if (mode_val == 0) {
- dev_warn(codec->dev, "%s:Invalid HPH Mode, default to Cls-H LOHiFi\n",
+ dev_warn(component->dev, "%s:Invalid HPH Mode, default to Cls-H LOHiFi\n",
__func__);
mode_val = CLS_H_LOHIFI;
}
@@ -6485,8 +6756,9 @@
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val;
u16 mic_sel_reg = 0;
@@ -6496,7 +6768,7 @@
if (val > e->items - 1)
return -EINVAL;
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: wname: %s, val: 0x%x\n", __func__,
widget->name, val);
switch (e->reg) {
@@ -6527,7 +6799,7 @@
mic_sel_reg = WCD934X_CDC_TX7_TX_PATH_CFG0;
break;
default:
- dev_err(codec->dev, "%s: e->reg: 0x%x not expected\n",
+ dev_err(component->dev, "%s: e->reg: 0x%x not expected\n",
__func__, e->reg);
return -EINVAL;
}
@@ -6535,7 +6807,8 @@
/* ADC: 0, DMIC: 1 */
mic_sel = val ? 0x0 : 0x1;
if (mic_sel_reg)
- snd_soc_update_bits(codec, mic_sel_reg, 1 << 7, mic_sel << 7);
+ snd_soc_component_update_bits(component, mic_sel_reg, 1 << 7,
+ mic_sel << 7);
return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
}
@@ -6545,7 +6818,8 @@
{
struct snd_soc_dapm_widget *widget =
snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(widget->dapm);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int val;
unsigned short look_ahead_dly_reg = WCD934X_CDC_RX0_RX_PATH_CFG0;
@@ -6554,7 +6828,7 @@
if (val >= e->items)
return -EINVAL;
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: wname: %s, val: 0x%x\n", __func__,
widget->name, val);
if (e->reg == WCD934X_CDC_RX0_RX_PATH_SEC0)
@@ -6565,7 +6839,7 @@
look_ahead_dly_reg = WCD934X_CDC_RX2_RX_PATH_CFG0;
/* Set Look Ahead Delay */
- snd_soc_update_bits(codec, look_ahead_dly_reg,
+ snd_soc_component_update_bits(component, look_ahead_dly_reg,
0x08, (val ? 0x08 : 0x00));
/* Set DEM INP Select */
return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
@@ -7462,8 +7736,9 @@
{
struct snd_soc_dapm_context *dapm =
snd_soc_dapm_kcontrol_dapm(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
struct tavil_dsd_config *dsd_conf = tavil_p->dsd_config;
@@ -7483,8 +7758,8 @@
(struct soc_mixer_control *)kcontrol->private_value;
struct snd_soc_dapm_context *dapm =
snd_soc_dapm_kcontrol_dapm(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
- struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
+ struct tavil_priv *tavil_p = snd_soc_component_get_drvdata(component);
unsigned int wval = ucontrol->value.integer.value[0];
struct tavil_dsd_config *dsd_conf = tavil_p->dsd_config;
@@ -8176,7 +8451,8 @@
unsigned int *tx_num, unsigned int *tx_slot,
unsigned int *rx_num, unsigned int *rx_slot)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(dai->codec);
+ struct tavil_priv *tavil =
+ snd_soc_component_get_drvdata(dai->component);
u32 i = 0;
struct wcd9xxx_ch *ch;
int ret = 0;
@@ -8251,8 +8527,8 @@
struct wcd9xxx *core;
struct wcd9xxx_codec_dai_data *dai_data = NULL;
- tavil = snd_soc_codec_get_drvdata(dai->codec);
- core = dev_get_drvdata(dai->codec->dev->parent);
+ tavil = snd_soc_component_get_drvdata(dai->component);
+ core = dev_get_drvdata(dai->component->dev->parent);
if (!tx_slot || !rx_slot) {
dev_err(tavil->dev, "%s: Invalid tx_slot 0x%pK, rx_slot 0x%pK\n",
@@ -8292,9 +8568,10 @@
static int tavil_set_decimator_rate(struct snd_soc_dai *dai,
u32 sample_rate)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct wcd9xxx_ch *ch;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil =
+ snd_soc_component_get_drvdata(component);
u32 tx_port = 0, tx_fs_rate = 0;
u8 shift = 0, shift_val = 0, tx_mux_sel = 0;
int decimator = -1;
@@ -8328,11 +8605,11 @@
list_for_each_entry(ch, &tavil->dai[dai->id].wcd9xxx_ch_list, list) {
tx_port = ch->port;
- dev_dbg(codec->dev, "%s: dai->id = %d, tx_port = %d",
+ dev_dbg(component->dev, "%s: dai->id = %d, tx_port = %d",
__func__, dai->id, tx_port);
if ((tx_port < 0) || (tx_port == 12) || (tx_port >= 14)) {
- dev_err(codec->dev, "%s: Invalid SLIM TX%u port. DAI ID: %d\n",
+ dev_err(component->dev, "%s: Invalid SLIM TX%u port. DAI ID: %d\n",
__func__, tx_port, dai->id);
return -EINVAL;
}
@@ -8358,7 +8635,7 @@
shift = 4;
shift_val = 0x03;
}
- tx_mux_sel = snd_soc_read(codec, tx_port_reg) &
+ tx_mux_sel = snd_soc_component_read32(component, tx_port_reg) &
(shift_val << shift);
tx_mux_sel = tx_mux_sel >> shift;
@@ -8379,15 +8656,16 @@
if (decimator >= 0) {
tx_fs_reg = WCD934X_CDC_TX0_TX_PATH_CTL +
16 * decimator;
- dev_dbg(codec->dev, "%s: set DEC%u (-> SLIM_TX%u) rate to %u\n",
+ dev_dbg(component->dev, "%s: set DEC%u (-> SLIM_TX%u) rate to %u\n",
__func__, decimator, tx_port, sample_rate);
- snd_soc_update_bits(codec, tx_fs_reg, 0x0F, tx_fs_rate);
+ snd_soc_component_update_bits(component, tx_fs_reg,
+ 0x0F, tx_fs_rate);
} else if ((tx_port <= 8) && (tx_mux_sel == 0x01)) {
/* Check if the TX Mux input is RX MIX TXn */
- dev_dbg(codec->dev, "%s: RX_MIX_TX%u going to CDC_IF TX%u\n",
+ dev_dbg(component->dev, "%s: RX_MIX_TX%u going to CDC_IF TX%u\n",
__func__, tx_port, tx_port);
} else {
- dev_err(codec->dev, "%s: ERROR: Invalid decimator: %d\n",
+ dev_err(component->dev, "%s: ERROR: Invalid decimator: %d\n",
__func__, decimator);
return -EINVAL;
}
@@ -8403,16 +8681,16 @@
u32 j;
u16 int_mux_cfg1, int_fs_reg;
u8 int_mux_cfg1_val;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct wcd9xxx_ch *ch;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
list_for_each_entry(ch, &tavil->dai[dai->id].wcd9xxx_ch_list, list) {
int_2_inp = INTn_2_INP_SEL_RX0 + ch->port -
WCD934X_RX_PORT_START_NUMBER;
if ((int_2_inp < INTn_2_INP_SEL_RX0) ||
(int_2_inp > INTn_2_INP_SEL_RX7)) {
- dev_err(codec->dev, "%s: Invalid RX%u port, Dai ID is %d\n",
+ dev_err(component->dev, "%s: Invalid RX%u port, Dai ID is %d\n",
__func__,
(ch->port - WCD934X_RX_PORT_START_NUMBER),
dai->id);
@@ -8426,8 +8704,8 @@
int_mux_cfg1 += 2;
continue;
}
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1) &
- 0x0F;
+ int_mux_cfg1_val = snd_soc_component_read32(component,
+ int_mux_cfg1) & 0x0F;
if (int_mux_cfg1_val == int_2_inp) {
/*
* Ear mix path supports only 48, 96, 192,
@@ -8436,7 +8714,7 @@
if ((j == INTERP_EAR) &&
(rate_reg_val < 0x4 ||
rate_reg_val > 0x7)) {
- dev_err_ratelimited(codec->dev,
+ dev_err_ratelimited(component->dev,
"%s: Invalid rate for AIF_PB DAI(%d)\n",
__func__, dai->id);
return -EINVAL;
@@ -8444,12 +8722,12 @@
int_fs_reg = WCD934X_CDC_RX0_RX_PATH_MIX_CTL +
20 * j;
- dev_dbg(codec->dev, "%s: AIF_PB DAI(%d) connected to INT%u_2\n",
+ dev_dbg(component->dev, "%s: AIF_PB DAI(%d) connected to INT%u_2\n",
__func__, dai->id, j);
- dev_dbg(codec->dev, "%s: set INT%u_2 sample rate to %u\n",
+ dev_dbg(component->dev, "%s: set INT%u_2 sample rate to %u\n",
__func__, j, sample_rate);
- snd_soc_update_bits(codec, int_fs_reg, 0x0F,
- rate_reg_val);
+ snd_soc_component_update_bits(component,
+ int_fs_reg, 0x0F, rate_reg_val);
}
int_mux_cfg1 += 2;
}
@@ -8467,9 +8745,9 @@
u16 int_fs_reg;
u8 int_mux_cfg0_val, int_mux_cfg1_val;
u8 inp0_sel, inp1_sel, inp2_sel;
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
struct wcd9xxx_ch *ch;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
struct tavil_dsd_config *dsd_conf = tavil->dsd_config;
list_for_each_entry(ch, &tavil->dai[dai->id].wcd9xxx_ch_list, list) {
@@ -8477,7 +8755,7 @@
WCD934X_RX_PORT_START_NUMBER;
if ((int_1_mix1_inp < INTn_1_INP_SEL_RX0) ||
(int_1_mix1_inp > INTn_1_INP_SEL_RX7)) {
- dev_err(codec->dev, "%s: Invalid RX%u port, Dai ID is %d\n",
+ dev_err(component->dev, "%s: Invalid RX%u port, Dai ID is %d\n",
__func__,
(ch->port - WCD934X_RX_PORT_START_NUMBER),
dai->id);
@@ -8499,8 +8777,10 @@
}
int_mux_cfg1 = int_mux_cfg0 + 1;
- int_mux_cfg0_val = snd_soc_read(codec, int_mux_cfg0);
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1);
+ int_mux_cfg0_val = snd_soc_component_read32(
+ component, int_mux_cfg0);
+ int_mux_cfg1_val = snd_soc_component_read32(
+ component, int_mux_cfg1);
inp0_sel = int_mux_cfg0_val & 0x0F;
inp1_sel = (int_mux_cfg0_val >> 4) & 0x0F;
inp2_sel = (int_mux_cfg1_val >> 4) & 0x0F;
@@ -8514,7 +8794,7 @@
if ((j == INTERP_EAR || j == INTERP_SPKR1 ||
j == INTERP_SPKR2) &&
(rate_reg_val > 0x7)) {
- dev_err_ratelimited(codec->dev,
+ dev_err_ratelimited(component->dev,
"%s: Invalid rate for AIF_PB DAI(%d)\n",
__func__, dai->id);
return -EINVAL;
@@ -8522,14 +8802,14 @@
int_fs_reg = WCD934X_CDC_RX0_RX_PATH_CTL +
20 * j;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: AIF_PB DAI(%d) connected to INT%u_1\n",
__func__, dai->id, j);
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: set INT%u_1 sample rate to %u\n",
__func__, j, sample_rate);
- snd_soc_update_bits(codec, int_fs_reg, 0x0F,
- rate_reg_val);
+ snd_soc_component_update_bits(component,
+ int_fs_reg, 0x0F, rate_reg_val);
}
int_mux_cfg0 += 2;
}
@@ -8545,7 +8825,7 @@
static int tavil_set_interpolator_rate(struct snd_soc_dai *dai,
u32 sample_rate)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
int rate_val = 0;
int i, ret;
@@ -8556,7 +8836,7 @@
}
}
if ((i == ARRAY_SIZE(sr_val_tbl)) || (rate_val < 0)) {
- dev_err(codec->dev, "%s: Unsupported sample rate: %d\n",
+ dev_err(component->dev, "%s: Unsupported sample rate: %d\n",
__func__, sample_rate);
return -EINVAL;
}
@@ -8583,7 +8863,8 @@
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(dai->codec);
+ struct tavil_priv *tavil =
+ snd_soc_component_get_drvdata(dai->component);
dev_dbg(tavil->dev, "%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n",
__func__, dai->name, dai->id, params_rate(params),
@@ -8599,7 +8880,8 @@
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(dai->codec);
+ struct tavil_priv *tavil =
+ snd_soc_component_get_drvdata(dai->component);
int ret = 0;
dev_dbg(tavil->dev, "%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n",
@@ -8679,18 +8961,20 @@
i2s_reg = WCD934X_DATA_HUB_I2S_2_CTL;
break;
default:
- dev_err(dai->codec->dev, "%s Invalid i2s Id", __func__);
+ dev_err(dai->component->dev, "%s Invalid i2s Id", __func__);
return -EINVAL;
}
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS:
/* CPU is master */
- snd_soc_update_bits(dai->codec, i2s_reg, 0x2, 0x0);
+ snd_soc_component_update_bits(dai->component, i2s_reg,
+ 0x2, 0x0);
break;
case SND_SOC_DAIFMT_CBM_CFM:
/* CPU is slave */
- snd_soc_update_bits(dai->codec, i2s_reg, 0x2, 0x2);
+ snd_soc_component_update_bits(dai->component, i2s_reg,
+ 0x2, 0x2);
break;
default:
return -EINVAL;
@@ -9176,7 +9460,7 @@
/*
* tavil_codec_info_create_codec_entry - creates wcd934x module
* @codec_root: The parent directory
- * @codec: Codec instance
+ * @component: Codec component instance
*
* Creates wcd934x module and version entry under the given
* parent directory.
@@ -9184,21 +9468,21 @@
* Return: 0 on success or negative error code on failure.
*/
int tavil_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct snd_info_entry *version_entry;
struct tavil_priv *tavil;
struct snd_soc_card *card;
- if (!codec_root || !codec)
+ if (!codec_root || !component)
return -EINVAL;
- tavil = snd_soc_codec_get_drvdata(codec);
- card = codec->component.card;
+ tavil = snd_soc_component_get_drvdata(component);
+ card = component->card;
tavil->entry = snd_info_create_subdir(codec_root->module,
"tavil", codec_root);
if (!tavil->entry) {
- dev_dbg(codec->dev, "%s: failed to create wcd934x entry\n",
+ dev_dbg(component->dev, "%s: failed to create wcd934x entry\n",
__func__);
return -ENOMEM;
}
@@ -9207,7 +9491,7 @@
"version",
tavil->entry);
if (!version_entry) {
- dev_dbg(codec->dev, "%s: failed to create wcd934x version entry\n",
+ dev_dbg(component->dev, "%s: failed to create wcd934x version entry\n",
__func__);
return -ENOMEM;
}
@@ -9230,23 +9514,23 @@
/**
* tavil_cdc_mclk_enable - Enable/disable codec mclk
*
- * @codec: codec instance
+ * @component: codec component instance
* @enable: Indicates clk enable or disable
*
* Returns 0 on Success and error on failure
*/
-int tavil_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable)
+int tavil_cdc_mclk_enable(struct snd_soc_component *component, bool enable)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
return __tavil_cdc_mclk_enable(tavil, enable);
}
EXPORT_SYMBOL(tavil_cdc_mclk_enable);
-static int __tavil_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
+static int __tavil_codec_internal_rco_ctrl(struct snd_soc_component *component,
bool enable)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int ret = 0;
if (enable) {
@@ -9257,7 +9541,7 @@
} else {
ret = tavil_cdc_req_mclk_enable(tavil, true);
if (ret) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: mclk_enable failed, err = %d\n",
__func__, ret);
goto done;
@@ -9275,7 +9559,7 @@
}
if (ret) {
- dev_err(codec->dev, "%s: Error in %s RCO\n",
+ dev_err(component->dev, "%s: Error in %s RCO\n",
__func__, (enable ? "enabling" : "disabling"));
ret = -EINVAL;
}
@@ -9286,41 +9570,41 @@
/*
* tavil_codec_internal_rco_ctrl: Enable/Disable codec's RCO clock
- * @codec: Handle to the codec
+ * @component: Handle to the codec
* @enable: Indicates whether clock should be enabled or disabled
*/
-static int tavil_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
+static int tavil_codec_internal_rco_ctrl(struct snd_soc_component *component,
bool enable)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
int ret = 0;
WCD9XXX_V2_BG_CLK_LOCK(tavil->resmgr);
- ret = __tavil_codec_internal_rco_ctrl(codec, enable);
+ ret = __tavil_codec_internal_rco_ctrl(component, enable);
WCD9XXX_V2_BG_CLK_UNLOCK(tavil->resmgr);
return ret;
}
/*
* tavil_cdc_mclk_tx_enable: Enable/Disable codec's clock for TX path
- * @codec: Handle to codec
+ * @component: Handle to codec
* @enable: Indicates whether clock should be enabled or disabled
*/
-int tavil_cdc_mclk_tx_enable(struct snd_soc_codec *codec, bool enable)
+int tavil_cdc_mclk_tx_enable(struct snd_soc_component *component, bool enable)
{
struct tavil_priv *tavil_p;
int ret = 0;
bool clk_mode;
bool clk_internal;
- if (!codec)
+ if (!component)
return -EINVAL;
- tavil_p = snd_soc_codec_get_drvdata(codec);
+ tavil_p = snd_soc_component_get_drvdata(component);
clk_mode = test_bit(CLK_MODE, &tavil_p->status_mask);
clk_internal = test_bit(CLK_INTERNAL, &tavil_p->status_mask);
- dev_dbg(codec->dev, "%s: clkmode: %d, enable: %d, clk_internal: %d\n",
+ dev_dbg(component->dev, "%s: clkmode: %d, enable: %d, clk_internal: %d\n",
__func__, clk_mode, enable, clk_internal);
if (clk_mode || clk_internal) {
@@ -9328,11 +9612,11 @@
wcd_resmgr_enable_master_bias(tavil_p->resmgr);
tavil_dig_core_power_collapse(tavil_p, POWER_RESUME);
tavil_vote_svs(tavil_p, true);
- ret = tavil_codec_internal_rco_ctrl(codec, enable);
+ ret = tavil_codec_internal_rco_ctrl(component, enable);
set_bit(CLK_INTERNAL, &tavil_p->status_mask);
} else {
clear_bit(CLK_INTERNAL, &tavil_p->status_mask);
- tavil_codec_internal_rco_ctrl(codec, enable);
+ tavil_codec_internal_rco_ctrl(component, enable);
tavil_vote_svs(tavil_p, false);
tavil_dig_core_power_collapse(tavil_p, POWER_COLLAPSE);
wcd_resmgr_disable_master_bias(tavil_p->resmgr);
@@ -9478,18 +9762,18 @@
static void tavil_codec_init_reg(struct tavil_priv *priv)
{
- struct snd_soc_codec *codec = priv->codec;
+ struct snd_soc_component *component = priv->component;
u32 i;
for (i = 0; i < ARRAY_SIZE(tavil_codec_reg_init_common_val); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tavil_codec_reg_init_common_val[i].reg,
tavil_codec_reg_init_common_val[i].mask,
tavil_codec_reg_init_common_val[i].val);
if (TAVIL_IS_1_1(priv->wcd9xxx)) {
for (i = 0; i < ARRAY_SIZE(tavil_codec_reg_init_1_1_val); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tavil_codec_reg_init_1_1_val[i].reg,
tavil_codec_reg_init_1_1_val[i].mask,
tavil_codec_reg_init_1_1_val[i].val);
@@ -9561,10 +9845,10 @@
__tavil_cdc_mclk_enable(tavil, false);
}
-static void tavil_slim_interface_init_reg(struct snd_soc_codec *codec)
+static void tavil_slim_interface_init_reg(struct snd_soc_component *component)
{
int i;
- struct tavil_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *priv = snd_soc_component_get_drvdata(component);
for (i = 0; i < WCD9XXX_SLIM_NUM_PORT_REG; i++)
wcd9xxx_interface_reg_write(priv->wcd9xxx,
@@ -9698,7 +9982,7 @@
static int tavil_setup_irqs(struct tavil_priv *tavil)
{
int ret = 0;
- struct snd_soc_codec *codec = tavil->codec;
+ struct snd_soc_component *component = tavil->component;
struct wcd9xxx *wcd9xxx = tavil->wcd9xxx;
struct wcd9xxx_core_resource *core_res =
&wcd9xxx->core_res;
@@ -9706,24 +9990,24 @@
ret = wcd9xxx_request_irq(core_res, WCD9XXX_IRQ_SLIMBUS,
tavil_slimbus_irq, "SLIMBUS Slave", tavil);
if (ret)
- dev_err(codec->dev, "%s: Failed to request irq %d\n", __func__,
- WCD9XXX_IRQ_SLIMBUS);
+ dev_err(component->dev, "%s: Failed to request irq %d\n",
+ __func__, WCD9XXX_IRQ_SLIMBUS);
else
- tavil_slim_interface_init_reg(codec);
+ tavil_slim_interface_init_reg(component);
/* Register for misc interrupts as well */
ret = wcd9xxx_request_irq(core_res, WCD934X_IRQ_MISC,
tavil_misc_irq, "CDC MISC Irq", tavil);
if (ret)
- dev_err(codec->dev, "%s: Failed to request cdc misc irq\n",
+ dev_err(component->dev, "%s: Failed to request cdc misc irq\n",
__func__);
return ret;
}
-static void tavil_init_slim_slave_cfg(struct snd_soc_codec *codec)
+static void tavil_init_slim_slave_cfg(struct snd_soc_component *component)
{
- struct tavil_priv *priv = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *priv = snd_soc_component_get_drvdata(component);
struct afe_param_cdc_slimbus_slave_cfg *cfg;
struct wcd9xxx *wcd9xxx = priv->wcd9xxx;
uint64_t eaddr = 0;
@@ -9738,7 +10022,7 @@
cfg->device_enum_addr_lsw = eaddr & 0xFFFFFFFF;
cfg->device_enum_addr_msw = eaddr >> 32;
- dev_dbg(codec->dev, "%s: slimbus logical address 0x%llx\n",
+ dev_dbg(component->dev, "%s: slimbus logical address 0x%llx\n",
__func__, eaddr);
}
@@ -9773,7 +10057,7 @@
static int tavil_handle_pdata(struct tavil_priv *tavil,
struct wcd9xxx_pdata *pdata)
{
- struct snd_soc_codec *codec = tavil->codec;
+ struct snd_soc_component *component = tavil->component;
u8 mad_dmic_ctl_val;
u8 anc_ctl_value;
u32 def_dmic_rate, dmic_clk_drv;
@@ -9781,7 +10065,7 @@
int rc = 0;
if (!pdata) {
- dev_err(codec->dev, "%s: NULL pdata\n", __func__);
+ dev_err(component->dev, "%s: NULL pdata\n", __func__);
return -ENODEV;
}
@@ -9795,10 +10079,14 @@
rc = -EINVAL;
goto done;
}
- snd_soc_update_bits(codec, WCD934X_ANA_MICB1, 0x3F, vout_ctl_1);
- snd_soc_update_bits(codec, WCD934X_ANA_MICB2, 0x3F, vout_ctl_2);
- snd_soc_update_bits(codec, WCD934X_ANA_MICB3, 0x3F, vout_ctl_3);
- snd_soc_update_bits(codec, WCD934X_ANA_MICB4, 0x3F, vout_ctl_4);
+ snd_soc_component_update_bits(component, WCD934X_ANA_MICB1,
+ 0x3F, vout_ctl_1);
+ snd_soc_component_update_bits(component, WCD934X_ANA_MICB2,
+ 0x3F, vout_ctl_2);
+ snd_soc_component_update_bits(component, WCD934X_ANA_MICB3,
+ 0x3F, vout_ctl_3);
+ snd_soc_component_update_bits(component, WCD934X_ANA_MICB4,
+ 0x3F, vout_ctl_4);
/* Set the DMIC sample rate */
switch (pdata->mclk_rate) {
@@ -9810,7 +10098,7 @@
break;
default:
/* should never happen */
- dev_err(codec->dev, "%s: Invalid mclk_rate %d\n",
+ dev_err(component->dev, "%s: Invalid mclk_rate %d\n",
__func__, pdata->mclk_rate);
rc = -EINVAL;
goto done;
@@ -9818,13 +10106,13 @@
if (pdata->dmic_sample_rate ==
WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED) {
- dev_info(codec->dev, "%s: dmic_rate invalid default = %d\n",
+ dev_info(component->dev, "%s: dmic_rate invalid default = %d\n",
__func__, def_dmic_rate);
pdata->dmic_sample_rate = def_dmic_rate;
}
if (pdata->mad_dmic_sample_rate ==
WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED) {
- dev_info(codec->dev, "%s: mad_dmic_rate invalid default = %d\n",
+ dev_info(component->dev, "%s: mad_dmic_rate invalid default = %d\n",
__func__, def_dmic_rate);
/*
* use dmic_sample_rate as the default for MAD
@@ -9836,7 +10124,7 @@
if (pdata->dmic_clk_drv ==
WCD9XXX_DMIC_CLK_DRIVE_UNDEFINED) {
pdata->dmic_clk_drv = WCD934X_DMIC_CLK_DRIVE_DEFAULT;
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: dmic_clk_strength invalid, default = %d\n",
__func__, pdata->dmic_clk_drv);
}
@@ -9855,29 +10143,30 @@
dmic_clk_drv = 3;
break;
default:
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: invalid dmic_clk_drv %d, using default\n",
__func__, pdata->dmic_clk_drv);
dmic_clk_drv = 0;
break;
}
- snd_soc_update_bits(codec, WCD934X_TEST_DEBUG_PAD_DRVCTL_0,
- 0x0C, dmic_clk_drv << 2);
+ snd_soc_component_update_bits(component,
+ WCD934X_TEST_DEBUG_PAD_DRVCTL_0,
+ 0x0C, dmic_clk_drv << 2);
/*
* Default the DMIC clk rates to mad_dmic_sample_rate,
* whereas, the anc/txfe dmic rates to dmic_sample_rate
* since the anc/txfe are independent of mad block.
*/
- mad_dmic_ctl_val = tavil_get_dmic_clk_val(tavil->codec,
+ mad_dmic_ctl_val = tavil_get_dmic_clk_val(tavil->component,
pdata->mclk_rate,
pdata->mad_dmic_sample_rate);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_DMIC0_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_DMIC0_CTL,
0x0E, mad_dmic_ctl_val << 1);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_DMIC1_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_DMIC1_CTL,
0x0E, mad_dmic_ctl_val << 1);
- snd_soc_update_bits(codec, WCD934X_CPE_SS_DMIC2_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CPE_SS_DMIC2_CTL,
0x0E, mad_dmic_ctl_val << 1);
if (dmic_clk_drv == WCD934X_DMIC_CLK_DIV_2)
@@ -9885,22 +10174,22 @@
else
anc_ctl_value = WCD934X_ANC_DMIC_X2_HALF_RATE;
- snd_soc_update_bits(codec, WCD934X_CDC_ANC0_MODE_2_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CDC_ANC0_MODE_2_CTL,
0x40, anc_ctl_value << 6);
- snd_soc_update_bits(codec, WCD934X_CDC_ANC0_MODE_2_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CDC_ANC0_MODE_2_CTL,
0x20, anc_ctl_value << 5);
- snd_soc_update_bits(codec, WCD934X_CDC_ANC1_MODE_2_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CDC_ANC1_MODE_2_CTL,
0x40, anc_ctl_value << 6);
- snd_soc_update_bits(codec, WCD934X_CDC_ANC1_MODE_2_CTL,
+ snd_soc_component_update_bits(component, WCD934X_CDC_ANC1_MODE_2_CTL,
0x20, anc_ctl_value << 5);
done:
return rc;
}
-static void tavil_cdc_vote_svs(struct snd_soc_codec *codec, bool vote)
+static void tavil_cdc_vote_svs(struct snd_soc_component *component, bool vote)
{
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
return tavil_vote_svs(tavil, vote);
}
@@ -9910,15 +10199,15 @@
.cdc_vote_svs = tavil_cdc_vote_svs,
};
-static int tavil_wdsp_initialize(struct snd_soc_codec *codec)
+static int tavil_wdsp_initialize(struct snd_soc_component *component)
{
struct wcd9xxx *control;
struct tavil_priv *tavil;
struct wcd_dsp_params params;
int ret = 0;
- control = dev_get_drvdata(codec->dev->parent);
- tavil = snd_soc_codec_get_drvdata(codec);
+ control = dev_get_drvdata(component->dev->parent);
+ tavil = snd_soc_component_get_drvdata(component);
params.cb = &cdc_cb;
params.irqs.cpe_ipc1_irq = WCD934X_IRQ_CPE1_INTR;
@@ -9927,7 +10216,7 @@
params.clk_rate = control->mclk_rate;
params.dsp_instance = 0;
- wcd_dsp_cntl_init(codec, ¶ms, &tavil->wdsp_cntl);
+ wcd_dsp_cntl_init(component, ¶ms, &tavil->wdsp_cntl);
if (!tavil->wdsp_cntl) {
dev_err(tavil->dev, "%s: wcd-dsp-control init failed\n",
__func__);
@@ -9939,19 +10228,19 @@
/*
* tavil_soc_get_mbhc: get wcd934x_mbhc handle of corresponding codec
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*
* return wcd934x_mbhc handle or error code in case of failure
*/
-struct wcd934x_mbhc *tavil_soc_get_mbhc(struct snd_soc_codec *codec)
+struct wcd934x_mbhc *tavil_soc_get_mbhc(struct snd_soc_component *component)
{
struct tavil_priv *tavil;
- if (!codec) {
+ if (!component) {
pr_err("%s: Invalid params, NULL codec\n", __func__);
return NULL;
}
- tavil = snd_soc_codec_get_drvdata(codec);
+ tavil = snd_soc_component_get_drvdata(component);
if (!tavil) {
pr_err("%s: Invalid params, NULL tavil\n", __func__);
@@ -9965,12 +10254,12 @@
static void tavil_mclk2_reg_defaults(struct tavil_priv *tavil)
{
int i;
- struct snd_soc_codec *codec = tavil->codec;
+ struct snd_soc_component *component = tavil->component;
if (TAVIL_IS_1_0(tavil->wcd9xxx)) {
/* MCLK2 configuration */
for (i = 0; i < ARRAY_SIZE(tavil_codec_mclk2_1_0_defaults); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tavil_codec_mclk2_1_0_defaults[i].reg,
tavil_codec_mclk2_1_0_defaults[i].mask,
tavil_codec_mclk2_1_0_defaults[i].val);
@@ -9978,7 +10267,7 @@
if (TAVIL_IS_1_1(tavil->wcd9xxx)) {
/* MCLK2 configuration */
for (i = 0; i < ARRAY_SIZE(tavil_codec_mclk2_1_1_defaults); i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
tavil_codec_mclk2_1_1_defaults[i].reg,
tavil_codec_mclk2_1_1_defaults[i].mask,
tavil_codec_mclk2_1_1_defaults[i].val);
@@ -9987,20 +10276,20 @@
static int tavil_device_down(struct wcd9xxx *wcd9xxx)
{
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct tavil_priv *priv;
int count;
int decimator;
int ret;
- codec = (struct snd_soc_codec *)(wcd9xxx->ssr_priv);
- if (!codec->component.card) {
- dev_err(codec->dev, "%s: sound card is not enumerated.\n",
+ component = (struct snd_soc_component *)(wcd9xxx->ssr_priv);
+ if (!component->card) {
+ dev_err(component->dev, "%s: sound card is not enumerated.\n",
__func__);
return -EINVAL;
}
- priv = snd_soc_codec_get_drvdata(codec);
+ priv = snd_soc_component_get_drvdata(component);
for (count = 0; count < NUM_CODEC_DAIS; count++)
priv->dai[count].bus_down_in_recovery = true;
snd_event_notify(priv->dev->parent, SND_EVENT_DOWN);
@@ -10036,7 +10325,7 @@
}
tavil_dsd_reset(priv->dsd_config);
if (!is_snd_event_fwk_enabled())
- snd_soc_card_change_online_state(codec->component.card, 0);
+ snd_soc_card_change_online_state(component->card, 0);
wcd_dsp_ssr_event(priv->wdsp_cntl, WCD_CDC_DOWN_EVENT);
wcd_resmgr_set_sido_input_src_locked(priv->resmgr,
SIDO_SOURCE_INTERNAL);
@@ -10048,19 +10337,19 @@
{
int i, ret = 0;
struct wcd9xxx *control;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct tavil_priv *tavil;
struct wcd9xxx_pdata *pdata;
struct wcd_mbhc *mbhc;
- codec = (struct snd_soc_codec *)(wcd9xxx->ssr_priv);
- if (!codec->component.card) {
+ component = (struct snd_soc_component *)(wcd9xxx->ssr_priv);
+ if (!component->card) {
dev_err(codec->dev, "%s: sound card is not enumerated.\n",
__func__);
return -EINVAL;
}
- tavil = snd_soc_codec_get_drvdata(codec);
- control = dev_get_drvdata(codec->dev->parent);
+ tavil = snd_soc_component_get_drvdata(component);
+ control = dev_get_drvdata(component->dev->parent);
wcd9xxx_set_power_state(tavil->wcd9xxx,
WCD_REGION_POWER_COLLAPSE_REMOVE,
@@ -10073,22 +10362,24 @@
control->slim_slave->laddr;
tavil_slimbus_slave_port_cfg.slave_dev_pgd_la =
control->slim->laddr;
- tavil_init_slim_slave_cfg(codec);
+ tavil_init_slim_slave_cfg(component);
if (!is_snd_event_fwk_enabled())
- snd_soc_card_change_online_state(codec->component.card, 1);
+ snd_soc_card_change_online_state(component->card, 1);
for (i = 0; i < TAVIL_MAX_MICBIAS; i++)
tavil->micb_ref[i] = 0;
- dev_dbg(codec->dev, "%s: MCLK Rate = %x\n",
+ dev_dbg(component->dev, "%s: MCLK Rate = %x\n",
__func__, control->mclk_rate);
if (control->mclk_rate == WCD934X_MCLK_CLK_12P288MHZ)
- snd_soc_update_bits(codec, WCD934X_CODEC_RPM_CLK_MCLK_CFG,
- 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD934X_CODEC_RPM_CLK_MCLK_CFG,
+ 0x03, 0x00);
else if (control->mclk_rate == WCD934X_MCLK_CLK_9P6MHZ)
- snd_soc_update_bits(codec, WCD934X_CODEC_RPM_CLK_MCLK_CFG,
- 0x03, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD934X_CODEC_RPM_CLK_MCLK_CFG,
+ 0x03, 0x01);
tavil_update_reg_defaults(tavil);
wcd_resmgr_post_ssr_v2(tavil->resmgr);
tavil_codec_init_reg(tavil);
@@ -10096,26 +10387,26 @@
tavil_mclk2_reg_defaults(tavil);
__tavil_cdc_mclk_enable(tavil, true);
- regcache_mark_dirty(codec->component.regmap);
- regcache_sync(codec->component.regmap);
+ regcache_mark_dirty(component->regmap);
+ regcache_sync(component->regmap);
__tavil_cdc_mclk_enable(tavil, false);
tavil_update_cpr_defaults(tavil);
- pdata = dev_get_platdata(codec->dev->parent);
+ pdata = dev_get_platdata(component->dev->parent);
ret = tavil_handle_pdata(tavil, pdata);
if (ret < 0)
- dev_err(codec->dev, "%s: invalid pdata\n", __func__);
+ dev_err(component->dev, "%s: invalid pdata\n", __func__);
/* Initialize MBHC module */
mbhc = &tavil->mbhc->wcd_mbhc;
- ret = tavil_mbhc_post_ssr_init(tavil->mbhc, codec);
+ ret = tavil_mbhc_post_ssr_init(tavil->mbhc, component);
if (ret) {
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
goto done;
} else {
- tavil_mbhc_hs_detect(codec, mbhc->mbhc_cfg);
+ tavil_mbhc_hs_detect(component, mbhc->mbhc_cfg);
}
/* DSD initialization */
@@ -10126,7 +10417,7 @@
tavil_cleanup_irqs(tavil);
ret = tavil_setup_irqs(tavil);
if (ret) {
- dev_err(codec->dev, "%s: tavil irq setup failed %d\n",
+ dev_err(component->dev, "%s: tavil irq setup failed %d\n",
__func__, ret);
goto done;
}
@@ -10134,7 +10425,7 @@
if (tavil->swr.ctrl_data && is_snd_event_fwk_enabled())
swrm_wcd_notify(tavil->swr.ctrl_data[0].swr_pdev,
SWR_DEVICE_SSR_UP, NULL);
- tavil_set_spkr_mode(codec, tavil->swr.spkr_mode);
+ tavil_set_spkr_mode(component, tavil->swr.spkr_mode);
/*
* Once the codec initialization is completed, the svs vote
* can be released allowing the codec to go to SVS2.
@@ -10148,29 +10439,32 @@
return ret;
}
-static int tavil_soc_codec_probe(struct snd_soc_codec *codec)
+static int tavil_soc_codec_probe(struct snd_soc_component *component)
{
struct wcd9xxx *control;
struct tavil_priv *tavil;
struct wcd9xxx_pdata *pdata;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
int i, ret;
void *ptr = NULL;
- control = dev_get_drvdata(codec->dev->parent);
+ control = dev_get_drvdata(component->dev->parent);
- dev_info(codec->dev, "%s()\n", __func__);
- tavil = snd_soc_codec_get_drvdata(codec);
+ snd_soc_component_init_regmap(component, control->regmap);
+
+ dev_info(component->dev, "%s()\n", __func__);
+ tavil = snd_soc_component_get_drvdata(component);
tavil->intf_type = wcd9xxx_get_intf_type();
control->dev_down = tavil_device_down;
control->post_reset = tavil_post_reset_cb;
- control->ssr_priv = (void *)codec;
+ control->ssr_priv = (void *)component;
/* Resource Manager post Init */
- ret = wcd_resmgr_post_init(tavil->resmgr, &tavil_resmgr_cb, codec);
+ ret = wcd_resmgr_post_init(tavil->resmgr, &tavil_resmgr_cb, component);
if (ret) {
- dev_err(codec->dev, "%s: wcd resmgr post init failed\n",
+ dev_err(component->dev, "%s: wcd resmgr post init failed\n",
__func__);
goto err;
}
@@ -10179,7 +10473,7 @@
/* Default HPH Mode to Class-H Low HiFi */
tavil->hph_mode = CLS_H_LOHIFI;
- tavil->fw_data = devm_kzalloc(codec->dev, sizeof(*(tavil->fw_data)),
+ tavil->fw_data = devm_kzalloc(component->dev, sizeof(*(tavil->fw_data)),
GFP_KERNEL);
if (!tavil->fw_data)
goto err;
@@ -10190,33 +10484,33 @@
set_bit(WCD9XXX_VBAT_CAL, tavil->fw_data->cal_bit);
ret = wcd_cal_create_hwdep(tavil->fw_data,
- WCD9XXX_CODEC_HWDEP_NODE, codec);
+ WCD9XXX_CODEC_HWDEP_NODE, component);
if (ret < 0) {
- dev_err(codec->dev, "%s hwdep failed %d\n", __func__, ret);
+ dev_err(component->dev, "%s hwdep failed %d\n", __func__, ret);
goto err_hwdep;
}
/* Initialize MBHC module */
- ret = tavil_mbhc_init(&tavil->mbhc, codec, tavil->fw_data);
+ ret = tavil_mbhc_init(&tavil->mbhc, component, tavil->fw_data);
if (ret) {
pr_err("%s: mbhc initialization failed\n", __func__);
goto err_hwdep;
}
- tavil->codec = codec;
+ tavil->component = component;
for (i = 0; i < COMPANDER_MAX; i++)
tavil->comp_enabled[i] = 0;
tavil_codec_init_reg(tavil);
- pdata = dev_get_platdata(codec->dev->parent);
+ pdata = dev_get_platdata(component->dev->parent);
ret = tavil_handle_pdata(tavil, pdata);
if (ret < 0) {
- dev_err(codec->dev, "%s: bad pdata\n", __func__);
+ dev_err(component->dev, "%s: bad pdata\n", __func__);
goto err_hwdep;
}
- ptr = devm_kzalloc(codec->dev, (sizeof(tavil_rx_chs) +
+ ptr = devm_kzalloc(component->dev, (sizeof(tavil_rx_chs) +
sizeof(tavil_tx_chs)), GFP_KERNEL);
if (!ptr) {
ret = -ENOMEM;
@@ -10239,7 +10533,7 @@
control->slim->laddr;
tavil_slimbus_slave_port_cfg.slave_port_mapping[0] =
WCD934X_TX13;
- tavil_init_slim_slave_cfg(codec);
+ tavil_init_slim_slave_cfg(component);
} else {
snd_soc_dapm_new_controls(dapm, tavil_dapm_i2s_widgets,
ARRAY_SIZE(tavil_dapm_i2s_widgets));
@@ -10280,7 +10574,7 @@
tavil_mclk2_reg_defaults(tavil);
/* DSD initialization */
- tavil->dsd_config = tavil_dsd_init(codec);
+ tavil->dsd_config = tavil_dsd_init(component);
if (IS_ERR_OR_NULL(tavil->dsd_config))
dev_dbg(tavil->dev, "%s: DSD init failed\n", __func__);
@@ -10310,7 +10604,7 @@
snd_soc_dapm_sync(dapm);
- tavil_wdsp_initialize(codec);
+ tavil_wdsp_initialize(component);
/*
* Once the codec initialization is completed, the svs vote
@@ -10321,23 +10615,23 @@
return ret;
err_pdata:
- devm_kfree(codec->dev, ptr);
+ devm_kfree(component->dev, ptr);
control->rx_chs = NULL;
control->tx_chs = NULL;
err_hwdep:
- devm_kfree(codec->dev, tavil->fw_data);
+ devm_kfree(component->dev, tavil->fw_data);
tavil->fw_data = NULL;
err:
return ret;
}
-static int tavil_soc_codec_remove(struct snd_soc_codec *codec)
+static void tavil_soc_codec_remove(struct snd_soc_component *component)
{
struct wcd9xxx *control;
- struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
+ struct tavil_priv *tavil = snd_soc_component_get_drvdata(component);
- control = dev_get_drvdata(codec->dev->parent);
- devm_kfree(codec->dev, control->rx_chs);
+ control = dev_get_drvdata(component->dev->parent);
+ devm_kfree(component->dev, control->rx_chs);
/* slimslave deinit in wcd core looks for this value */
control->num_rx_port = 0;
control->num_tx_port = 0;
@@ -10349,31 +10643,22 @@
wcd_dsp_cntl_deinit(&tavil->wdsp_cntl);
/* Deinitialize MBHC module */
- tavil_mbhc_deinit(codec);
+ tavil_mbhc_deinit(component);
tavil->mbhc = NULL;
- return 0;
+ return;
}
-static struct regmap *tavil_get_regmap(struct device *dev)
-{
- struct wcd9xxx *control = dev_get_drvdata(dev->parent);
-
- return control->regmap;
-}
-
-static struct snd_soc_codec_driver soc_codec_dev_tavil = {
+static const struct snd_soc_component_driver soc_codec_dev_tavil = {
+ .name = DRV_NAME,
.probe = tavil_soc_codec_probe,
.remove = tavil_soc_codec_remove,
- .get_regmap = tavil_get_regmap,
- .component_driver = {
- .controls = tavil_snd_controls,
- .num_controls = ARRAY_SIZE(tavil_snd_controls),
- .dapm_widgets = tavil_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(tavil_dapm_widgets),
- .dapm_routes = tavil_audio_map,
- .num_dapm_routes = ARRAY_SIZE(tavil_audio_map),
- },
+ .controls = tavil_snd_controls,
+ .num_controls = ARRAY_SIZE(tavil_snd_controls),
+ .dapm_widgets = tavil_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(tavil_dapm_widgets),
+ .dapm_routes = tavil_audio_map,
+ .num_dapm_routes = ARRAY_SIZE(tavil_audio_map),
};
#ifdef CONFIG_PM
@@ -10946,15 +11231,15 @@
{
struct wcd9xxx *wcd9xxx = dev_get_drvdata(dev);
struct tavil_priv *tavil;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
int count = 0;
if (!wcd9xxx) {
dev_dbg(dev, "%s: wcd9xxx pointer NULL.\n", __func__);
return;
}
- codec = (struct snd_soc_codec *)(wcd9xxx->ssr_priv);
- tavil = snd_soc_codec_get_drvdata(codec);
+ component = (struct snd_soc_component *)(wcd9xxx->ssr_priv);
+ tavil = snd_soc_component_get_drvdata(component);
for (count = 0; count < NUM_CODEC_DAIS; count++)
tavil->dai[count].bus_down_in_recovery = true;
@@ -11074,13 +11359,15 @@
/* Register with soc framework */
if (tavil->intf_type == WCD9XXX_INTERFACE_TYPE_I2C)
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_tavil,
- tavil_i2s_dai,
- ARRAY_SIZE(tavil_i2s_dai));
+ ret = snd_soc_register_component(&pdev->dev,
+ &soc_codec_dev_tavil,
+ tavil_i2s_dai,
+ ARRAY_SIZE(tavil_i2s_dai));
else
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_tavil,
- tavil_slim_dai,
- ARRAY_SIZE(tavil_slim_dai));
+ ret = snd_soc_register_component(&pdev->dev,
+ &soc_codec_dev_tavil,
+ tavil_slim_dai,
+ ARRAY_SIZE(tavil_slim_dai));
if (ret) {
dev_err(&pdev->dev, "%s: Codec registration failed\n",
@@ -11089,7 +11376,8 @@
}
schedule_work(&tavil->tavil_add_child_devices_work);
- ret = snd_event_client_register(pdev->dev.parent, &wcd934x_ssr_ops, NULL);
+ ret = snd_event_client_register(pdev->dev.parent,
+ &wcd934x_ssr_ops, NULL);
if (!ret) {
snd_event_notify(pdev->dev.parent, SND_EVENT_UP);
} else {
@@ -11169,7 +11457,7 @@
mutex_destroy(&tavil->swr.write_mutex);
mutex_destroy(&tavil->swr.clk_mutex);
- snd_soc_unregister_codec(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
clk_put(tavil->wcd_ext_clk);
wcd_resmgr_remove(tavil->resmgr);
devm_kfree(&pdev->dev, tavil);
diff --git a/asoc/codecs/wcd934x/wcd934x.h b/asoc/codecs/wcd934x/wcd934x.h
index 926096a..a14e6eb 100644
--- a/asoc/codecs/wcd934x/wcd934x.h
+++ b/asoc/codecs/wcd934x/wcd934x.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef WCD934X_H
#define WCD934X_H
@@ -135,47 +127,54 @@
};
#if IS_ENABLED(CONFIG_SND_SOC_WCD934X)
-extern void *tavil_get_afe_config(struct snd_soc_codec *codec,
+extern void *tavil_get_afe_config(struct snd_soc_component *component,
enum afe_config_type config_type);
-extern int tavil_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable);
-extern int tavil_cdc_mclk_tx_enable(struct snd_soc_codec *codec, bool enable);
-extern int tavil_set_spkr_mode(struct snd_soc_codec *codec, int mode);
-extern int tavil_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset);
+extern int tavil_cdc_mclk_enable(struct snd_soc_component *component,
+ bool enable);
+extern int tavil_cdc_mclk_tx_enable(struct snd_soc_component *component,
+ bool enable);
+extern int tavil_set_spkr_mode(struct snd_soc_component *component, int mode);
+extern int tavil_set_spkr_gain_offset(struct snd_soc_component *component,
+ int offset);
extern struct wcd_dsp_cntl *tavil_get_wcd_dsp_cntl(struct device *dev);
extern int wcd934x_get_micb_vout_ctl_val(u32 micb_mv);
-extern int tavil_micbias_control(struct snd_soc_codec *codec,
+extern int tavil_micbias_control(struct snd_soc_component *component,
int micb_num,
int req, bool is_dapm);
-extern int tavil_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
+extern int tavil_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int req_volt,
int micb_num);
-extern struct wcd934x_mbhc *tavil_soc_get_mbhc(struct snd_soc_codec *codec);
-extern int tavil_codec_enable_interp_clk(struct snd_soc_codec *codec,
+extern struct wcd934x_mbhc *tavil_soc_get_mbhc(
+ struct snd_soc_component *component);
+extern int tavil_codec_enable_interp_clk(struct snd_soc_component *component,
int event, int intp_idx);
extern struct tavil_dsd_config *tavil_get_dsd_config(
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
extern int tavil_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
#else
-extern void *tavil_get_afe_config(struct snd_soc_codec *codec,
+extern void *tavil_get_afe_config(struct snd_soc_component *component,
enum afe_config_type config_type)
{
return NULL;
}
-extern int tavil_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable)
+extern int tavil_cdc_mclk_enable(struct snd_soc_component *component,
+ bool enable)
{
return 0;
}
-extern int tavil_cdc_mclk_tx_enable(struct snd_soc_codec *codec, bool enable)
+extern int tavil_cdc_mclk_tx_enable(struct snd_soc_component *component,
+ bool enable)
{
return 0;
}
-extern int tavil_set_spkr_mode(struct snd_soc_codec *codec, int mode)
+extern int tavil_set_spkr_mode(struct snd_soc_component *component, int mode)
{
return 0;
}
-extern int tavil_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset)
+extern int tavil_set_spkr_gain_offset(struct snd_soc_component *component,
+ int offset)
{
return 0;
}
@@ -187,35 +186,36 @@
{
return 0;
}
-extern int tavil_micbias_control(struct snd_soc_codec *codec,
+extern int tavil_micbias_control(struct snd_soc_component *component,
int micb_num,
int req, bool is_dapm)
{
return 0;
}
-extern int tavil_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
+extern int tavil_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int req_volt,
int micb_num)
{
return 0;
}
-extern struct wcd934x_mbhc *tavil_soc_get_mbhc(struct snd_soc_codec *codec)
+extern struct wcd934x_mbhc *tavil_soc_get_mbhc(
+ struct snd_soc_component *component)
{
return NULL;
}
-extern int tavil_codec_enable_interp_clk(struct snd_soc_codec *codec,
+extern int tavil_codec_enable_interp_clk(struct snd_soc_component *component,
int event, int intp_idx)
{
return 0;
}
extern struct tavil_dsd_config *tavil_get_dsd_config(
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return NULL;
}
extern int tavil_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return 0;
}
diff --git a/asoc/codecs/wcd934x/wcd934x_irq.h b/asoc/codecs/wcd934x/wcd934x_irq.h
index 1a18be3..7c054ea 100644
--- a/asoc/codecs/wcd934x/wcd934x_irq.h
+++ b/asoc/codecs/wcd934x/wcd934x_irq.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD934X_IRQ_H_
diff --git a/asoc/codecs/wcd937x/internal.h b/asoc/codecs/wcd937x/internal.h
index f1a752b..b416511 100644
--- a/asoc/codecs/wcd937x/internal.h
+++ b/asoc/codecs/wcd937x/internal.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
-
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WCD937X_INTERNAL_H
@@ -38,7 +30,7 @@
struct device *dev;
int variant;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct device_node *rst_np;
struct regmap *regmap;
@@ -168,10 +160,11 @@
WCD937X_NUM_IRQS,
};
-extern struct wcd937x_mbhc *wcd937x_soc_get_mbhc(struct snd_soc_codec *codec);
-extern int wcd937x_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
+extern struct wcd937x_mbhc *wcd937x_soc_get_mbhc(
+ struct snd_soc_component *component);
+extern int wcd937x_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int volt, int micb_num);
extern int wcd937x_get_micb_vout_ctl_val(u32 micb_mv);
-extern int wcd937x_micbias_control(struct snd_soc_codec *codec, int micb_num,
- int req, bool is_dapm);
+extern int wcd937x_micbias_control(struct snd_soc_component *component,
+ int micb_num, int req, bool is_dapm);
#endif
diff --git a/asoc/codecs/wcd937x/wcd937x-mbhc.c b/asoc/codecs/wcd937x/wcd937x-mbhc.c
index 96343b8..5438976 100644
--- a/asoc/codecs/wcd937x/wcd937x-mbhc.c
+++ b/asoc/codecs/wcd937x/wcd937x-mbhc.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -165,19 +157,19 @@
u16 btn7;
};
-static int wcd937x_mbhc_request_irq(struct snd_soc_codec *codec,
+static int wcd937x_mbhc_request_irq(struct snd_soc_component *component,
int irq, irq_handler_t handler,
const char *name, void *data)
{
- struct wcd937x_priv *wcd937x = dev_get_drvdata(codec->dev);
+ struct wcd937x_priv *wcd937x = dev_get_drvdata(component->dev);
return wcd_request_irq(&wcd937x->irq_info, irq, name, handler, data);
}
-static void wcd937x_mbhc_irq_control(struct snd_soc_codec *codec,
+static void wcd937x_mbhc_irq_control(struct snd_soc_component *component,
int irq, bool enable)
{
- struct wcd937x_priv *wcd937x = dev_get_drvdata(codec->dev);
+ struct wcd937x_priv *wcd937x = dev_get_drvdata(component->dev);
if (enable)
wcd_enable_irq(&wcd937x->irq_info, irq);
@@ -185,44 +177,45 @@
wcd_disable_irq(&wcd937x->irq_info, irq);
}
-static int wcd937x_mbhc_free_irq(struct snd_soc_codec *codec,
+static int wcd937x_mbhc_free_irq(struct snd_soc_component *component,
int irq, void *data)
{
- struct wcd937x_priv *wcd937x = dev_get_drvdata(codec->dev);
+ struct wcd937x_priv *wcd937x = dev_get_drvdata(component->dev);
wcd_free_irq(&wcd937x->irq_info, irq, data);
return 0;
}
-static void wcd937x_mbhc_clk_setup(struct snd_soc_codec *codec,
+static void wcd937x_mbhc_clk_setup(struct snd_soc_component *component,
bool enable)
{
if (enable)
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_1,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_1,
0x80, 0x80);
else
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_1,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_1,
0x80, 0x00);
}
-static int wcd937x_mbhc_btn_to_num(struct snd_soc_codec *codec)
+static int wcd937x_mbhc_btn_to_num(struct snd_soc_component *component)
{
- return snd_soc_read(codec, WCD937X_ANA_MBHC_RESULT_3) & 0x7;
+ return snd_soc_component_read32(component, WCD937X_ANA_MBHC_RESULT_3) &
+ 0x7;
}
-static void wcd937x_mbhc_mbhc_bias_control(struct snd_soc_codec *codec,
+static void wcd937x_mbhc_mbhc_bias_control(struct snd_soc_component *component,
bool enable)
{
if (enable)
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_ELECT,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_ELECT,
0x01, 0x01);
else
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_ELECT,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_ELECT,
0x01, 0x00);
}
-static void wcd937x_mbhc_program_btn_thr(struct snd_soc_codec *codec,
+static void wcd937x_mbhc_program_btn_thr(struct snd_soc_component *component,
s16 *btn_low, s16 *btn_high,
int num_btn, bool is_micbias)
{
@@ -230,16 +223,17 @@
int vth;
if (num_btn > WCD_MBHC_DEF_BUTTONS) {
- dev_err(codec->dev, "%s: invalid number of buttons: %d\n",
+ dev_err(component->dev, "%s: invalid number of buttons: %d\n",
__func__, num_btn);
return;
}
for (i = 0; i < num_btn; i++) {
vth = ((btn_high[i] * 2) / 25) & 0x3F;
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_BTN0 + i,
- 0xFC, vth << 2);
- dev_dbg(codec->dev, "%s: btn_high[%d]: %d, vth: %d\n",
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_MBHC_BTN0 + i,
+ 0xFC, vth << 2);
+ dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n",
__func__, i, btn_high[i], vth);
}
}
@@ -270,7 +264,8 @@
u8 val = 0;
if (micb_num == MIC_BIAS_2) {
- val = ((snd_soc_read(mbhc->codec, WCD937X_ANA_MICB2) & 0xC0)
+ val = ((snd_soc_component_read32(mbhc->component,
+ WCD937X_ANA_MICB2) & 0xC0)
>> 6);
if (val == 0x01)
return true;
@@ -278,48 +273,51 @@
return false;
}
-static bool wcd937x_mbhc_hph_pa_on_status(struct snd_soc_codec *codec)
+static bool wcd937x_mbhc_hph_pa_on_status(struct snd_soc_component *component)
{
- return (snd_soc_read(codec, WCD937X_ANA_HPH) & 0xC0) ? true : false;
+ return (snd_soc_component_read32(component, WCD937X_ANA_HPH) & 0xC0) ?
+ true : false;
}
-static void wcd937x_mbhc_hph_l_pull_up_control(struct snd_soc_codec *codec,
- int pull_up_cur)
+static void wcd937x_mbhc_hph_l_pull_up_control(
+ struct snd_soc_component *component,
+ int pull_up_cur)
{
/* Default pull up current to 2uA */
if (pull_up_cur > HS_PULLUP_I_OFF || pull_up_cur < HS_PULLUP_I_3P0_UA ||
pull_up_cur == HS_PULLUP_I_DEFAULT)
pull_up_cur = HS_PULLUP_I_2P0_UA;
- dev_dbg(codec->dev, "%s: HS pull up current:%d\n",
+ dev_dbg(component->dev, "%s: HS pull up current:%d\n",
__func__, pull_up_cur);
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_INT_MECH_DET_CURRENT,
- 0x1F, pull_up_cur);
+ snd_soc_component_update_bits(component,
+ WCD937X_MBHC_NEW_INT_MECH_DET_CURRENT,
+ 0x1F, pull_up_cur);
}
-static int wcd937x_mbhc_request_micbias(struct snd_soc_codec *codec,
+static int wcd937x_mbhc_request_micbias(struct snd_soc_component *component,
int micb_num, int req)
{
int ret = 0;
- ret = wcd937x_micbias_control(codec, micb_num, req, false);
+ ret = wcd937x_micbias_control(component, micb_num, req, false);
return ret;
}
-static void wcd937x_mbhc_micb_ramp_control(struct snd_soc_codec *codec,
+static void wcd937x_mbhc_micb_ramp_control(struct snd_soc_component *component,
bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD937X_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MICB2_RAMP,
0x1C, 0x0C);
- snd_soc_update_bits(codec, WCD937X_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MICB2_RAMP,
0x80, 0x80);
} else {
- snd_soc_update_bits(codec, WCD937X_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MICB2_RAMP,
0x80, 0x00);
- snd_soc_update_bits(codec, WCD937X_ANA_MICB2_RAMP,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MICB2_RAMP,
0x1C, 0x00);
}
}
@@ -329,26 +327,27 @@
{
struct wcd937x_mbhc *wcd937x_mbhc;
struct firmware_cal *hwdep_cal;
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
wcd937x_mbhc = container_of(mbhc, struct wcd937x_mbhc, wcd_mbhc);
- if (!codec) {
- pr_err("%s: NULL codec pointer\n", __func__);
+ if (!component) {
+ pr_err("%s: NULL component pointer\n", __func__);
return NULL;
}
hwdep_cal = wcdcal_get_fw_cal(wcd937x_mbhc->fw_data, type);
if (!hwdep_cal)
- dev_err(codec->dev, "%s: cal not sent by %d\n",
+ dev_err(component->dev, "%s: cal not sent by %d\n",
__func__, type);
return hwdep_cal;
}
-static int wcd937x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_codec *codec,
- int micb_num, bool req_en)
+static int wcd937x_mbhc_micb_ctrl_threshold_mic(
+ struct snd_soc_component *component,
+ int micb_num, bool req_en)
{
- struct wcd937x_pdata *pdata = dev_get_platdata(codec->dev);
+ struct wcd937x_pdata *pdata = dev_get_platdata(component->dev);
int rc, micb_mv;
if (micb_num != MIC_BIAS_2)
@@ -363,7 +362,7 @@
micb_mv = req_en ? WCD_MBHC_THR_HS_MICB_MV : pdata->micbias.micb2_mv;
- rc = wcd937x_mbhc_micb_adjust_voltage(codec, micb_mv, MIC_BIAS_2);
+ rc = wcd937x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2);
return rc;
}
@@ -426,25 +425,25 @@
}
}
-static void wcd937x_mbhc_zdet_ramp(struct snd_soc_codec *codec,
+static void wcd937x_mbhc_zdet_ramp(struct snd_soc_component *component,
struct wcd937x_mbhc_zdet_param *zdet_param,
int32_t *zl, int32_t *zr, s16 *d1_a)
{
- struct wcd937x_priv *wcd937x = dev_get_drvdata(codec->dev);
+ struct wcd937x_priv *wcd937x = dev_get_drvdata(component->dev);
int32_t zdet = 0;
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_ZDET_ANA_CTL, 0x70,
- zdet_param->ldo_ctl << 4);
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_BTN5, 0xFC,
- zdet_param->btn5);
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_BTN6, 0xFC,
- zdet_param->btn6);
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_BTN7, 0xFC,
- zdet_param->btn7);
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_ZDET_ANA_CTL, 0x0F,
- zdet_param->noff);
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_ZDET_RAMP_CTL, 0x0F,
- zdet_param->nshift);
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_ZDET_ANA_CTL,
+ 0x70, zdet_param->ldo_ctl << 4);
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_BTN5, 0xFC,
+ zdet_param->btn5);
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_BTN6, 0xFC,
+ zdet_param->btn6);
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_BTN7, 0xFC,
+ zdet_param->btn7);
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_ZDET_ANA_CTL,
+ 0x0F, zdet_param->noff);
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_ZDET_RAMP_CTL,
+ 0x0F, zdet_param->nshift);
if (!zl)
goto z_right;
@@ -474,17 +473,18 @@
*zr = zdet;
}
-static inline void wcd937x_wcd_mbhc_qfuse_cal(struct snd_soc_codec *codec,
- int32_t *z_val, int flag_l_r)
+static inline void wcd937x_wcd_mbhc_qfuse_cal(
+ struct snd_soc_component *component,
+ int32_t *z_val, int flag_l_r)
{
s16 q1;
int q1_cal;
if (*z_val < (WCD937X_ZDET_VAL_400/1000))
- q1 = snd_soc_read(codec,
+ q1 = snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_23 + (2 * flag_l_r));
else
- q1 = snd_soc_read(codec,
+ q1 = snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_24 + (2 * flag_l_r));
if (q1 & 0x80)
q1_cal = (10000 - ((q1 & 0x7F) * 25));
@@ -497,8 +497,8 @@
static void wcd937x_wcd_mbhc_calc_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
uint32_t *zr)
{
- struct snd_soc_codec *codec = mbhc->codec;
- struct wcd937x_priv *wcd937x = dev_get_drvdata(codec->dev);
+ struct snd_soc_component *component = mbhc->component;
+ struct wcd937x_priv *wcd937x = dev_get_drvdata(component->dev);
s16 reg0, reg1, reg2, reg3, reg4;
int32_t z1L, z1R, z1Ls;
int zMono, z_diff1, z_diff2;
@@ -520,13 +520,15 @@
WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
- reg0 = snd_soc_read(codec, WCD937X_ANA_MBHC_BTN5);
- reg1 = snd_soc_read(codec, WCD937X_ANA_MBHC_BTN6);
- reg2 = snd_soc_read(codec, WCD937X_ANA_MBHC_BTN7);
- reg3 = snd_soc_read(codec, WCD937X_MBHC_CTL_CLK);
- reg4 = snd_soc_read(codec, WCD937X_MBHC_NEW_ZDET_ANA_CTL);
+ reg0 = snd_soc_component_read32(component, WCD937X_ANA_MBHC_BTN5);
+ reg1 = snd_soc_component_read32(component, WCD937X_ANA_MBHC_BTN6);
+ reg2 = snd_soc_component_read32(component, WCD937X_ANA_MBHC_BTN7);
+ reg3 = snd_soc_component_read32(component, WCD937X_MBHC_CTL_CLK);
+ reg4 = snd_soc_component_read32(component,
+ WCD937X_MBHC_NEW_ZDET_ANA_CTL);
- if (snd_soc_read(codec, WCD937X_ANA_MBHC_ELECT) & 0x80) {
+ if (snd_soc_component_read32(component, WCD937X_ANA_MBHC_ELECT) &
+ 0x80) {
is_fsm_disable = true;
regmap_update_bits(wcd937x->regmap,
WCD937X_ANA_MBHC_ELECT, 0x80, 0x00);
@@ -544,7 +546,7 @@
/* First get impedance on Left */
d1 = d1_a[1];
zdet_param_ptr = &zdet_param[1];
- wcd937x_mbhc_zdet_ramp(codec, zdet_param_ptr, &z1L, NULL, d1);
+ wcd937x_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1);
if (!WCD937X_MBHC_IS_SECOND_RAMP_REQUIRED(z1L))
goto left_ch_impedance;
@@ -561,7 +563,7 @@
zdet_param_ptr = &zdet_param[3];
d1 = d1_a[3];
}
- wcd937x_mbhc_zdet_ramp(codec, zdet_param_ptr, &z1L, NULL, d1);
+ wcd937x_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1);
left_ch_impedance:
if ((z1L == WCD937X_ZDET_FLOATING_IMPEDANCE) ||
@@ -571,13 +573,13 @@
d1 = d1_a[1];
} else {
*zl = z1L/1000;
- wcd937x_wcd_mbhc_qfuse_cal(codec, zl, 0);
+ wcd937x_wcd_mbhc_qfuse_cal(component, zl, 0);
}
- dev_dbg(codec->dev, "%s: impedance on HPH_L = %d(ohms)\n",
+ dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n",
__func__, *zl);
/* Start of right impedance ramp and calculation */
- wcd937x_mbhc_zdet_ramp(codec, zdet_param_ptr, NULL, &z1R, d1);
+ wcd937x_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1);
if (WCD937X_MBHC_IS_SECOND_RAMP_REQUIRED(z1R)) {
if (((z1R > WCD937X_ZDET_VAL_1200) &&
(zdet_param_ptr->noff == 0x6)) ||
@@ -595,7 +597,8 @@
zdet_param_ptr = &zdet_param[3];
d1 = d1_a[3];
}
- wcd937x_mbhc_zdet_ramp(codec, zdet_param_ptr, NULL, &z1R, d1);
+ wcd937x_mbhc_zdet_ramp(component, zdet_param_ptr, NULL,
+ &z1R, d1);
}
right_ch_impedance:
if ((z1R == WCD937X_ZDET_FLOATING_IMPEDANCE) ||
@@ -603,15 +606,15 @@
*zr = WCD937X_ZDET_FLOATING_IMPEDANCE;
} else {
*zr = z1R/1000;
- wcd937x_wcd_mbhc_qfuse_cal(codec, zr, 1);
+ wcd937x_wcd_mbhc_qfuse_cal(component, zr, 1);
}
- dev_dbg(codec->dev, "%s: impedance on HPH_R = %d(ohms)\n",
+ dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n",
__func__, *zr);
/* Mono/stereo detection */
if ((*zl == WCD937X_ZDET_FLOATING_IMPEDANCE) &&
(*zr == WCD937X_ZDET_FLOATING_IMPEDANCE)) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: plug type is invalid or extension cable\n",
__func__);
goto zdet_complete;
@@ -620,40 +623,46 @@
(*zr == WCD937X_ZDET_FLOATING_IMPEDANCE) ||
((*zl < WCD_MONO_HS_MIN_THR) && (*zr > WCD_MONO_HS_MIN_THR)) ||
((*zl > WCD_MONO_HS_MIN_THR) && (*zr < WCD_MONO_HS_MIN_THR))) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: Mono plug type with one ch floating or shorted to GND\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_MONO;
goto zdet_complete;
}
- snd_soc_update_bits(codec, WCD937X_HPH_R_ATEST, 0x02, 0x02);
- snd_soc_update_bits(codec, WCD937X_HPH_PA_CTL2, 0x40, 0x01);
+ snd_soc_component_update_bits(component, WCD937X_HPH_R_ATEST,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, WCD937X_HPH_PA_CTL2,
+ 0x40, 0x01);
if (*zl < (WCD937X_ZDET_VAL_32/1000))
- wcd937x_mbhc_zdet_ramp(codec, &zdet_param[0], &z1Ls, NULL, d1);
+ wcd937x_mbhc_zdet_ramp(component, &zdet_param[0], &z1Ls,
+ NULL, d1);
else
- wcd937x_mbhc_zdet_ramp(codec, &zdet_param[1], &z1Ls, NULL, d1);
- snd_soc_update_bits(codec, WCD937X_HPH_PA_CTL2, 0x40, 0x00);
- snd_soc_update_bits(codec, WCD937X_HPH_R_ATEST, 0x02, 0x00);
+ wcd937x_mbhc_zdet_ramp(component, &zdet_param[1], &z1Ls,
+ NULL, d1);
+ snd_soc_component_update_bits(component, WCD937X_HPH_PA_CTL2,
+ 0x40, 0x00);
+ snd_soc_component_update_bits(component, WCD937X_HPH_R_ATEST,
+ 0x02, 0x00);
z1Ls /= 1000;
- wcd937x_wcd_mbhc_qfuse_cal(codec, &z1Ls, 0);
+ wcd937x_wcd_mbhc_qfuse_cal(component, &z1Ls, 0);
/* Parallel of left Z and 9 ohm pull down resistor */
zMono = ((*zl) * 9) / ((*zl) + 9);
z_diff1 = (z1Ls > zMono) ? (z1Ls - zMono) : (zMono - z1Ls);
z_diff2 = ((*zl) > z1Ls) ? ((*zl) - z1Ls) : (z1Ls - (*zl));
if ((z_diff1 * (*zl + z1Ls)) > (z_diff2 * (z1Ls + zMono))) {
- dev_dbg(codec->dev, "%s: stereo plug type detected\n",
+ dev_dbg(component->dev, "%s: stereo plug type detected\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_STEREO;
} else {
- dev_dbg(codec->dev, "%s: MONO plug type detected\n",
+ dev_dbg(component->dev, "%s: MONO plug type detected\n",
__func__);
mbhc->hph_type = WCD_MBHC_HPH_MONO;
}
zdet_complete:
- snd_soc_write(codec, WCD937X_ANA_MBHC_BTN5, reg0);
- snd_soc_write(codec, WCD937X_ANA_MBHC_BTN6, reg1);
- snd_soc_write(codec, WCD937X_ANA_MBHC_BTN7, reg2);
+ snd_soc_component_write(component, WCD937X_ANA_MBHC_BTN5, reg0);
+ snd_soc_component_write(component, WCD937X_ANA_MBHC_BTN6, reg1);
+ snd_soc_component_write(component, WCD937X_ANA_MBHC_BTN7, reg2);
/* Turn on 100k pull down on HPHL */
regmap_update_bits(wcd937x->regmap,
WCD937X_ANA_MBHC_MECH, 0x01, 0x01);
@@ -663,97 +672,98 @@
regmap_update_bits(wcd937x->regmap,
WCD937X_ANA_MBHC_MECH, 0x80, 0x80);
- snd_soc_write(codec, WCD937X_MBHC_NEW_ZDET_ANA_CTL, reg4);
- snd_soc_write(codec, WCD937X_MBHC_CTL_CLK, reg3);
+ snd_soc_component_write(component, WCD937X_MBHC_NEW_ZDET_ANA_CTL, reg4);
+ snd_soc_component_write(component, WCD937X_MBHC_CTL_CLK, reg3);
if (is_fsm_disable)
regmap_update_bits(wcd937x->regmap,
WCD937X_ANA_MBHC_ELECT, 0x80, 0x80);
}
-static void wcd937x_mbhc_gnd_det_ctrl(struct snd_soc_codec *codec, bool enable)
+static void wcd937x_mbhc_gnd_det_ctrl(struct snd_soc_component *component,
+ bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_MECH,
0x02, 0x02);
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_MECH,
0x40, 0x40);
} else {
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_MECH,
0x40, 0x00);
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_MECH,
0x02, 0x00);
}
}
-static void wcd937x_mbhc_hph_pull_down_ctrl(struct snd_soc_codec *codec,
+static void wcd937x_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component,
bool enable)
{
if (enable) {
- snd_soc_update_bits(codec, WCD937X_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD937X_HPH_PA_CTL2,
0x40, 0x40);
- snd_soc_update_bits(codec, WCD937X_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD937X_HPH_PA_CTL2,
0x10, 0x10);
} else {
- snd_soc_update_bits(codec, WCD937X_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD937X_HPH_PA_CTL2,
0x40, 0x00);
- snd_soc_update_bits(codec, WCD937X_HPH_PA_CTL2,
+ snd_soc_component_update_bits(component, WCD937X_HPH_PA_CTL2,
0x10, 0x00);
}
}
static void wcd937x_mbhc_moisture_config(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
if ((mbhc->moist_rref == R_OFF) ||
(mbhc->mbhc_cfg->enable_usbc_analog)) {
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_2,
0x0C, R_OFF << 2);
return;
}
/* Do not enable moisture detection if jack type is NC */
if (!mbhc->hphl_swh) {
- dev_dbg(codec->dev, "%s: disable moisture detection for NC\n",
+ dev_dbg(component->dev, "%s: disable moisture detection for NC\n",
__func__);
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_2,
0x0C, R_OFF << 2);
return;
}
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_2,
0x0C, mbhc->moist_rref << 2);
}
static void wcd937x_mbhc_moisture_detect_en(struct wcd_mbhc *mbhc, bool enable)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
if (enable)
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_2,
0x0C, mbhc->moist_rref << 2);
else
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_2,
0x0C, R_OFF << 2);
}
static bool wcd937x_mbhc_get_moisture_status(struct wcd_mbhc *mbhc)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
bool ret = false;
if ((mbhc->moist_rref == R_OFF) ||
(mbhc->mbhc_cfg->enable_usbc_analog)) {
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_2,
0x0C, R_OFF << 2);
goto done;
}
/* Do not enable moisture detection if jack type is NC */
if (!mbhc->hphl_swh) {
- dev_dbg(codec->dev, "%s: disable moisture detection for NC\n",
+ dev_dbg(component->dev, "%s: disable moisture detection for NC\n",
__func__);
- snd_soc_update_bits(codec, WCD937X_MBHC_NEW_CTL_2,
+ snd_soc_component_update_bits(component, WCD937X_MBHC_NEW_CTL_2,
0x0C, R_OFF << 2);
goto done;
}
@@ -761,12 +771,13 @@
/* If moisture_en is already enabled, then skip to plug type
* detection.
*/
- if ((snd_soc_read(codec, WCD937X_MBHC_NEW_CTL_2) & 0x0C))
+ if ((snd_soc_component_read32(component, WCD937X_MBHC_NEW_CTL_2) &
+ 0x0C))
goto done;
wcd937x_mbhc_moisture_detect_en(mbhc, true);
/* Read moisture comparator status */
- ret = ((snd_soc_read(codec, WCD937X_MBHC_NEW_FSM_STATUS)
+ ret = ((snd_soc_component_read32(component, WCD937X_MBHC_NEW_FSM_STATUS)
& 0x20) ? 0 : 1);
done:
@@ -777,9 +788,9 @@
static void wcd937x_mbhc_moisture_polling_ctrl(struct wcd_mbhc *mbhc,
bool enable)
{
- struct snd_soc_codec *codec = mbhc->codec;
+ struct snd_soc_component *component = mbhc->component;
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_MBHC_NEW_INT_MOISTURE_DET_POLLING_CTRL,
0x04, (enable << 2));
}
@@ -813,19 +824,22 @@
static int wcd937x_get_hph_type(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wcd937x_mbhc *wcd937x_mbhc = wcd937x_soc_get_mbhc(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wcd937x_mbhc *wcd937x_mbhc = wcd937x_soc_get_mbhc(component);
struct wcd_mbhc *mbhc;
if (!wcd937x_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
mbhc = &wcd937x_mbhc->wcd_mbhc;
ucontrol->value.integer.value[0] = (u32) mbhc->hph_type;
- dev_dbg(codec->dev, "%s: hph_type = %u\n", __func__, mbhc->hph_type);
+ dev_dbg(component->dev, "%s: hph_type = %u\n", __func__,
+ mbhc->hph_type);
return 0;
}
@@ -836,18 +850,21 @@
uint32_t zl, zr;
bool hphr;
struct soc_multi_mixer_control *mc;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wcd937x_mbhc *wcd937x_mbhc = wcd937x_soc_get_mbhc(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wcd937x_mbhc *wcd937x_mbhc = wcd937x_soc_get_mbhc(component);
if (!wcd937x_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
mc = (struct soc_multi_mixer_control *)(kcontrol->private_value);
hphr = mc->shift;
wcd_mbhc_get_impedance(&wcd937x_mbhc->wcd_mbhc, &zl, &zr);
- dev_dbg(codec->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr);
+ dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__,
+ zl, zr);
ucontrol->value.integer.value[0] = hphr ? zr : zl;
return 0;
@@ -891,22 +908,22 @@
/*
* wcd937x_mbhc_hs_detect: starts mbhc insertion/removal functionality
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @mbhc_cfg: handle to mbhc configuration structure
* return 0 if mbhc_start is success or error code in case of failure
*/
-int wcd937x_mbhc_hs_detect(struct snd_soc_codec *codec,
+int wcd937x_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg)
{
struct wcd937x_priv *wcd937x = NULL;
struct wcd937x_mbhc *wcd937x_mbhc = NULL;
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
- wcd937x = snd_soc_codec_get_drvdata(codec);
+ wcd937x = snd_soc_component_get_drvdata(component);
if (!wcd937x) {
pr_err("%s: wcd937x is NULL\n", __func__);
return -EINVAL;
@@ -914,7 +931,8 @@
wcd937x_mbhc = wcd937x->mbhc;
if (!wcd937x_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return -EINVAL;
}
@@ -924,19 +942,19 @@
/*
* wcd937x_mbhc_hs_detect_exit: stop mbhc insertion/removal functionality
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*/
-void wcd937x_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
+void wcd937x_mbhc_hs_detect_exit(struct snd_soc_component *component)
{
struct wcd937x_priv *wcd937x = NULL;
struct wcd937x_mbhc *wcd937x_mbhc = NULL;
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
return;
}
- wcd937x = snd_soc_codec_get_drvdata(codec);
+ wcd937x = snd_soc_component_get_drvdata(component);
if (!wcd937x) {
pr_err("%s: wcd937x is NULL\n", __func__);
return;
@@ -944,7 +962,8 @@
wcd937x_mbhc = wcd937x->mbhc;
if (!wcd937x_mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized!\n", __func__);
+ dev_err(component->dev, "%s: mbhc not initialized!\n",
+ __func__);
return;
}
wcd_mbhc_stop(&wcd937x_mbhc->wcd_mbhc);
@@ -955,17 +974,17 @@
* wcd937x_mbhc_post_ssr_init: initialize mbhc for
* wcd937x post subsystem restart
* @mbhc: poniter to wcd937x_mbhc structure
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*
* return 0 if mbhc_init is success or error code in case of failure
*/
int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
int ret = 0;
struct wcd_mbhc *wcd_mbhc = NULL;
- if (!mbhc || !codec)
+ if (!mbhc || !component)
return -EINVAL;
wcd_mbhc = &mbhc->wcd_mbhc;
@@ -974,14 +993,14 @@
return -EINVAL;
}
- wcd937x_mbhc_hs_detect_exit(codec);
+ wcd937x_mbhc_hs_detect_exit(component);
wcd_mbhc_deinit(wcd_mbhc);
- snd_soc_update_bits(codec, WCD937X_ANA_MBHC_MECH,
+ snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_MECH,
0x20, 0x20);
- ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb, &intr_ids,
+ ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb, &intr_ids,
wcd_mbhc_registers, WCD937X_ZDET_SUPPORTED);
if (ret) {
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
goto done;
}
@@ -994,24 +1013,25 @@
/*
* wcd937x_mbhc_init: initialize mbhc for wcd937x
* @mbhc: poniter to wcd937x_mbhc struct pointer to store the configs
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @fw_data: handle to firmware data
*
* return 0 if mbhc_init is success or error code in case of failure
*/
-int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc, struct snd_soc_codec *codec,
- struct fw_info *fw_data)
+int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc,
+ struct snd_soc_component *component,
+ struct fw_info *fw_data)
{
struct wcd937x_mbhc *wcd937x_mbhc = NULL;
struct wcd_mbhc *wcd_mbhc = NULL;
int ret = 0;
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
- wcd937x_mbhc = devm_kzalloc(codec->dev, sizeof(struct wcd937x_mbhc),
+ wcd937x_mbhc = devm_kzalloc(component->dev, sizeof(struct wcd937x_mbhc),
GFP_KERNEL);
if (!wcd937x_mbhc)
return -ENOMEM;
@@ -1029,43 +1049,43 @@
/* Setting default mbhc detection logic to ADC */
wcd_mbhc->mbhc_detection_logic = WCD_DETECTION_ADC;
- ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb,
+ ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb,
&intr_ids, wcd_mbhc_registers,
WCD937X_ZDET_SUPPORTED);
if (ret) {
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
goto err;
}
(*mbhc) = wcd937x_mbhc;
- snd_soc_add_codec_controls(codec, impedance_detect_controls,
+ snd_soc_add_component_controls(component, impedance_detect_controls,
ARRAY_SIZE(impedance_detect_controls));
- snd_soc_add_codec_controls(codec, hph_type_detect_controls,
+ snd_soc_add_component_controls(component, hph_type_detect_controls,
ARRAY_SIZE(hph_type_detect_controls));
return 0;
err:
- devm_kfree(codec->dev, wcd937x_mbhc);
+ devm_kfree(component->dev, wcd937x_mbhc);
return ret;
}
EXPORT_SYMBOL(wcd937x_mbhc_init);
/*
* wcd937x_mbhc_deinit: deinitialize mbhc for wcd937x
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
*/
-void wcd937x_mbhc_deinit(struct snd_soc_codec *codec)
+void wcd937x_mbhc_deinit(struct snd_soc_component *component)
{
struct wcd937x_priv *wcd937x;
struct wcd937x_mbhc *wcd937x_mbhc;
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
return;
}
- wcd937x = snd_soc_codec_get_drvdata(codec);
+ wcd937x = snd_soc_component_get_drvdata(component);
if (!wcd937x) {
pr_err("%s: wcd937x is NULL\n", __func__);
return;
@@ -1074,7 +1094,7 @@
wcd937x_mbhc = wcd937x->mbhc;
if (wcd937x_mbhc) {
wcd_mbhc_deinit(&wcd937x_mbhc->wcd_mbhc);
- devm_kfree(codec->dev, wcd937x_mbhc);
+ devm_kfree(component->dev, wcd937x_mbhc);
}
}
EXPORT_SYMBOL(wcd937x_mbhc_deinit);
diff --git a/asoc/codecs/wcd937x/wcd937x-mbhc.h b/asoc/codecs/wcd937x/wcd937x-mbhc.h
index 554cb88..d7bfb16 100644
--- a/asoc/codecs/wcd937x/wcd937x-mbhc.h
+++ b/asoc/codecs/wcd937x/wcd937x-mbhc.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD937X_MBHC_H__
#define __WCD937X_MBHC_H__
@@ -21,36 +13,37 @@
#if IS_ENABLED(CONFIG_SND_SOC_WCD937X)
extern int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc,
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
struct fw_info *fw_data);
-extern void wcd937x_mbhc_hs_detect_exit(struct snd_soc_codec *codec);
-extern int wcd937x_mbhc_hs_detect(struct snd_soc_codec *codec,
+extern void wcd937x_mbhc_hs_detect_exit(struct snd_soc_component *component);
+extern int wcd937x_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg);
-extern void wcd937x_mbhc_deinit(struct snd_soc_codec *codec);
+extern void wcd937x_mbhc_deinit(struct snd_soc_component *component);
extern int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
extern int wcd937x_mbhc_get_impedance(struct wcd937x_mbhc *wcd937x_mbhc,
uint32_t *zl, uint32_t *zr);
#else
static inline int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc,
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
struct fw_info *fw_data)
{
return 0;
}
-static inline void wcd937x_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
+static inline void wcd937x_mbhc_hs_detect_exit(
+ struct snd_soc_component *component)
{
}
-static inline int wcd937x_mbhc_hs_detect(struct snd_soc_codec *codec,
+static inline int wcd937x_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg)
{
return 0;
}
-static inline void wcd937x_mbhc_deinit(struct snd_soc_codec *codec)
+static inline void wcd937x_mbhc_deinit(struct snd_soc_component *component)
{
}
static inline int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return 0;
}
diff --git a/asoc/codecs/wcd937x/wcd937x-registers.h b/asoc/codecs/wcd937x/wcd937x-registers.h
index 1f89f80..c7ee8e6 100644
--- a/asoc/codecs/wcd937x/wcd937x-registers.h
+++ b/asoc/codecs/wcd937x/wcd937x-registers.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WCD937X_REGISTERS_H
diff --git a/asoc/codecs/wcd937x/wcd937x-regmap.c b/asoc/codecs/wcd937x/wcd937x-regmap.c
index 0d15c10..205dfe4 100644
--- a/asoc/codecs/wcd937x/wcd937x-regmap.c
+++ b/asoc/codecs/wcd937x/wcd937x-regmap.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/regmap.h>
diff --git a/asoc/codecs/wcd937x/wcd937x-tables.c b/asoc/codecs/wcd937x/wcd937x-tables.c
index 5baf773..a1f6d10 100644
--- a/asoc/codecs/wcd937x/wcd937x-tables.c
+++ b/asoc/codecs/wcd937x/wcd937x-tables.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018 , The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/types.h>
diff --git a/asoc/codecs/wcd937x/wcd937x.c b/asoc/codecs/wcd937x/wcd937x.c
index 27e3cfa..fbd553a 100644
--- a/asoc/codecs/wcd937x/wcd937x.c
+++ b/asoc/codecs/wcd937x/wcd937x.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -33,6 +25,8 @@
#include <dt-bindings/sound/audio-codec-port-types.h>
#include "../msm-cdc-supply.h"
+#define DRV_NAME "wcd937x_codec"
+
#define WCD9370_VARIANT 0
#define WCD9375_VARIANT 5
@@ -91,7 +85,6 @@
.mask_base = WCD937X_DIGITAL_INTR_MASK_0,
.ack_base = WCD937X_DIGITAL_INTR_CLEAR_0,
.use_ack = 1,
- .clear_ack = 1,
.type_base = WCD937X_DIGITAL_INTR_LEVEL_0,
.runtime_pm = false,
.handle_post_irq = wcd937x_handle_post_irq,
@@ -112,35 +105,48 @@
return IRQ_HANDLED;
}
-static int wcd937x_init_reg(struct snd_soc_codec *codec)
+static int wcd937x_init_reg(struct snd_soc_component *component)
{
- snd_soc_update_bits(codec, WCD937X_SLEEP_CTL, 0x0E, 0x0E);
- snd_soc_update_bits(codec, WCD937X_SLEEP_CTL, 0x80, 0x80);
+ snd_soc_component_update_bits(component, WCD937X_SLEEP_CTL,
+ 0x0E, 0x0E);
+ snd_soc_component_update_bits(component, WCD937X_SLEEP_CTL,
+ 0x80, 0x80);
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, WCD937X_SLEEP_CTL, 0x40, 0x40);
+ snd_soc_component_update_bits(component, WCD937X_SLEEP_CTL,
+ 0x40, 0x40);
usleep_range(1000, 1010);
- snd_soc_update_bits(codec, WCD937X_LDORXTX_CONFIG, 0x10, 0x00);
- snd_soc_update_bits(codec, WCD937X_BIAS_VBG_FINE_ADJ, 0xF0, 0x80);
- snd_soc_update_bits(codec, WCD937X_ANA_BIAS, 0x80, 0x80);
- snd_soc_update_bits(codec, WCD937X_ANA_BIAS, 0x40, 0x40);
+ snd_soc_component_update_bits(component, WCD937X_LDORXTX_CONFIG,
+ 0x10, 0x00);
+ snd_soc_component_update_bits(component, WCD937X_BIAS_VBG_FINE_ADJ,
+ 0xF0, 0x80);
+ snd_soc_component_update_bits(component, WCD937X_ANA_BIAS,
+ 0x80, 0x80);
+ snd_soc_component_update_bits(component, WCD937X_ANA_BIAS,
+ 0x40, 0x40);
usleep_range(10000, 10010);
- snd_soc_update_bits(codec, WCD937X_ANA_BIAS, 0x40, 0x00);
- snd_soc_update_bits(codec, WCD937X_HPH_OCP_CTL, 0xFF, 0x3A);
- snd_soc_update_bits(codec, WCD937X_RX_OCP_CTL, 0x0F, 0x02);
- snd_soc_update_bits(codec, WCD937X_HPH_R_TEST, 0x01, 0x01);
- snd_soc_update_bits(codec, WCD937X_HPH_L_TEST, 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD937X_ANA_BIAS,
+ 0x40, 0x00);
+ snd_soc_component_update_bits(component, WCD937X_HPH_OCP_CTL,
+ 0xFF, 0x3A);
+ snd_soc_component_update_bits(component, WCD937X_RX_OCP_CTL,
+ 0x0F, 0x02);
+ snd_soc_component_update_bits(component, WCD937X_HPH_R_TEST,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component, WCD937X_HPH_L_TEST,
+ 0x01, 0x01);
return 0;
}
-static int wcd937x_set_port_params(struct snd_soc_codec *codec, u8 slv_prt_type,
- u8 *port_id, u8 *num_ch, u8 *ch_mask, u32 *ch_rate,
- u8 *port_type, u8 path)
+static int wcd937x_set_port_params(struct snd_soc_component *component,
+ u8 slv_prt_type, u8 *port_id, u8 *num_ch,
+ u8 *ch_mask, u32 *ch_rate,
+ u8 *port_type, u8 path)
{
int i, j;
u8 num_ports = 0;
struct codec_port_info (*map)[MAX_PORT][MAX_CH_PER_PORT] = NULL;
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
switch (path) {
case CODEC_RX:
@@ -161,7 +167,7 @@
}
found:
if (i > num_ports || j == MAX_CH_PER_PORT) {
- dev_err(codec->dev, "%s Failed to find slave port for type %u\n",
+ dev_err(component->dev, "%s Failed to find slave port for type %u\n",
__func__, slv_prt_type);
return -EINVAL;
}
@@ -248,10 +254,10 @@
return ret;
}
-static int wcd937x_tx_connect_port(struct snd_soc_codec *codec,
+static int wcd937x_tx_connect_port(struct snd_soc_component *component,
u8 slv_port_type, u8 enable)
{
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
u8 port_id;
u8 num_ch;
u8 ch_mask;
@@ -260,7 +266,7 @@
u8 num_port = 1;
int ret = 0;
- ret = wcd937x_set_port_params(codec, slv_port_type, &port_id,
+ ret = wcd937x_set_port_params(component, slv_port_type, &port_id,
&num_ch, &ch_mask, &ch_rate,
&port_type, CODEC_TX);
@@ -277,10 +283,10 @@
return ret;
}
-static int wcd937x_rx_connect_port(struct snd_soc_codec *codec,
+static int wcd937x_rx_connect_port(struct snd_soc_component *component,
u8 slv_port_type, u8 enable)
{
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
u8 port_id;
u8 num_ch;
u8 ch_mask;
@@ -289,7 +295,7 @@
u8 num_port = 1;
int ret = 0;
- ret = wcd937x_set_port_params(codec, slv_port_type, &port_id,
+ ret = wcd937x_set_port_params(component, slv_port_type, &port_id,
&num_ch, &ch_mask, &ch_rate,
&port_type, CODEC_RX);
@@ -306,33 +312,34 @@
return ret;
}
-static int wcd937x_rx_clk_enable(struct snd_soc_codec *codec)
+static int wcd937x_rx_clk_enable(struct snd_soc_component *component)
{
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
if (wcd937x->rx_clk_cnt == 0) {
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x08, 0x08);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD937X_ANA_RX_SUPPLIES, 0x01, 0x01);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_RX0_CTL,
- 0x40, 0x00);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_RX1_CTL,
- 0x40, 0x00);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_RX2_CTL,
- 0x40, 0x00);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL, 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_RX_SUPPLIES, 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_RX0_CTL, 0x40, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_RX1_CTL, 0x40, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_RX2_CTL, 0x40, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL, 0x02, 0x02);
}
wcd937x->rx_clk_cnt++;
return 0;
}
-static int wcd937x_rx_clk_disable(struct snd_soc_codec *codec)
+static int wcd937x_rx_clk_disable(struct snd_soc_component *component)
{
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
if (wcd937x->rx_clk_cnt == 0) {
dev_dbg(wcd937x->dev, "%s:clk already disabled\n", __func__);
@@ -340,30 +347,33 @@
}
wcd937x->rx_clk_cnt--;
if (wcd937x->rx_clk_cnt == 0) {
- snd_soc_update_bits(codec, WCD937X_ANA_RX_SUPPLIES, 0x01, 0x00);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x02, 0x00);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_RX_SUPPLIES, 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
+ 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
+ 0x01, 0x00);
}
return 0;
}
/*
- * wcd937x_soc_get_mbhc: get wcd937x_mbhc handle of corresponding codec
- * @codec: handle to snd_soc_codec *
+ * wcd937x_soc_get_mbhc: get wcd937x_mbhc handle of corresponding component
+ * @component: handle to snd_soc_component *
*
* return wcd937x_mbhc handle or error code in case of failure
*/
-struct wcd937x_mbhc *wcd937x_soc_get_mbhc(struct snd_soc_codec *codec)
+struct wcd937x_mbhc *wcd937x_soc_get_mbhc(struct snd_soc_component *component)
{
struct wcd937x_priv *wcd937x;
- if (!codec) {
- pr_err("%s: Invalid params, NULL codec\n", __func__);
+ if (!component) {
+ pr_err("%s: Invalid params, NULL component\n", __func__);
return NULL;
}
- wcd937x = snd_soc_codec_get_drvdata(codec);
+ wcd937x = snd_soc_component_get_drvdata(component);
if (!wcd937x) {
pr_err("%s: Invalid params, NULL tavil\n", __func__);
@@ -378,44 +388,48 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int hph_mode = wcd937x->hph_mode;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd937x_rx_clk_enable(codec);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_HPH_GAIN_CTL,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD937X_HPH_RDAC_CLK_CTL1,
- 0x80, 0x00);
+ wcd937x_rx_clk_enable(component);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
+ 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_HPH_GAIN_CTL,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD937X_HPH_RDAC_CLK_CTL1,
+ 0x80, 0x00);
set_bit(HPH_COMP_DELAY, &wcd937x->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
0x0F, 0x02);
else if (hph_mode == CLS_H_LOHIFI)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
0x0F, 0x06);
if (wcd937x->comp1_enable) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_DIGITAL_CDC_COMP_CTL_0,
0x02, 0x02);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_L_EN, 0x20, 0x00);
if (wcd937x->comp2_enable) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_DIGITAL_CDC_COMP_CTL_0,
0x01, 0x01);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_R_EN, 0x20, 0x00);
}
/*
@@ -428,17 +442,17 @@
&wcd937x->status_mask);
}
} else {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_DIGITAL_CDC_COMP_CTL_0,
0x02, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_L_EN, 0x20, 0x20);
}
- snd_soc_update_bits(codec, WCD937X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
0x0F, 0x01);
break;
@@ -451,44 +465,45 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int hph_mode = wcd937x->hph_mode;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd937x_rx_clk_enable(codec);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x02, 0x02);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_HPH_GAIN_CTL,
- 0x08, 0x08);
- snd_soc_update_bits(codec, WCD937X_HPH_RDAC_CLK_CTL1,
- 0x80, 0x00);
+ wcd937x_rx_clk_enable(component);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_HPH_GAIN_CTL, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD937X_HPH_RDAC_CLK_CTL1, 0x80, 0x00);
set_bit(HPH_COMP_DELAY, &wcd937x->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R,
0x0F, 0x02);
else if (hph_mode == CLS_H_LOHIFI)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R,
0x0F, 0x06);
if (wcd937x->comp2_enable) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_DIGITAL_CDC_COMP_CTL_0,
0x01, 0x01);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_R_EN, 0x20, 0x00);
if (wcd937x->comp1_enable) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_DIGITAL_CDC_COMP_CTL_0,
0x02, 0x02);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_L_EN, 0x20, 0x00);
}
/*
@@ -501,17 +516,17 @@
&wcd937x->status_mask);
}
} else {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_DIGITAL_CDC_COMP_CTL_0,
0x01, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_R_EN, 0x20, 0x20);
}
- snd_soc_update_bits(codec, WCD937X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R,
0x0F, 0x01);
break;
@@ -524,32 +539,36 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int hph_mode = wcd937x->hph_mode;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd937x_rx_clk_enable(codec);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_HPH_GAIN_CTL,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x01, 0x01);
+ wcd937x_rx_clk_enable(component);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_HPH_GAIN_CTL,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
+ 0x01, 0x01);
if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
0x0F, 0x02);
else if (hph_mode == CLS_H_LOHIFI)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
0x0F, 0x06);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_COMP_CTL_0,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_COMP_CTL_0,
+ 0x02, 0x02);
usleep_range(5000, 5010);
- wcd_cls_h_fsm(codec, &wcd937x->clsh_info,
+ wcd_cls_h_fsm(component, &wcd937x->clsh_info,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_EAR,
hph_mode);
@@ -558,7 +577,7 @@
case SND_SOC_DAPM_POST_PMD:
if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_LOHIFI ||
hph_mode == CLS_H_HIFI)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
0x0F, 0x01);
break;
@@ -571,32 +590,37 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int hph_mode = wcd937x->hph_mode;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd937x_rx_clk_enable(codec);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_AUX_GAIN_CTL,
- 0x01, 0x01);
- wcd_cls_h_fsm(codec, &wcd937x->clsh_info,
+ wcd937x_rx_clk_enable(component);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
+ 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_AUX_GAIN_CTL,
+ 0x01, 0x01);
+ wcd_cls_h_fsm(component, &wcd937x->clsh_info,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_AUX,
hph_mode);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd937x_rx_clk_disable(codec);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x04, 0x00);
+ wcd937x_rx_clk_disable(component);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
+ 0x04, 0x00);
break;
};
return 0;
@@ -607,12 +631,13 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int ret = 0;
int hph_mode = wcd937x->hph_mode;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
@@ -620,11 +645,12 @@
ret = swr_slvdev_datapath_control(wcd937x->rx_swr_dev,
wcd937x->rx_swr_dev->dev_num,
true);
- wcd_cls_h_fsm(codec, &wcd937x->clsh_info,
+ wcd_cls_h_fsm(component, &wcd937x->clsh_info,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_HPHR,
hph_mode);
- snd_soc_update_bits(codec, WCD937X_ANA_HPH, 0x10, 0x10);
+ snd_soc_component_update_bits(component, WCD937X_ANA_HPH,
+ 0x10, 0x10);
usleep_range(100, 110);
set_bit(HPH_PA_DELAY, &wcd937x->status_mask);
break;
@@ -642,11 +668,13 @@
clear_bit(HPH_PA_DELAY, &wcd937x->status_mask);
}
- snd_soc_update_bits(codec, WCD937X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x02);
if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI)
- snd_soc_update_bits(codec, WCD937X_ANA_RX_SUPPLIES,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_RX_SUPPLIES,
+ 0x02, 0x02);
if (wcd937x->update_wcd_event)
wcd937x->update_wcd_event(wcd937x->handle,
WCD_BOLERO_EVT_RX_MUTE,
@@ -666,8 +694,9 @@
blocking_notifier_call_chain(&wcd937x->mbhc->notifier,
WCD_EVENT_POST_HPHR_PA_OFF,
&wcd937x->mbhc->wcd_mbhc);
- snd_soc_update_bits(codec, WCD937X_ANA_HPH, 0x10, 0x00);
- wcd_cls_h_fsm(codec, &wcd937x->clsh_info,
+ snd_soc_component_update_bits(component, WCD937X_ANA_HPH,
+ 0x10, 0x00);
+ wcd_cls_h_fsm(component, &wcd937x->clsh_info,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_HPHR,
hph_mode);
@@ -680,12 +709,13 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int ret = 0;
int hph_mode = wcd937x->hph_mode;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
@@ -693,11 +723,12 @@
ret = swr_slvdev_datapath_control(wcd937x->rx_swr_dev,
wcd937x->rx_swr_dev->dev_num,
true);
- wcd_cls_h_fsm(codec, &wcd937x->clsh_info,
+ wcd_cls_h_fsm(component, &wcd937x->clsh_info,
WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_HPHL,
hph_mode);
- snd_soc_update_bits(codec, WCD937X_ANA_HPH, 0x20, 0x20);
+ snd_soc_component_update_bits(component, WCD937X_ANA_HPH,
+ 0x20, 0x20);
usleep_range(100, 110);
set_bit(HPH_PA_DELAY, &wcd937x->status_mask);
break;
@@ -715,11 +746,13 @@
clear_bit(HPH_PA_DELAY, &wcd937x->status_mask);
}
- snd_soc_update_bits(codec, WCD937X_HPH_NEW_INT_HPH_TIMER1,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_HPH_NEW_INT_HPH_TIMER1,
+ 0x02, 0x02);
if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI)
- snd_soc_update_bits(codec, WCD937X_ANA_RX_SUPPLIES,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_RX_SUPPLIES,
+ 0x02, 0x02);
if (wcd937x->update_wcd_event)
wcd937x->update_wcd_event(wcd937x->handle,
WCD_BOLERO_EVT_RX_MUTE,
@@ -739,8 +772,9 @@
blocking_notifier_call_chain(&wcd937x->mbhc->notifier,
WCD_EVENT_POST_HPHL_PA_OFF,
&wcd937x->mbhc->wcd_mbhc);
- snd_soc_update_bits(codec, WCD937X_ANA_HPH, 0x20, 0x00);
- wcd_cls_h_fsm(codec, &wcd937x->clsh_info,
+ snd_soc_component_update_bits(component, WCD937X_ANA_HPH,
+ 0x20, 0x00);
+ wcd_cls_h_fsm(component, &wcd937x->clsh_info,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_HPHL,
hph_mode);
@@ -753,12 +787,13 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int hph_mode = wcd937x->hph_mode;
int ret = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
@@ -770,8 +805,9 @@
case SND_SOC_DAPM_POST_PMU:
usleep_range(1000, 1010);
if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI)
- snd_soc_update_bits(codec, WCD937X_ANA_RX_SUPPLIES,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_RX_SUPPLIES,
+ 0x02, 0x02);
if (wcd937x->update_wcd_event)
wcd937x->update_wcd_event(wcd937x->handle,
WCD_BOLERO_EVT_RX_MUTE,
@@ -786,7 +822,7 @@
case SND_SOC_DAPM_POST_PMD:
usleep_range(1000, 1010);
usleep_range(1000, 1010);
- wcd_cls_h_fsm(codec, &wcd937x->clsh_info,
+ wcd_cls_h_fsm(component, &wcd937x->clsh_info,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_AUX,
hph_mode);
@@ -799,12 +835,13 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int hph_mode = wcd937x->hph_mode;
int ret = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
@@ -816,8 +853,9 @@
case SND_SOC_DAPM_POST_PMU:
usleep_range(6000, 6010);
if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI)
- snd_soc_update_bits(codec, WCD937X_ANA_RX_SUPPLIES,
- 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_RX_SUPPLIES,
+ 0x02, 0x02);
if (wcd937x->update_wcd_event)
wcd937x->update_wcd_event(wcd937x->handle,
WCD_BOLERO_EVT_RX_MUTE,
@@ -831,7 +869,7 @@
break;
case SND_SOC_DAPM_POST_PMD:
usleep_range(7000, 7010);
- wcd_cls_h_fsm(codec, &wcd937x->clsh_info,
+ wcd_cls_h_fsm(component, &wcd937x->clsh_info,
WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_EAR,
hph_mode);
@@ -844,17 +882,18 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int mode = wcd937x->hph_mode;
int ret = 0;
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
if (mode == CLS_H_LOHIFI || mode == CLS_H_ULP ||
mode == CLS_H_HIFI || mode == CLS_H_LP) {
- wcd937x_rx_connect_port(codec, CLSH,
+ wcd937x_rx_connect_port(component, CLSH,
SND_SOC_DAPM_EVENT_ON(event));
}
if (SND_SOC_DAPM_EVENT_OFF(event))
@@ -869,25 +908,27 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd937x_rx_connect_port(codec, HPH_L, true);
+ wcd937x_rx_connect_port(component, HPH_L, true);
if (wcd937x->comp1_enable)
- wcd937x_rx_connect_port(codec, COMP_L, true);
+ wcd937x_rx_connect_port(component, COMP_L, true);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd937x_rx_connect_port(codec, HPH_L, false);
+ wcd937x_rx_connect_port(component, HPH_L, false);
if (wcd937x->comp1_enable)
- wcd937x_rx_connect_port(codec, COMP_L, false);
- wcd937x_rx_clk_disable(codec);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x01, 0x00);
+ wcd937x_rx_connect_port(component, COMP_L, false);
+ wcd937x_rx_clk_disable(component);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
+ 0x01, 0x00);
break;
};
return 0;
@@ -896,25 +937,27 @@
static int wcd937x_enable_rx2(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd937x_rx_connect_port(codec, HPH_R, true);
+ wcd937x_rx_connect_port(component, HPH_R, true);
if (wcd937x->comp2_enable)
- wcd937x_rx_connect_port(codec, COMP_R, true);
+ wcd937x_rx_connect_port(component, COMP_R, true);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd937x_rx_connect_port(codec, HPH_R, false);
+ wcd937x_rx_connect_port(component, HPH_R, false);
if (wcd937x->comp2_enable)
- wcd937x_rx_connect_port(codec, COMP_R, false);
- wcd937x_rx_clk_disable(codec);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x02, 0x00);
+ wcd937x_rx_connect_port(component, COMP_R, false);
+ wcd937x_rx_clk_disable(component);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
+ 0x02, 0x00);
break;
};
@@ -925,22 +968,22 @@
struct snd_kcontrol *kcontrol,
int event)
{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd937x_rx_connect_port(codec, LO, true);
+ wcd937x_rx_connect_port(component, LO, true);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd937x_rx_connect_port(codec, LO, false);
+ wcd937x_rx_connect_port(component, LO, false);
usleep_range(6000, 6010);
- wcd937x_rx_clk_disable(codec);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x04, 0x00);
+ wcd937x_rx_clk_disable(component);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0x04, 0x00);
break;
}
return 0;
@@ -951,8 +994,9 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
u16 dmic_clk_reg;
s32 *dmic_clk_cnt;
unsigned int dmic;
@@ -962,18 +1006,18 @@
wname = strpbrk(w->name, "012345");
if (!wname) {
- dev_err(codec->dev, "%s: widget not found\n", __func__);
+ dev_err(component->dev, "%s: widget not found\n", __func__);
return -EINVAL;
}
ret = kstrtouint(wname, 10, &dmic);
if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid DMIC line on the codec\n",
+ dev_err(component->dev, "%s: Invalid DMIC line on the codec\n",
__func__);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (dmic) {
@@ -993,24 +1037,27 @@
dmic_clk_reg = WCD937X_DIGITAL_CDC_DMIC2_CTL;
break;
default:
- dev_err(codec->dev, "%s: Invalid DMIC Selection\n",
+ dev_err(component->dev, "%s: Invalid DMIC Selection\n",
__func__);
return -EINVAL;
};
- dev_dbg(codec->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
+ dev_dbg(component->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
__func__, event, dmic, *dmic_clk_cnt);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x80, 0x80);
- snd_soc_update_bits(codec, dmic_clk_reg, 0x07, 0x02);
- snd_soc_update_bits(codec, dmic_clk_reg, 0x08, 0x08);
- snd_soc_update_bits(codec, dmic_clk_reg, 0x70, 0x20);
- wcd937x_tx_connect_port(codec, DMIC0 + (w->shift), true);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ dmic_clk_reg, 0x07, 0x02);
+ snd_soc_component_update_bits(component,
+ dmic_clk_reg, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ dmic_clk_reg, 0x70, 0x20);
+ wcd937x_tx_connect_port(component, DMIC0 + (w->shift), true);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd937x_tx_connect_port(codec, DMIC0 + (w->shift), false);
+ wcd937x_tx_connect_port(component, DMIC0 + (w->shift), false);
break;
};
@@ -1037,16 +1084,17 @@
/*
* wcd937x_mbhc_micb_adjust_voltage: adjust specific micbias voltage
- * @codec: handle to snd_soc_codec *
+ * @component: handle to snd_soc_component *
* @req_volt: micbias voltage to be set
* @micb_num: micbias to be set, e.g. micbias1 or micbias2
*
* return 0 if adjustment is success or error code in case of failure
*/
-int wcd937x_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
+int wcd937x_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int req_volt, int micb_num)
{
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct wcd937x_priv *wcd937x =
+ snd_soc_component_get_drvdata(component);
int cur_vout_ctl, req_vout_ctl;
int micb_reg, micb_val, micb_en;
int ret = 0;
@@ -1074,7 +1122,7 @@
* momentarily, change the micbias value and then re-enable
* micbias.
*/
- micb_val = snd_soc_read(codec, micb_reg);
+ micb_val = snd_soc_component_read32(component, micb_reg);
micb_en = (micb_val & 0xC0) >> 6;
cur_vout_ctl = micb_val & 0x3F;
@@ -1088,17 +1136,17 @@
goto exit;
}
- dev_dbg(codec->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n",
+ dev_dbg(component->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n",
__func__, micb_num, WCD_VOUT_CTL_TO_MICB(cur_vout_ctl),
req_volt, micb_en);
if (micb_en == 0x1)
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg, 0xC0, 0x80);
- snd_soc_update_bits(codec, micb_reg, 0x3F, req_vout_ctl);
+ snd_soc_component_update_bits(component, micb_reg, 0x3F, req_vout_ctl);
if (micb_en == 0x1) {
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
+ snd_soc_component_update_bits(component, micb_reg, 0xC0, 0x40);
/*
* Add 2ms delay as per HW requirement after enabling
* micbias
@@ -1115,8 +1163,9 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int ret = 0;
switch (event) {
@@ -1139,25 +1188,26 @@
struct snd_kcontrol *kcontrol,
int event){
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x80, 0x80);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x08, 0x08);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x10, 0x10);
- wcd937x_tx_connect_port(codec, ADC1 + (w->shift), true);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL, 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x10);
+ wcd937x_tx_connect_port(component, ADC1 + (w->shift), true);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd937x_tx_connect_port(codec, ADC1 + (w->shift), false);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x08, 0x00);
+ wcd937x_tx_connect_port(component, ADC1 + (w->shift), false);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL, 0x08, 0x00);
break;
};
@@ -1167,43 +1217,50 @@
static int wcd937x_enable_req(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_REQ_CTL,
- 0x02, 0x02);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_REQ_CTL, 0x01,
- 0x00);
- snd_soc_update_bits(codec, WCD937X_ANA_TX_CH2, 0x40, 0x40);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x30, 0x30);
- snd_soc_update_bits(codec, WCD937X_ANA_TX_CH1, 0x80, 0x80);
- snd_soc_update_bits(codec, WCD937X_ANA_TX_CH2, 0x40, 0x00);
- snd_soc_update_bits(codec, WCD937X_ANA_TX_CH2, 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_REQ_CTL, 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_REQ_CTL, 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_TX_CH2, 0x40, 0x40);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0x30, 0x30);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_TX_CH1, 0x80, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_TX_CH2, 0x40, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_TX_CH2, 0x80, 0x80);
break;
case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, WCD937X_ANA_TX_CH1, 0x80, 0x00);
- snd_soc_update_bits(codec, WCD937X_ANA_TX_CH2, 0x80, 0x00);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x10, 0x00);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
- 0x10, 0x00);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
- 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_TX_CH1, 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_ANA_TX_CH2, 0x80, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0x80, 0x00);
break;
};
return 0;
}
-int wcd937x_micbias_control(struct snd_soc_codec *codec,
+int wcd937x_micbias_control(struct snd_soc_component *component,
int micb_num, int req, bool is_dapm)
{
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int micb_index = micb_num - 1;
u16 micb_reg;
int pre_off_event = 0, post_off_event = 0;
@@ -1211,7 +1268,7 @@
int post_dapm_on = 0;
if ((micb_index < 0) || (micb_index > WCD937X_MAX_MICBIAS - 1)) {
- dev_err(codec->dev, "%s: Invalid micbias index, micb_ind:%d\n",
+ dev_err(component->dev, "%s: Invalid micbias index, micb_ind:%d\n",
__func__, micb_index);
return -EINVAL;
}
@@ -1231,7 +1288,7 @@
micb_reg = WCD937X_ANA_MICB3;
break;
default:
- dev_err(codec->dev, "%s: Invalid micbias number: %d\n",
+ dev_err(component->dev, "%s: Invalid micbias number: %d\n",
__func__, micb_num);
return -EINVAL;
};
@@ -1242,25 +1299,33 @@
wcd937x->pullup_ref[micb_index]++;
if ((wcd937x->pullup_ref[micb_index] == 1) &&
(wcd937x->micb_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x80);
break;
case MICB_PULLUP_DISABLE:
if (wcd937x->pullup_ref[micb_index] > 0)
wcd937x->pullup_ref[micb_index]--;
if ((wcd937x->pullup_ref[micb_index] == 0) &&
(wcd937x->micb_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x00);
break;
case MICB_ENABLE:
wcd937x->micb_ref[micb_index]++;
if (wcd937x->micb_ref[micb_index] == 1) {
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0xE0, 0xE0);
- snd_soc_update_bits(codec, WCD937X_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec, WCD937X_MICB1_TEST_CTL_2, 0x01, 0x01);
- snd_soc_update_bits(codec, WCD937X_MICB2_TEST_CTL_2, 0x01, 0x01);
- snd_soc_update_bits(codec, WCD937X_MICB3_TEST_CTL_2, 0x01, 0x01);
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
- if (post_on_event && wcd937x->mbhc)
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_DIG_CLK_CTL, 0xE0, 0xE0);
+ snd_soc_component_update_bits(component,
+ WCD937X_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x10);
+ snd_soc_component_update_bits(component,
+ WCD937X_MICB1_TEST_CTL_2, 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD937X_MICB2_TEST_CTL_2, 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ WCD937X_MICB3_TEST_CTL_2, 0x01, 0x01);
+ snd_soc_component_update_bits(component,
+ micb_reg, 0xC0, 0x40);
+ if (post_on_event)
blocking_notifier_call_chain(
&wcd937x->mbhc->notifier, post_on_event,
&wcd937x->mbhc->wcd_mbhc);
@@ -1275,14 +1340,16 @@
wcd937x->micb_ref[micb_index]--;
if ((wcd937x->micb_ref[micb_index] == 0) &&
(wcd937x->pullup_ref[micb_index] > 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x80);
else if ((wcd937x->micb_ref[micb_index] == 0) &&
(wcd937x->pullup_ref[micb_index] == 0)) {
if (pre_off_event && wcd937x->mbhc)
blocking_notifier_call_chain(
&wcd937x->mbhc->notifier, pre_off_event,
&wcd937x->mbhc->wcd_mbhc);
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, micb_reg,
+ 0xC0, 0x00);
if (post_off_event && wcd937x->mbhc)
blocking_notifier_call_chain(
&wcd937x->mbhc->notifier,
@@ -1296,7 +1363,7 @@
break;
};
- dev_dbg(codec->dev, "%s: micb_num:%d, micb_ref: %d, pullup_ref: %d\n",
+ dev_dbg(component->dev, "%s: micb_num:%d, micb_ref: %d, pullup_ref: %d\n",
__func__, micb_num, wcd937x->micb_ref[micb_index],
wcd937x->pullup_ref[micb_index]);
mutex_unlock(&wcd937x->micb_lock);
@@ -1331,7 +1398,7 @@
u16 mask = 0x40, reg = 0x0;
int ret = 0;
struct wcd937x_priv *wcd937x = dev_get_drvdata((struct device *)data);
- struct snd_soc_codec *codec = wcd937x->codec;
+ struct snd_soc_component *component = wcd937x->component;
struct wcd_mbhc *mbhc;
switch (event) {
@@ -1344,12 +1411,15 @@
return 0;
if (amic == 0x2)
mask = 0x20;
- snd_soc_update_bits(codec, reg, mask, 0x00);
+ snd_soc_component_update_bits(component, reg, mask, 0x00);
break;
case BOLERO_WCD_EVT_PA_OFF_PRE_SSR:
- snd_soc_update_bits(codec, WCD937X_ANA_HPH, 0xC0, 0x00);
- snd_soc_update_bits(codec, WCD937X_ANA_EAR, 0x80, 0x00);
- snd_soc_update_bits(codec, WCD937X_AUX_AUXPA, 0x80, 0x00);
+ snd_soc_component_update_bits(component, WCD937X_ANA_HPH,
+ 0xC0, 0x00);
+ snd_soc_component_update_bits(component, WCD937X_ANA_EAR,
+ 0x80, 0x00);
+ snd_soc_component_update_bits(component, WCD937X_AUX_AUXPA,
+ 0x80, 0x00);
break;
case BOLERO_WCD_EVT_SSR_DOWN:
wcd937x_reset_low(wcd937x->dev);
@@ -1362,16 +1432,17 @@
regcache_sync(wcd937x->regmap);
/* Initialize MBHC module */
mbhc = &wcd937x->mbhc->wcd_mbhc;
- ret = wcd937x_mbhc_post_ssr_init(wcd937x->mbhc, codec);
+ ret = wcd937x_mbhc_post_ssr_init(wcd937x->mbhc, component);
if (ret) {
- dev_err(codec->dev, "%s: mbhc initialization failed\n",
+ dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
} else {
- wcd937x_mbhc_hs_detect(codec, mbhc->mbhc_cfg);
+ wcd937x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
}
break;
default:
- dev_err(codec->dev, "%s: invalid event %d\n", __func__, event);
+ dev_err(component->dev, "%s: invalid event %d\n", __func__,
+ event);
break;
}
return 0;
@@ -1380,10 +1451,11 @@
static int __wcd937x_codec_enable_micbias(struct snd_soc_dapm_widget *w,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
int micb_num;
- dev_dbg(codec->dev, "%s: wname: %s, event: %d\n",
+ dev_dbg(component->dev, "%s: wname: %s, event: %d\n",
__func__, w->name, event);
if (strnstr(w->name, "MIC BIAS1", sizeof("MIC BIAS1")))
@@ -1397,13 +1469,15 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wcd937x_micbias_control(codec, micb_num, MICB_ENABLE, true);
+ wcd937x_micbias_control(component, micb_num,
+ MICB_ENABLE, true);
break;
case SND_SOC_DAPM_POST_PMU:
usleep_range(1000, 1100);
break;
case SND_SOC_DAPM_POST_PMD:
- wcd937x_micbias_control(codec, micb_num, MICB_DISABLE, true);
+ wcd937x_micbias_control(component, micb_num,
+ MICB_DISABLE, true);
break;
};
@@ -1421,8 +1495,9 @@
static int wcd937x_rx_hph_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = wcd937x->hph_mode;
return 0;
@@ -1431,16 +1506,17 @@
static int wcd937x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
u32 mode_val;
mode_val = ucontrol->value.enumerated.item[0];
- dev_dbg(codec->dev, "%s: mode: %d\n", __func__, mode_val);
+ dev_dbg(component->dev, "%s: mode: %d\n", __func__, mode_val);
if (mode_val == 0) {
- dev_warn(codec->dev, "%s:Invalid HPH Mode, default to class_AB\n",
+ dev_warn(component->dev, "%s:Invalid HPH Mode, default to class_AB\n",
__func__);
mode_val = 3; /* enum will be updated later */
}
@@ -1452,8 +1528,9 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
bool hphr;
struct soc_multi_mixer_control *mc;
@@ -1468,8 +1545,9 @@
static int wcd937x_set_compander(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int value = ucontrol->value.integer.value[0];
bool hphr;
struct soc_multi_mixer_control *mc;
@@ -1488,25 +1566,26 @@
struct snd_kcontrol *kcontrol,
int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
struct wcd937x_pdata *pdata = NULL;
int ret = 0;
pdata = dev_get_platdata(wcd937x->dev);
if (!pdata) {
- dev_err(codec->dev, "%s: pdata is NULL\n", __func__);
+ dev_err(component->dev, "%s: pdata is NULL\n", __func__);
return -EINVAL;
}
- dev_dbg(codec->dev, "%s wname: %s event: %d\n", __func__,
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (test_bit(ALLOW_BUCK_DISABLE, &wcd937x->status_mask)) {
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: buck already in enabled state\n",
__func__);
return 0;
@@ -1517,7 +1596,7 @@
pdata->num_supplies,
"cdc-vdd-buck");
if (ret == -EINVAL) {
- dev_err(codec->dev, "%s: vdd buck is not enabled\n",
+ dev_err(component->dev, "%s: vdd buck is not enabled\n",
__func__);
return ret;
}
@@ -1554,9 +1633,12 @@
SOC_SINGLE_TLV("HPHL Volume", WCD937X_HPH_L_EN, 0, 20, 1, line_gain),
SOC_SINGLE_TLV("HPHR Volume", WCD937X_HPH_R_EN, 0, 20, 1, line_gain),
- SOC_SINGLE_TLV("ADC1 Volume", WCD937X_ANA_TX_CH1, 0, 20, 0, analog_gain),
- SOC_SINGLE_TLV("ADC2 Volume", WCD937X_ANA_TX_CH2, 0, 20, 0, analog_gain),
- SOC_SINGLE_TLV("ADC3 Volume", WCD937X_ANA_TX_CH3, 0, 20, 0, analog_gain),
+ SOC_SINGLE_TLV("ADC1 Volume", WCD937X_ANA_TX_CH1, 0, 20, 0,
+ analog_gain),
+ SOC_SINGLE_TLV("ADC2 Volume", WCD937X_ANA_TX_CH2, 0, 20, 0,
+ analog_gain),
+ SOC_SINGLE_TLV("ADC3 Volume", WCD937X_ANA_TX_CH3, 0, 20, 0,
+ analog_gain),
};
static const struct snd_kcontrol_new adc1_switch[] = {
@@ -1945,7 +2027,7 @@
/*
* wcd937x_info_create_codec_entry - creates wcd937x module
* @codec_root: The parent directory
- * @codec: Codec instance
+ * @component: component instance
*
* Creates wcd937x module and version entry under the given
* parent directory.
@@ -1953,26 +2035,26 @@
* Return: 0 on success or negative error code on failure.
*/
int wcd937x_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct snd_info_entry *version_entry;
struct wcd937x_priv *priv;
struct snd_soc_card *card;
- if (!codec_root || !codec)
+ if (!codec_root || !component)
return -EINVAL;
- priv = snd_soc_codec_get_drvdata(codec);
+ priv = snd_soc_component_get_drvdata(component);
if (priv->entry) {
dev_dbg(priv->dev,
"%s:wcd937x module already created\n", __func__);
return 0;
}
- card = codec->component.card;
+ card = component->card;
priv->entry = snd_info_create_subdir(codec_root->module,
"wcd937x", codec_root);
if (!priv->entry) {
- dev_dbg(codec->dev, "%s: failed to create wcd937x entry\n",
+ dev_dbg(component->dev, "%s: failed to create wcd937x entry\n",
__func__);
return -ENOMEM;
}
@@ -1980,7 +2062,7 @@
"version",
priv->entry);
if (!version_entry) {
- dev_dbg(codec->dev, "%s: failed to create wcd937x version entry\n",
+ dev_dbg(component->dev, "%s: failed to create wcd937x version entry\n",
__func__);
return -ENOMEM;
}
@@ -2000,42 +2082,44 @@
}
EXPORT_SYMBOL(wcd937x_info_create_codec_entry);
-static int wcd937x_soc_codec_probe(struct snd_soc_codec *codec)
+static int wcd937x_soc_codec_probe(struct snd_soc_component *component)
{
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
+ struct snd_soc_dapm_context *dapm =
+ snd_soc_component_get_dapm(component);
int variant;
int ret = -EINVAL;
- dev_info(codec->dev, "%s()\n", __func__);
- wcd937x = snd_soc_codec_get_drvdata(codec);
+ dev_info(component->dev, "%s()\n", __func__);
+ wcd937x = snd_soc_component_get_drvdata(component);
if (!wcd937x)
return -EINVAL;
- wcd937x->codec = codec;
- variant = (snd_soc_read(codec, WCD937X_DIGITAL_EFUSE_REG_0) & 0x0E) >> 1;
+ wcd937x->component = component;
+ variant = (snd_soc_component_read32(
+ component, WCD937X_DIGITAL_EFUSE_REG_0) & 0x0E) >> 1;
wcd937x->variant = variant;
- wcd937x->fw_data = devm_kzalloc(codec->dev,
+ wcd937x->fw_data = devm_kzalloc(component->dev,
sizeof(*(wcd937x->fw_data)),
GFP_KERNEL);
if (!wcd937x->fw_data) {
- dev_err(codec->dev, "Failed to allocate fw_data\n");
+ dev_err(component->dev, "Failed to allocate fw_data\n");
ret = -ENOMEM;
goto err;
}
set_bit(WCD9XXX_MBHC_CAL, wcd937x->fw_data->cal_bit);
ret = wcd_cal_create_hwdep(wcd937x->fw_data,
- WCD9XXX_CODEC_HWDEP_NODE, codec);
+ WCD9XXX_CODEC_HWDEP_NODE, component);
if (ret < 0) {
- dev_err(codec->dev, "%s hwdep failed %d\n", __func__, ret);
+ dev_err(component->dev, "%s hwdep failed %d\n", __func__, ret);
goto err_hwdep;
}
- ret = wcd937x_mbhc_init(&wcd937x->mbhc, codec, wcd937x->fw_data);
+ ret = wcd937x_mbhc_init(&wcd937x->mbhc, component, wcd937x->fw_data);
if (ret) {
pr_err("%s: mbhc initialization failed\n", __func__);
goto err_hwdep;
@@ -2055,20 +2139,20 @@
snd_soc_dapm_sync(dapm);
wcd_cls_h_init(&wcd937x->clsh_info);
- wcd937x_init_reg(codec);
+ wcd937x_init_reg(component);
if (wcd937x->variant == WCD9375_VARIANT) {
ret = snd_soc_dapm_new_controls(dapm, wcd9375_dapm_widgets,
ARRAY_SIZE(wcd9375_dapm_widgets));
if (ret < 0) {
- dev_err(codec->dev, "%s: Failed to add snd_ctls\n",
+ dev_err(component->dev, "%s: Failed to add snd_ctls\n",
__func__);
goto err_hwdep;
}
ret = snd_soc_dapm_add_routes(dapm, wcd9375_audio_map,
ARRAY_SIZE(wcd9375_audio_map));
if (ret < 0) {
- dev_err(codec->dev, "%s: Failed to add routes\n",
+ dev_err(component->dev, "%s: Failed to add routes\n",
__func__);
goto err_hwdep;
}
@@ -2090,7 +2174,7 @@
&wcd937x->nblock,
true);
if (ret) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Failed to register notifier %d\n",
__func__, ret);
return ret;
@@ -2105,39 +2189,30 @@
return ret;
}
-static int wcd937x_soc_codec_remove(struct snd_soc_codec *codec)
+static void wcd937x_soc_codec_remove(struct snd_soc_component *component)
{
- struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
+ struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
if (!wcd937x)
- return -EINVAL;
+ return;
if (wcd937x->register_notifier)
- return wcd937x->register_notifier(wcd937x->handle,
+ wcd937x->register_notifier(wcd937x->handle,
&wcd937x->nblock,
false);
- return 0;
+ return;
}
-static struct regmap *wcd937x_get_regmap(struct device *dev)
-{
- struct wcd937x_priv *wcd937x = dev_get_drvdata(dev);
-
- return wcd937x->regmap;
-}
-
-static struct snd_soc_codec_driver soc_codec_dev_wcd937x = {
+static const struct snd_soc_component_driver soc_codec_dev_wcd937x = {
+ .name = DRV_NAME,
.probe = wcd937x_soc_codec_probe,
.remove = wcd937x_soc_codec_remove,
- .get_regmap = wcd937x_get_regmap,
- .component_driver = {
- .controls = wcd937x_snd_controls,
- .num_controls = ARRAY_SIZE(wcd937x_snd_controls),
- .dapm_widgets = wcd937x_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(wcd937x_dapm_widgets),
- .dapm_routes = wcd937x_audio_map,
- .num_dapm_routes = ARRAY_SIZE(wcd937x_audio_map),
- },
+ .controls = wcd937x_snd_controls,
+ .num_controls = ARRAY_SIZE(wcd937x_snd_controls),
+ .dapm_widgets = wcd937x_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(wcd937x_dapm_widgets),
+ .dapm_routes = wcd937x_audio_map,
+ .num_dapm_routes = ARRAY_SIZE(wcd937x_audio_map),
};
#ifdef CONFIG_PM_SLEEP
@@ -2480,7 +2555,7 @@
wcd937x->tx_swr_dev->slave_irq = wcd937x->virq;
mutex_init(&wcd937x->micb_lock);
- ret = snd_soc_register_codec(dev, &soc_codec_dev_wcd937x,
+ ret = snd_soc_register_component(dev, &soc_codec_dev_wcd937x,
NULL, 0);
if (ret) {
dev_err(dev, "%s: Codec registration failed\n",
@@ -2501,7 +2576,7 @@
struct wcd937x_priv *wcd937x = dev_get_drvdata(dev);
wcd_irq_exit(&wcd937x->irq_info, wcd937x->virq);
- snd_soc_unregister_codec(dev);
+ snd_soc_unregister_component(dev);
component_unbind_all(dev, wcd937x);
mutex_destroy(&wcd937x->micb_lock);
}
diff --git a/asoc/codecs/wcd937x/wcd937x.h b/asoc/codecs/wcd937x/wcd937x.h
index 49905d7..a40554e 100644
--- a/asoc/codecs/wcd937x/wcd937x.h
+++ b/asoc/codecs/wcd937x/wcd937x.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WCD937X_H
@@ -15,10 +7,10 @@
#ifdef CONFIG_SND_SOC_WCD937X
extern int wcd937x_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
#else
extern int wcd937x_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return 0;
}
diff --git a/asoc/codecs/wcd937x/wcd937x_slave.c b/asoc/codecs/wcd937x/wcd937x_slave.c
index baab26f..61b6a0c 100644
--- a/asoc/codecs/wcd937x/wcd937x_slave.c
+++ b/asoc/codecs/wcd937x/wcd937x_slave.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
diff --git a/asoc/codecs/wcd9xxx-common-v2.c b/asoc/codecs/wcd9xxx-common-v2.c
index 478c0c6..d45a071 100644
--- a/asoc/codecs/wcd9xxx-common-v2.c
+++ b/asoc/codecs/wcd9xxx-common-v2.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -218,7 +210,7 @@
{13, 9},
};
-static void (*clsh_state_fp[NUM_CLSH_STATES_V2])(struct snd_soc_codec *,
+static void (*clsh_state_fp[NUM_CLSH_STATES_V2])(struct snd_soc_component *,
struct wcd_clsh_cdc_data *,
u8 req_state, bool en, int mode);
@@ -251,12 +243,13 @@
/*
* Function: wcd_clsh_imped_config
- * Params: codec, imped, reset
+ * Params: component, imped, reset
* Description:
* This function updates HPHL and HPHR gain settings
* according to the impedance value.
*/
-void wcd_clsh_imped_config(struct snd_soc_codec *codec, int imped, bool reset)
+void wcd_clsh_imped_config(struct snd_soc_component *component, int imped,
+ bool reset)
{
int i;
int index = 0;
@@ -264,7 +257,7 @@
static const struct wcd_reg_mask_val
(*imped_table_ptr)[MAX_IMPED_PARAMS];
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
if (IS_CODEC_TYPE(wcd9xxx, WCD934X)) {
table_size = ARRAY_SIZE(imped_table_tavil);
@@ -277,7 +270,7 @@
/* reset = 1, which means request is to reset the register values */
if (reset) {
for (i = 0; i < MAX_IMPED_PARAMS; i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
imped_table_ptr[index][i].reg,
imped_table_ptr[index][i].mask, 0);
return;
@@ -293,24 +286,25 @@
return;
}
for (i = 0; i < MAX_IMPED_PARAMS; i++)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
imped_table_ptr[index][i].reg,
imped_table_ptr[index][i].mask,
imped_table_ptr[index][i].val);
}
EXPORT_SYMBOL(wcd_clsh_imped_config);
-static bool is_native_44_1_active(struct snd_soc_codec *codec)
+static bool is_native_44_1_active(struct snd_soc_component *component)
{
bool native_active = false;
u8 native_clk, rx1_rate, rx2_rate;
- native_clk = snd_soc_read(codec,
+ native_clk = snd_soc_component_read32(component,
WCD9XXX_CDC_CLK_RST_CTRL_MCLK_CONTROL);
- rx1_rate = snd_soc_read(codec, WCD9XXX_CDC_RX1_RX_PATH_CTL);
- rx2_rate = snd_soc_read(codec, WCD9XXX_CDC_RX2_RX_PATH_CTL);
-
- dev_dbg(codec->dev, "%s: native_clk %x rx1_rate= %x rx2_rate= %x",
+ rx1_rate = snd_soc_component_read32(component,
+ WCD9XXX_CDC_RX1_RX_PATH_CTL);
+ rx2_rate = snd_soc_component_read32(component,
+ WCD9XXX_CDC_RX2_RX_PATH_CTL);
+ dev_dbg(component->dev, "%s: native_clk %x rx1_rate= %x rx2_rate= %x",
__func__, native_clk, rx1_rate, rx2_rate);
if ((native_clk & 0x2) &&
@@ -379,22 +373,23 @@
}
static inline void
-wcd_enable_clsh_block(struct snd_soc_codec *codec,
+wcd_enable_clsh_block(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d, bool enable)
{
if ((enable && ++clsh_d->clsh_users == 1) ||
(!enable && --clsh_d->clsh_users == 0))
- snd_soc_update_bits(codec, WCD9XXX_A_CDC_CLSH_CRC, 0x01,
- (u8) enable);
+ snd_soc_component_update_bits(component, WCD9XXX_A_CDC_CLSH_CRC,
+ 0x01, (u8) enable);
if (clsh_d->clsh_users < 0)
clsh_d->clsh_users = 0;
- dev_dbg(codec->dev, "%s: clsh_users %d, enable %d", __func__,
+ dev_dbg(component->dev, "%s: clsh_users %d, enable %d", __func__,
clsh_d->clsh_users, enable);
}
-static inline bool wcd_clsh_enable_status(struct snd_soc_codec *codec)
+static inline bool wcd_clsh_enable_status(struct snd_soc_component *component)
{
- return snd_soc_read(codec, WCD9XXX_A_CDC_CLSH_CRC) & 0x01;
+ return snd_soc_component_read32(component, WCD9XXX_A_CDC_CLSH_CRC) &
+ 0x01;
}
static inline int wcd_clsh_get_int_mode(struct wcd_clsh_cdc_data *clsh_d,
@@ -425,34 +420,40 @@
clsh_d->interpolator_modes[ffs(clsh_state)] = mode;
}
-static inline void wcd_clsh_set_buck_mode(struct snd_soc_codec *codec,
+static inline void wcd_clsh_set_buck_mode(struct snd_soc_component *component,
int mode)
{
if (mode == CLS_H_HIFI || mode == CLS_H_LOHIFI ||
mode == CLS_AB_HIFI || mode == CLS_AB)
- snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
- 0x08, 0x08); /* set to HIFI */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_ANA_RX_SUPPLIES,
+ 0x08, 0x08); /* set to HIFI */
else
- snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
- 0x08, 0x00); /* set to default */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_ANA_RX_SUPPLIES,
+ 0x08, 0x00); /* set to default */
}
-static inline void wcd_clsh_set_flyback_mode(struct snd_soc_codec *codec,
- int mode)
+static inline void wcd_clsh_set_flyback_mode(
+ struct snd_soc_component *component,
+ int mode)
{
if (mode == CLS_H_HIFI || mode == CLS_H_LOHIFI ||
mode == CLS_AB_HIFI || mode == CLS_AB)
- snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
- 0x04, 0x04); /* set to HIFI */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_ANA_RX_SUPPLIES,
+ 0x04, 0x04); /* set to HIFI */
else
- snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
- 0x04, 0x00); /* set to Default */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_ANA_RX_SUPPLIES,
+ 0x04, 0x00); /* set to Default */
}
-static inline void wcd_clsh_gm3_boost_disable(struct snd_soc_codec *codec,
- int mode)
+static inline void wcd_clsh_gm3_boost_disable(
+ struct snd_soc_component *component,
+ int mode)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
if (!IS_CODEC_TYPE(wcd9xxx, WCD934X))
return;
@@ -460,46 +461,56 @@
if (mode == CLS_H_HIFI || mode == CLS_H_LOHIFI ||
mode == CLS_AB_HIFI || mode == CLS_AB) {
if (TAVIL_IS_1_0(wcd9xxx))
- snd_soc_update_bits(codec, WCD9XXX_HPH_CNP_WG_CTL,
- 0x80, 0x0); /* disable GM3 Boost */
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEG_CTRL_4,
- 0xF0, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_CNP_WG_CTL,
+ 0x80, 0x0); /* disable GM3 Boost */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEG_CTRL_4,
+ 0xF0, 0x80);
} else {
- snd_soc_update_bits(codec, WCD9XXX_HPH_CNP_WG_CTL,
- 0x80, 0x80); /* set to Default */
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEG_CTRL_4,
- 0xF0, 0x70);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_CNP_WG_CTL,
+ 0x80, 0x80); /* set to Default */
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEG_CTRL_4,
+ 0xF0, 0x70);
}
}
-static inline void wcd_clsh_force_iq_ctl(struct snd_soc_codec *codec,
+static inline void wcd_clsh_force_iq_ctl(struct snd_soc_component *component,
int mode)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
if (!IS_CODEC_TYPE(wcd9xxx, WCD934X))
return;
if (mode == CLS_H_LOHIFI || mode == CLS_AB) {
- snd_soc_update_bits(codec, WCD9XXX_HPH_NEW_INT_PA_MISC2,
- 0x20, 0x20);
- snd_soc_update_bits(codec, WCD9XXX_RX_BIAS_HPH_LOWPOWER,
- 0xF0, 0xC0);
- snd_soc_update_bits(codec, WCD9XXX_HPH_PA_CTL1,
- 0x0E, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_NEW_INT_PA_MISC2,
+ 0x20, 0x20);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_RX_BIAS_HPH_LOWPOWER,
+ 0xF0, 0xC0);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_PA_CTL1,
+ 0x0E, 0x02);
} else {
- snd_soc_update_bits(codec, WCD9XXX_HPH_NEW_INT_PA_MISC2,
- 0x20, 0x0);
- snd_soc_update_bits(codec, WCD9XXX_RX_BIAS_HPH_LOWPOWER,
- 0xF0, 0x80);
- snd_soc_update_bits(codec, WCD9XXX_HPH_PA_CTL1,
- 0x0E, 0x06);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_NEW_INT_PA_MISC2,
+ 0x20, 0x0);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_RX_BIAS_HPH_LOWPOWER,
+ 0xF0, 0x80);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_PA_CTL1,
+ 0x0E, 0x06);
}
}
-static void wcd_clsh_buck_ctrl(struct snd_soc_codec *codec,
+static void wcd_clsh_buck_ctrl(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
int mode,
bool enable)
@@ -507,9 +518,10 @@
/* enable/disable buck */
if ((enable && (++clsh_d->buck_users == 1)) ||
(!enable && (--clsh_d->buck_users == 0)))
- snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
- (1 << 7), (enable << 7));
- dev_dbg(codec->dev, "%s: buck_users %d, enable %d, mode: %s",
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_ANA_RX_SUPPLIES,
+ (1 << 7), (enable << 7));
+ dev_dbg(component->dev, "%s: buck_users %d, enable %d, mode: %s",
__func__, clsh_d->buck_users, enable, mode_to_str(mode));
/*
* 500us sleep is required after buck enable/disable
@@ -518,29 +530,32 @@
usleep_range(500, 500 + WCD_USLEEP_RANGE);
}
-static void wcd_clsh_flyback_ctrl(struct snd_soc_codec *codec,
+static void wcd_clsh_flyback_ctrl(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
int mode,
bool enable)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_reg_val bulk_reg[2];
u8 vneg[] = {0x00, 0x40};
/* enable/disable flyback */
if ((enable && (++clsh_d->flyback_users == 1)) ||
(!enable && (--clsh_d->flyback_users == 0))) {
- snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
- (1 << 6), (enable << 6));
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_ANA_RX_SUPPLIES,
+ (1 << 6), (enable << 6));
/* 100usec delay is needed as per HW requirement */
usleep_range(100, 110);
if (enable && (TASHA_IS_1_1(wcd9xxx))) {
- wcd_clsh_set_flyback_mode(codec, CLS_H_HIFI);
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_EN,
- 0x60, 0x40);
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_EN,
- 0x10, 0x10);
- vneg[0] = snd_soc_read(codec,
+ wcd_clsh_set_flyback_mode(component, CLS_H_HIFI);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_EN,
+ 0x60, 0x40);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_EN,
+ 0x10, 0x10);
+ vneg[0] = snd_soc_component_read32(component,
WCD9XXX_A_ANA_RX_SUPPLIES);
vneg[0] &= ~(0x40);
vneg[1] = vneg[0] | 0x40;
@@ -554,13 +569,14 @@
usleep_range(500, 510);
wcd9xxx_slim_bulk_write(wcd9xxx, bulk_reg, 2,
false);
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_EN,
- 0x10, 0x00);
- wcd_clsh_set_flyback_mode(codec, mode);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_EN,
+ 0x10, 0x00);
+ wcd_clsh_set_flyback_mode(component, mode);
}
}
- dev_dbg(codec->dev, "%s: flyback_users %d, enable %d, mode: %s",
+ dev_dbg(component->dev, "%s: flyback_users %d, enable %d, mode: %s",
__func__, clsh_d->flyback_users, enable, mode_to_str(mode));
/*
* 500us sleep is required after flyback enable/disable
@@ -569,11 +585,11 @@
usleep_range(500, 500 + WCD_USLEEP_RANGE);
}
-static void wcd_clsh_set_gain_path(struct snd_soc_codec *codec,
+static void wcd_clsh_set_gain_path(struct snd_soc_component *component,
int mode)
{
u8 val = 0;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
if (!TASHA_IS_2_0(wcd9xxx))
return;
@@ -592,11 +608,13 @@
default:
return;
};
- snd_soc_update_bits(codec, WCD9XXX_HPH_L_EN, 0xC0, (val << 6));
- snd_soc_update_bits(codec, WCD9XXX_HPH_R_EN, 0xC0, (val << 6));
+ snd_soc_component_update_bits(component, WCD9XXX_HPH_L_EN,
+ 0xC0, (val << 6));
+ snd_soc_component_update_bits(component, WCD9XXX_HPH_R_EN,
+ 0xC0, (val << 6));
}
-static void wcd_clsh_set_hph_mode(struct snd_soc_codec *codec,
+static void wcd_clsh_set_hph_mode(struct snd_soc_component *component,
int mode)
{
u8 val = 0;
@@ -604,7 +622,7 @@
u8 res_val = VREF_FILT_R_0OHM;
u8 ipeak = DELTA_I_50MA;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
switch (mode) {
case CLS_H_NORMAL:
@@ -654,97 +672,109 @@
(mode == CLS_H_LOHIFI || mode == CLS_AB))
val = 0x04;
- snd_soc_update_bits(codec, WCD9XXX_A_ANA_HPH, 0x0C, val);
+ snd_soc_component_update_bits(component, WCD9XXX_A_ANA_HPH, 0x0C, val);
if (TASHA_IS_2_0(wcd9xxx)) {
- snd_soc_update_bits(codec, WCD9XXX_CLASSH_CTRL_VCL_2,
- 0x30, (res_val << 4));
+ snd_soc_component_update_bits(component,
+ WCD9XXX_CLASSH_CTRL_VCL_2,
+ 0x30, (res_val << 4));
if (mode != CLS_H_LP)
- snd_soc_update_bits(codec, WCD9XXX_HPH_REFBUFF_UHQA_CTL,
- 0x07, gain);
- snd_soc_update_bits(codec, WCD9XXX_CLASSH_CTRL_CCL_1,
- 0xF0, (ipeak << 4));
+ snd_soc_component_update_bits(component,
+ WCD9XXX_HPH_REFBUFF_UHQA_CTL,
+ 0x07, gain);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_CLASSH_CTRL_CCL_1,
+ 0xF0, (ipeak << 4));
}
}
-static void wcd_clsh_set_flyback_vneg_ctl(struct snd_soc_codec *codec,
+static void wcd_clsh_set_flyback_vneg_ctl(struct snd_soc_component *component,
bool enable)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
if (!TASHA_IS_2_0(wcd9xxx))
return;
if (enable) {
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEG_CTRL_1, 0xE0,
- 0x00);
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
- 0xE0, (0x07 << 5));
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEG_CTRL_1, 0xE0, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
+ 0xE0, (0x07 << 5));
} else {
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEG_CTRL_1, 0xE0,
- (0x07 << 5));
- snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
- 0xE0, (0x02 << 5));
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEG_CTRL_1,
+ 0xE0, (0x07 << 5));
+ snd_soc_component_update_bits(component,
+ WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
+ 0xE0, (0x02 << 5));
}
}
-static void wcd_clsh_set_flyback_current(struct snd_soc_codec *codec, int mode)
+static void wcd_clsh_set_flyback_current(struct snd_soc_component *component,
+ int mode)
{
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
if (!TASHA_IS_2_0(wcd9xxx))
return;
- snd_soc_update_bits(codec, WCD9XXX_RX_BIAS_FLYB_BUFF, 0x0F, 0x0A);
- snd_soc_update_bits(codec, WCD9XXX_RX_BIAS_FLYB_BUFF, 0xF0, 0xA0);
+ snd_soc_component_update_bits(component, WCD9XXX_RX_BIAS_FLYB_BUFF,
+ 0x0F, 0x0A);
+ snd_soc_component_update_bits(component, WCD9XXX_RX_BIAS_FLYB_BUFF,
+ 0xF0, 0xA0);
/* Sleep needed to avoid click and pop as per HW requirement */
usleep_range(100, 110);
}
-static void wcd_clsh_set_buck_regulator_mode(struct snd_soc_codec *codec,
- int mode)
+static void wcd_clsh_set_buck_regulator_mode(
+ struct snd_soc_component *component,
+ int mode)
{
- snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
+ snd_soc_component_update_bits(component, WCD9XXX_A_ANA_RX_SUPPLIES,
0x02, 0x00);
}
-static void wcd_clsh_state_lo(struct snd_soc_codec *codec,
+static void wcd_clsh_state_lo(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- dev_err(codec->dev, "%s: LO cannot be in this mode: %d\n",
+ dev_err(component->dev, "%s: LO cannot be in this mode: %d\n",
__func__, mode);
return;
}
if (is_enable) {
- wcd_clsh_set_buck_regulator_mode(codec, mode);
- wcd_clsh_set_flyback_vneg_ctl(codec, true);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_flyback_current(codec, mode);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
+ wcd_clsh_set_buck_regulator_mode(component, mode);
+ wcd_clsh_set_flyback_vneg_ctl(component, true);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_flyback_current(component, mode);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, true);
} else {
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, false);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, false);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_flyback_vneg_ctl(codec, false);
- wcd_clsh_set_buck_regulator_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, false);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, false);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_flyback_vneg_ctl(component, false);
+ wcd_clsh_set_buck_regulator_mode(component, CLS_H_NORMAL);
}
}
-static void wcd_clsh_state_hph_ear(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_ear(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
int hph_mode = 0;
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (is_enable) {
@@ -763,37 +793,38 @@
else
return;
if (hph_mode != CLS_AB && hph_mode != CLS_AB_HIFI
- && !is_native_44_1_active(codec))
- snd_soc_update_bits(codec,
+ && !is_native_44_1_active(component))
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x40);
}
- if (is_native_44_1_active(codec)) {
- snd_soc_write(codec, WCD9XXX_CDC_CLSH_HPH_V_PA, 0x39);
- snd_soc_update_bits(codec,
+ if (is_native_44_1_active(component)) {
+ snd_soc_component_write(component,
+ WCD9XXX_CDC_CLSH_HPH_V_PA, 0x39);
+ snd_soc_component_update_bits(component,
WCD9XXX_CDC_RX0_RX_PATH_SEC0,
0x03, 0x00);
if ((req_state == WCD_CLSH_STATE_HPHL) ||
(req_state == WCD_CLSH_STATE_HPHR))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x00);
}
if (req_state == WCD_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
0x40, 0x40);
if (req_state == WCD_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
0x40, 0x40);
if ((req_state == WCD_CLSH_STATE_HPHL) ||
(req_state == WCD_CLSH_STATE_HPHR)) {
- wcd_clsh_set_gain_path(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_set_buck_mode(codec, mode);
+ wcd_clsh_set_gain_path(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_set_buck_mode(component, mode);
}
} else {
if (req_state == WCD_CLSH_STATE_EAR) {
@@ -803,54 +834,56 @@
* and if HPH requested mode is CLS_AB then
* no need to disable EAR channel enable bit.
*/
- if (wcd_clsh_enable_status(codec))
- snd_soc_update_bits(codec,
+ if (wcd_clsh_enable_status(component))
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x00);
}
- if (is_native_44_1_active(codec)) {
- snd_soc_write(codec, WCD9XXX_CDC_CLSH_HPH_V_PA, 0x1C);
- snd_soc_update_bits(codec,
+ if (is_native_44_1_active(component)) {
+ snd_soc_component_write(component,
+ WCD9XXX_CDC_CLSH_HPH_V_PA, 0x1C);
+ snd_soc_component_update_bits(component,
WCD9XXX_CDC_RX0_RX_PATH_SEC0,
0x03, 0x01);
if (((clsh_d->state & WCD_CLSH_STATE_HPH_ST)
!= WCD_CLSH_STATE_HPH_ST) &&
((req_state == WCD_CLSH_STATE_HPHL) ||
(req_state == WCD_CLSH_STATE_HPHR)))
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x40);
}
if (req_state == WCD_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
0x40, 0x00);
if (req_state == WCD_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
0x40, 0x00);
if ((req_state & WCD_CLSH_STATE_HPH_ST) &&
- !wcd_clsh_enable_status(codec)) {
+ !wcd_clsh_enable_status(component)) {
/* If Class-H is not enabled when HPH is turned
* off, enable it as EAR is in progress
*/
- wcd_enable_clsh_block(codec, clsh_d, true);
- snd_soc_update_bits(codec,
+ wcd_enable_clsh_block(component, clsh_d, true);
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x40);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
}
}
}
-static void wcd_clsh_state_ear_lo(struct snd_soc_codec *codec,
+static void wcd_clsh_state_ear_lo(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (is_enable) {
@@ -859,22 +892,22 @@
*/
if (req_state == WCD_CLSH_STATE_EAR) {
/* EAR powerup.*/
- if (!wcd_clsh_enable_status(codec)) {
- wcd_enable_clsh_block(codec, clsh_d, true);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
+ if (!wcd_clsh_enable_status(component)) {
+ wcd_enable_clsh_block(component, clsh_d, true);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
}
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x40);
}
} else {
if (req_state == WCD_CLSH_STATE_EAR) {
/* EAR powerdown.*/
- wcd_enable_clsh_block(codec, clsh_d, false);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- snd_soc_update_bits(codec,
+ wcd_enable_clsh_block(component, clsh_d, false);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x00);
}
@@ -884,13 +917,14 @@
}
}
-static void wcd_clsh_state_hph_lo(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_lo(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
int hph_mode = 0;
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (is_enable) {
@@ -903,31 +937,31 @@
* and buck.
*/
if (req_state == WCD_CLSH_STATE_LO)
- wcd_clsh_set_buck_regulator_mode(codec, CLS_AB);
+ wcd_clsh_set_buck_regulator_mode(component, CLS_AB);
else {
- if (!wcd_clsh_enable_status(codec)) {
- wcd_enable_clsh_block(codec, clsh_d, true);
- snd_soc_update_bits(codec,
+ if (!wcd_clsh_enable_status(component)) {
+ wcd_enable_clsh_block(component, clsh_d, true);
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_CLSH_K1_MSB,
0x0F, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_CLSH_K1_LSB,
0xFF, 0xC0);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_set_flyback_vneg_ctl(codec, false);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_set_hph_mode(codec, mode);
- wcd_clsh_set_gain_path(codec, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_set_flyback_vneg_ctl(component, false);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_set_hph_mode(component, mode);
+ wcd_clsh_set_gain_path(component, mode);
} else {
- dev_dbg(codec->dev, "%s:clsh is already enabled\n",
+ dev_dbg(component->dev, "%s:clsh is already enabled\n",
__func__);
}
if (req_state == WCD_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
0x40, 0x40);
if (req_state == WCD_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
0x40, 0x40);
}
@@ -935,11 +969,11 @@
if ((req_state == WCD_CLSH_STATE_HPHL) ||
(req_state == WCD_CLSH_STATE_HPHR)) {
if (req_state == WCD_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
0x40, 0x00);
if (req_state == WCD_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
0x40, 0x00);
/*
@@ -949,10 +983,11 @@
*/
if ((clsh_d->state & WCD_CLSH_STATE_HPH_ST)
!= WCD_CLSH_STATE_HPH_ST) {
- wcd_enable_clsh_block(codec, clsh_d, false);
- wcd_clsh_set_flyback_vneg_ctl(codec, true);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
+ wcd_enable_clsh_block(component, clsh_d, false);
+ wcd_clsh_set_flyback_vneg_ctl(component, true);
+ wcd_clsh_set_flyback_mode(
+ component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
}
} else {
/* LO powerdown.
@@ -968,7 +1003,7 @@
WCD_CLSH_STATE_HPHR);
else
return;
- dev_dbg(codec->dev, "%s: hph_mode = %d\n", __func__,
+ dev_dbg(component->dev, "%s: hph_mode = %d\n", __func__,
hph_mode);
if ((hph_mode == CLS_AB) ||
@@ -981,44 +1016,45 @@
* LO ON), no need to turn on again, just set the
* regulator mode.
*/
- if (wcd_clsh_enable_status(codec)) {
- wcd_clsh_set_buck_regulator_mode(codec,
+ if (wcd_clsh_enable_status(component)) {
+ wcd_clsh_set_buck_regulator_mode(component,
hph_mode);
goto end;
} else {
- dev_dbg(codec->dev, "%s: clsh is not enabled\n",
+ dev_dbg(component->dev, "%s: clsh is not enabled\n",
__func__);
}
- wcd_enable_clsh_block(codec, clsh_d, true);
- snd_soc_update_bits(codec,
+ wcd_enable_clsh_block(component, clsh_d, true);
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_CLSH_K1_MSB,
0x0F, 0x00);
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_CLSH_K1_LSB,
0xFF, 0xC0);
- wcd_clsh_set_buck_regulator_mode(codec,
+ wcd_clsh_set_buck_regulator_mode(component,
hph_mode);
if (clsh_d->state & WCD_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
0x40, 0x40);
if (clsh_d->state & WCD_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
0x40, 0x40);
- wcd_clsh_set_hph_mode(codec, hph_mode);
+ wcd_clsh_set_hph_mode(component, hph_mode);
}
}
end:
return;
}
-static void wcd_clsh_state_hph_st(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_st(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (mode == CLS_AB || mode == CLS_AB_HIFI)
@@ -1026,183 +1062,190 @@
if (is_enable) {
if (req_state == WCD_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
0x40, 0x40);
if (req_state == WCD_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
0x40, 0x40);
} else {
if (req_state == WCD_CLSH_STATE_HPHL)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
0x40, 0x00);
if (req_state == WCD_CLSH_STATE_HPHR)
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
0x40, 0x00);
}
}
-static void wcd_clsh_state_hph_r(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_r(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (mode == CLS_H_NORMAL) {
- dev_err(codec->dev, "%s: Normal mode not applicable for hph_r\n",
+ dev_err(component->dev, "%s: Normal mode not applicable for hph_r\n",
__func__);
return;
}
if (is_enable) {
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- wcd_enable_clsh_block(codec, clsh_d, true);
+ wcd_enable_clsh_block(component, clsh_d, true);
/*
* These K1 values depend on the Headphone Impedance
* For now it is assumed to be 16 ohm
*/
- snd_soc_update_bits(codec, WCD9XXX_A_CDC_CLSH_K1_MSB,
- 0x0F, 0x00);
- snd_soc_update_bits(codec, WCD9XXX_A_CDC_CLSH_K1_LSB,
- 0xFF, 0xC0);
- snd_soc_update_bits(codec,
- WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
- 0x40, 0x40);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_CDC_CLSH_K1_MSB,
+ 0x0F, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_CDC_CLSH_K1_LSB,
+ 0xFF, 0xC0);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
+ 0x40, 0x40);
}
- wcd_clsh_set_buck_regulator_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_gm3_boost_disable(codec, mode);
- wcd_clsh_force_iq_ctl(codec, mode);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_flyback_current(codec, mode);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_hph_mode(codec, mode);
- wcd_clsh_set_gain_path(codec, mode);
+ wcd_clsh_set_buck_regulator_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_gm3_boost_disable(component, mode);
+ wcd_clsh_force_iq_ctl(component, mode);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_flyback_current(component, mode);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_hph_mode(component, mode);
+ wcd_clsh_set_gain_path(component, mode);
} else {
- wcd_clsh_set_hph_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_set_hph_mode(component, CLS_H_NORMAL);
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX2_RX_PATH_CFG0,
0x40, 0x00);
- wcd_enable_clsh_block(codec, clsh_d, false);
+ wcd_enable_clsh_block(component, clsh_d, false);
}
/* buck and flyback set to default mode and disable */
- wcd_clsh_buck_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_flyback_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_force_iq_ctl(codec, CLS_H_NORMAL);
- wcd_clsh_gm3_boost_disable(codec, CLS_H_NORMAL);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_regulator_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_buck_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_flyback_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_force_iq_ctl(component, CLS_H_NORMAL);
+ wcd_clsh_gm3_boost_disable(component, CLS_H_NORMAL);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_regulator_mode(component, CLS_H_NORMAL);
}
}
-static void wcd_clsh_state_hph_l(struct snd_soc_codec *codec,
+static void wcd_clsh_state_hph_l(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (mode == CLS_H_NORMAL) {
- dev_err(codec->dev, "%s: Normal mode not applicable for hph_l\n",
+ dev_err(component->dev, "%s: Normal mode not applicable for hph_l\n",
__func__);
return;
}
if (is_enable) {
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- wcd_enable_clsh_block(codec, clsh_d, true);
+ wcd_enable_clsh_block(component, clsh_d, true);
/*
* These K1 values depend on the Headphone Impedance
* For now it is assumed to be 16 ohm
*/
- snd_soc_update_bits(codec, WCD9XXX_A_CDC_CLSH_K1_MSB,
- 0x0F, 0x00);
- snd_soc_update_bits(codec, WCD9XXX_A_CDC_CLSH_K1_LSB,
- 0xFF, 0xC0);
- snd_soc_update_bits(codec,
- WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
- 0x40, 0x40);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_CDC_CLSH_K1_MSB,
+ 0x0F, 0x00);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_CDC_CLSH_K1_LSB,
+ 0xFF, 0xC0);
+ snd_soc_component_update_bits(component,
+ WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
+ 0x40, 0x40);
}
- wcd_clsh_set_buck_regulator_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_gm3_boost_disable(codec, mode);
- wcd_clsh_force_iq_ctl(codec, mode);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_flyback_current(codec, mode);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_hph_mode(codec, mode);
- wcd_clsh_set_gain_path(codec, mode);
+ wcd_clsh_set_buck_regulator_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_gm3_boost_disable(component, mode);
+ wcd_clsh_force_iq_ctl(component, mode);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_flyback_current(component, mode);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_hph_mode(component, mode);
+ wcd_clsh_set_gain_path(component, mode);
} else {
- wcd_clsh_set_hph_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_set_hph_mode(component, CLS_H_NORMAL);
if (mode != CLS_AB && mode != CLS_AB_HIFI) {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX1_RX_PATH_CFG0,
0x40, 0x00);
- wcd_enable_clsh_block(codec, clsh_d, false);
+ wcd_enable_clsh_block(component, clsh_d, false);
}
/* set buck and flyback to Default Mode */
- wcd_clsh_buck_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_flyback_ctrl(codec, clsh_d, CLS_H_NORMAL, false);
- wcd_clsh_force_iq_ctl(codec, CLS_H_NORMAL);
- wcd_clsh_gm3_boost_disable(codec, CLS_H_NORMAL);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_regulator_mode(codec, CLS_H_NORMAL);
+ wcd_clsh_buck_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_flyback_ctrl(component, clsh_d, CLS_H_NORMAL, false);
+ wcd_clsh_force_iq_ctl(component, CLS_H_NORMAL);
+ wcd_clsh_gm3_boost_disable(component, CLS_H_NORMAL);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_regulator_mode(component, CLS_H_NORMAL);
}
}
-static void wcd_clsh_state_ear(struct snd_soc_codec *codec,
+static void wcd_clsh_state_ear(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
- dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
+ dev_dbg(component->dev, "%s: mode: %s, %s\n", __func__,
+ mode_to_str(mode),
is_enable ? "enable" : "disable");
if (mode != CLS_H_NORMAL) {
- dev_err(codec->dev, "%s: mode: %s cannot be used for EAR\n",
+ dev_err(component->dev, "%s: mode: %s cannot be used for EAR\n",
__func__, mode_to_str(mode));
return;
}
if (is_enable) {
- wcd_enable_clsh_block(codec, clsh_d, true);
- snd_soc_update_bits(codec,
+ wcd_enable_clsh_block(component, clsh_d, true);
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x40);
- wcd_clsh_set_buck_mode(codec, mode);
- wcd_clsh_set_flyback_mode(codec, mode);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
- wcd_clsh_set_flyback_current(codec, mode);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
+ wcd_clsh_set_buck_mode(component, mode);
+ wcd_clsh_set_flyback_mode(component, mode);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, true);
+ wcd_clsh_set_flyback_current(component, mode);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, true);
} else {
- snd_soc_update_bits(codec,
+ snd_soc_component_update_bits(component,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x00);
- wcd_enable_clsh_block(codec, clsh_d, false);
- wcd_clsh_buck_ctrl(codec, clsh_d, mode, false);
- wcd_clsh_flyback_ctrl(codec, clsh_d, mode, false);
- wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
- wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
+ wcd_enable_clsh_block(component, clsh_d, false);
+ wcd_clsh_buck_ctrl(component, clsh_d, mode, false);
+ wcd_clsh_flyback_ctrl(component, clsh_d, mode, false);
+ wcd_clsh_set_flyback_mode(component, CLS_H_NORMAL);
+ wcd_clsh_set_buck_mode(component, CLS_H_NORMAL);
}
}
-static void wcd_clsh_state_err(struct snd_soc_codec *codec,
+static void wcd_clsh_state_err(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *clsh_d,
u8 req_state, bool is_enable, int mode)
{
char msg[128];
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s Wrong request for class H state machine requested to %s %s",
__func__, is_enable ? "enable" : "disable",
state_to_str(req_state, msg, sizeof(msg)));
@@ -1239,14 +1282,14 @@
/*
* Function: wcd_clsh_fsm
- * Params: codec, cdc_clsh_d, req_state, req_type, clsh_event
+ * Params: component, cdc_clsh_d, req_state, req_type, clsh_event
* Description:
* This function handles PRE DAC and POST DAC conditions of different devices
* and updates class H configuration of different combination of devices
* based on validity of their states. cdc_clsh_d will contain current
* class h state information
*/
-void wcd_clsh_fsm(struct snd_soc_codec *codec,
+void wcd_clsh_fsm(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *cdc_clsh_d,
u8 clsh_event, u8 req_state,
int int_mode)
@@ -1260,14 +1303,14 @@
new_state = old_state | req_state;
if (!wcd_clsh_is_state_valid(new_state)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H not a valid new state: %s\n",
__func__,
state_to_str(new_state, msg0, sizeof(msg0)));
return;
}
if (new_state == old_state) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H already in requested state: %s\n",
__func__,
state_to_str(new_state, msg0, sizeof(msg0)));
@@ -1275,9 +1318,9 @@
}
cdc_clsh_d->state = new_state;
wcd_clsh_set_int_mode(cdc_clsh_d, req_state, int_mode);
- (*clsh_state_fp[new_state]) (codec, cdc_clsh_d, req_state,
+ (*clsh_state_fp[new_state]) (component, cdc_clsh_d, req_state,
CLSH_REQ_ENABLE, int_mode);
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: ClassH state transition from %s to %s\n",
__func__, state_to_str(old_state, msg0, sizeof(msg0)),
state_to_str(cdc_clsh_d->state, msg1, sizeof(msg1)));
@@ -1287,7 +1330,7 @@
new_state = old_state & (~req_state);
if (new_state < NUM_CLSH_STATES_V2) {
if (!wcd_clsh_is_state_valid(old_state)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s:Invalid old state:%s\n",
__func__,
state_to_str(old_state, msg0,
@@ -1295,19 +1338,19 @@
return;
}
if (new_state == old_state) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Class-H already in requested state: %s\n",
__func__,
state_to_str(new_state, msg0,
sizeof(msg0)));
return;
}
- (*clsh_state_fp[old_state]) (codec, cdc_clsh_d,
+ (*clsh_state_fp[old_state]) (component, cdc_clsh_d,
req_state, CLSH_REQ_DISABLE,
int_mode);
cdc_clsh_d->state = new_state;
wcd_clsh_set_int_mode(cdc_clsh_d, req_state, CLS_NONE);
- dev_dbg(codec->dev, "%s: ClassH state transition from %s to %s\n",
+ dev_dbg(component->dev, "%s: ClassH state transition from %s to %s\n",
__func__, state_to_str(old_state, msg0,
sizeof(msg0)),
state_to_str(cdc_clsh_d->state, msg1,
diff --git a/asoc/codecs/wcd9xxx-common-v2.h b/asoc/codecs/wcd9xxx-common-v2.h
index 53c9a84..21eadd7 100644
--- a/asoc/codecs/wcd9xxx-common-v2.h
+++ b/asoc/codecs/wcd9xxx-common-v2.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _WCD9XXX_COMMON_V2
@@ -149,15 +141,15 @@
u8 val;
};
-extern void wcd_clsh_fsm(struct snd_soc_codec *codec,
+extern void wcd_clsh_fsm(struct snd_soc_component *component,
struct wcd_clsh_cdc_data *cdc_clsh_d,
u8 clsh_event, u8 req_state,
int int_mode);
extern void wcd_clsh_init(struct wcd_clsh_cdc_data *clsh);
extern int wcd_clsh_get_clsh_state(struct wcd_clsh_cdc_data *clsh);
-extern void wcd_clsh_imped_config(struct snd_soc_codec *codec, int imped,
- bool reset);
+extern void wcd_clsh_imped_config(struct snd_soc_component *component,
+ int imped, bool reset);
enum {
RESERVED = 0,
diff --git a/asoc/codecs/wcd9xxx-core-init.c b/asoc/codecs/wcd9xxx-core-init.c
index e575e0d..ee1ba51 100644
--- a/asoc/codecs/wcd9xxx-core-init.c
+++ b/asoc/codecs/wcd9xxx-core-init.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
diff --git a/asoc/codecs/wcd9xxx-core.c b/asoc/codecs/wcd9xxx-core.c
index 4b7c580..28b0708 100644
--- a/asoc/codecs/wcd9xxx-core.c
+++ b/asoc/codecs/wcd9xxx-core.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
@@ -852,7 +844,7 @@
struct i2c_msg *msg;
int ret = 0;
u8 reg_addr = 0;
- u8 data[bytes + 1];
+ u8 *data = NULL;
struct wcd9xxx_i2c *wcd9xxx_i2c;
wcd9xxx_i2c = wcd9xxx_i2c_get_device_info(wcd9xxx, reg);
@@ -860,6 +852,11 @@
pr_err("failed to get device info\n");
return -ENODEV;
}
+
+ data = kzalloc(bytes + 1, GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
reg_addr = (u8)reg;
msg = &wcd9xxx_i2c->xfer_msg[0];
msg->addr = wcd9xxx_i2c->client->addr;
@@ -876,11 +873,13 @@
wcd9xxx_i2c->xfer_msg, 1);
if (ret != 1) {
pr_err("failed to write the device\n");
- return ret;
+ goto fail;
}
}
pr_debug("write success register = %x val = %x\n", reg, data[1]);
- return 0;
+fail:
+ kfree(data);
+ return ret;
}
diff --git a/asoc/codecs/wcd9xxx-irq.c b/asoc/codecs/wcd9xxx-irq.c
index ad15470..5b685fb 100644
--- a/asoc/codecs/wcd9xxx-irq.c
+++ b/asoc/codecs/wcd9xxx-irq.c
@@ -1,13 +1,5 @@
-/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/bitops.h>
#include <linux/kernel.h>
@@ -533,7 +525,7 @@
int wcd9xxx_irq_init(struct wcd9xxx_core_resource *wcd9xxx_res)
{
int i, ret;
- u8 irq_level[wcd9xxx_res->num_irq_regs];
+ u8 *irq_level = NULL;
struct irq_domain *domain;
struct device_node *pnode;
@@ -563,9 +555,7 @@
ret = wcd9xxx_irq_setup_downstream_irq(wcd9xxx_res);
if (ret) {
pr_err("%s: Failed to setup downstream IRQ\n", __func__);
- wcd9xxx_irq_put_upstream_irq(wcd9xxx_res);
- mutex_destroy(&wcd9xxx_res->irq_lock);
- mutex_destroy(&wcd9xxx_res->nested_irq_lock);
+ goto fail_irq_level;
return ret;
}
@@ -573,7 +563,11 @@
wcd9xxx_res->irq_level_high[0] = true;
/* mask all the interrupts */
- memset(irq_level, 0, wcd9xxx_res->num_irq_regs);
+ irq_level = kzalloc(wcd9xxx_res->num_irq_regs, GFP_KERNEL);
+ if (!irq_level) {
+ ret = -ENOMEM;
+ goto fail_irq_level;
+ }
for (i = 0; i < wcd9xxx_res->num_irqs; i++) {
wcd9xxx_res->irq_masks_cur[BIT_BYTE(i)] |= BYTE_BIT_MASK(i);
wcd9xxx_res->irq_masks_cache[BIT_BYTE(i)] |= BYTE_BIT_MASK(i);
@@ -618,11 +612,14 @@
if (ret)
goto fail_irq_init;
+ kfree(irq_level);
return ret;
fail_irq_init:
dev_err(wcd9xxx_res->dev,
"%s: Failed to init wcd9xxx irq\n", __func__);
+ kfree(irq_level);
+fail_irq_level:
wcd9xxx_irq_put_upstream_irq(wcd9xxx_res);
mutex_destroy(&wcd9xxx_res->irq_lock);
mutex_destroy(&wcd9xxx_res->nested_irq_lock);
diff --git a/asoc/codecs/wcd9xxx-irq.h b/asoc/codecs/wcd9xxx-irq.h
index dfe0b92..83f86b3 100644
--- a/asoc/codecs/wcd9xxx-irq.h
+++ b/asoc/codecs/wcd9xxx-irq.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/types.h>
diff --git a/asoc/codecs/wcd9xxx-regmap.h b/asoc/codecs/wcd9xxx-regmap.h
index 1ac32bb..2c7af0d 100644
--- a/asoc/codecs/wcd9xxx-regmap.h
+++ b/asoc/codecs/wcd9xxx-regmap.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WCD9XXX_REGMAP_
@@ -17,7 +9,7 @@
#include <linux/regmap.h>
#include "core.h"
-typedef int (*regmap_patch_fptr)(struct regmap *, int);
+typedef int (*regmap_patch_fptr)(struct regmap *regmap, int version);
extern struct regmap_config wcd934x_regmap_config;
extern int wcd934x_regmap_register_patch(struct regmap *regmap,
diff --git a/asoc/codecs/wcd9xxx-resmgr-v2.c b/asoc/codecs/wcd9xxx-resmgr-v2.c
index d390558..4636f43 100644
--- a/asoc/codecs/wcd9xxx-resmgr-v2.c
+++ b/asoc/codecs/wcd9xxx-resmgr-v2.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -57,8 +49,9 @@
if (reg == WCD93XX_CLK_SYS_MCLK_PRG)
return 0;
}
- if (resmgr->codec) {
- ret = snd_soc_update_bits(resmgr->codec, reg, mask, val);
+ if (resmgr->component) {
+ ret = snd_soc_component_update_bits(resmgr->component, reg,
+ mask, val);
} else if (resmgr->core_res->wcd_core_regmap) {
ret = regmap_update_bits_check(
resmgr->core_res->wcd_core_regmap,
@@ -85,8 +78,8 @@
if (reg == WCD93XX_CLK_SYS_MCLK_PRG)
return 0;
}
- if (resmgr->codec) {
- val = snd_soc_read(resmgr->codec, reg);
+ if (resmgr->component) {
+ val = snd_soc_component_read32(resmgr->component, reg);
} else if (resmgr->core_res->wcd_core_regmap) {
ret = regmap_read(resmgr->core_res->wcd_core_regmap,
reg, &val);
@@ -122,8 +115,8 @@
if (resmgr->resmgr_cb &&
resmgr->resmgr_cb->cdc_rco_ctrl) {
while (clk_users--)
- resmgr->resmgr_cb->cdc_rco_ctrl(resmgr->codec,
- true);
+ resmgr->resmgr_cb->cdc_rco_ctrl(
+ resmgr->component, true);
}
}
}
@@ -616,11 +609,11 @@
* wcd_resmgr_init: initialize wcd resource manager
* @core_res: handle to struct wcd9xxx_core_resource
*
- * Early init call without a handle to snd_soc_codec *
+ * Early init call without a handle to snd_soc_component *
*/
struct wcd9xxx_resmgr_v2 *wcd_resmgr_init(
struct wcd9xxx_core_resource *core_res,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct wcd9xxx_resmgr_v2 *resmgr;
struct wcd9xxx *wcd9xxx;
@@ -642,7 +635,7 @@
resmgr->clk_mclk_users = 0;
resmgr->clk_rco_users = 0;
resmgr->master_bias_users = 0;
- resmgr->codec = codec;
+ resmgr->component = component;
resmgr->core_res = core_res;
resmgr->sido_input_src = SIDO_SOURCE_INTERNAL;
resmgr->codec_type = wcd9xxx->type;
@@ -666,24 +659,24 @@
* wcd_resmgr_post_init: post init call to assign codec handle
* @resmgr: handle to struct wcd9xxx_resmgr_v2 created during early init
* @resmgr_cb: codec callback function for resmgr
- * @codec: handle to struct snd_soc_codec
+ * @component: handle to struct snd_soc_component
*/
int wcd_resmgr_post_init(struct wcd9xxx_resmgr_v2 *resmgr,
const struct wcd_resmgr_cb *resmgr_cb,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
if (!resmgr) {
pr_err("%s: resmgr not allocated\n", __func__);
return -EINVAL;
}
- if (!codec) {
+ if (!component) {
pr_err("%s: Codec memory is NULL, nothing to post init\n",
__func__);
return -EINVAL;
}
- resmgr->codec = codec;
+ resmgr->component = component;
resmgr->resmgr_cb = resmgr_cb;
return 0;
diff --git a/asoc/codecs/wcd9xxx-resmgr-v2.h b/asoc/codecs/wcd9xxx-resmgr-v2.h
index e9d3531..8eceb83 100644
--- a/asoc/codecs/wcd9xxx-resmgr-v2.h
+++ b/asoc/codecs/wcd9xxx-resmgr-v2.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __WCD9XXX_COMMON_V2_H__
#define __WCD9XXX_COMMON_V2_H__
@@ -28,11 +20,11 @@
};
struct wcd_resmgr_cb {
- int (*cdc_rco_ctrl)(struct snd_soc_codec *, bool);
+ int (*cdc_rco_ctrl)(struct snd_soc_component *component, bool enable);
};
struct wcd9xxx_resmgr_v2 {
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct wcd9xxx_core_resource *core_res;
int master_bias_users;
@@ -74,11 +66,11 @@
int wcd_resmgr_disable_master_bias(struct wcd9xxx_resmgr_v2 *resmgr);
struct wcd9xxx_resmgr_v2 *wcd_resmgr_init(
struct wcd9xxx_core_resource *core_res,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
void wcd_resmgr_remove(struct wcd9xxx_resmgr_v2 *resmgr);
int wcd_resmgr_post_init(struct wcd9xxx_resmgr_v2 *resmgr,
const struct wcd_resmgr_cb *resmgr_cb,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
int wcd_resmgr_enable_clk_block(struct wcd9xxx_resmgr_v2 *resmgr,
enum wcd_clock_type type);
int wcd_resmgr_disable_clk_block(struct wcd9xxx_resmgr_v2 *resmgr,
diff --git a/asoc/codecs/wcd9xxx-rst.c b/asoc/codecs/wcd9xxx-rst.c
index c1f456c..84225de 100644
--- a/asoc/codecs/wcd9xxx-rst.c
+++ b/asoc/codecs/wcd9xxx-rst.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
diff --git a/asoc/codecs/wcd9xxx-slimslave.c b/asoc/codecs/wcd9xxx-slimslave.c
index 66a8332..3636bb5 100644
--- a/asoc/codecs/wcd9xxx-slimslave.c
+++ b/asoc/codecs/wcd9xxx-slimslave.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/slab.h>
#include <linux/mutex.h>
diff --git a/asoc/codecs/wcd9xxx-slimslave.h b/asoc/codecs/wcd9xxx-slimslave.h
index 5132e43..9ab7404 100644
--- a/asoc/codecs/wcd9xxx-slimslave.h
+++ b/asoc/codecs/wcd9xxx-slimslave.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __WCD9XXX_SLIMSLAVE_H_
diff --git a/asoc/codecs/wcd9xxx-soc-init.c b/asoc/codecs/wcd9xxx-soc-init.c
index fa8abb7..4e2d837 100644
--- a/asoc/codecs/wcd9xxx-soc-init.c
+++ b/asoc/codecs/wcd9xxx-soc-init.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
diff --git a/asoc/codecs/wcd9xxx-utils.c b/asoc/codecs/wcd9xxx-utils.c
index 8ca55f8..0e238fc 100644
--- a/asoc/codecs/wcd9xxx-utils.c
+++ b/asoc/codecs/wcd9xxx-utils.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/asoc/codecs/wcd9xxx-utils.h b/asoc/codecs/wcd9xxx-utils.h
index a7ec56c..17bb9fd 100644
--- a/asoc/codecs/wcd9xxx-utils.h
+++ b/asoc/codecs/wcd9xxx-utils.h
@@ -1,13 +1,5 @@
-/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __WCD9XXX_UTILS_H__
@@ -28,10 +20,10 @@
int wcd9xxx_reset_low(struct device *dev);
int wcd9xxx_get_codec_info(struct device *dev);
-typedef int (*codec_bringup_fn)(struct wcd9xxx *);
-typedef int (*codec_bringdown_fn)(struct wcd9xxx *);
-typedef int (*codec_type_fn)(struct wcd9xxx *,
- struct wcd9xxx_codec_type *);
+typedef int (*codec_bringup_fn)(struct wcd9xxx *dev);
+typedef int (*codec_bringdown_fn)(struct wcd9xxx *dev);
+typedef int (*codec_type_fn)(struct wcd9xxx *dev,
+ struct wcd9xxx_codec_type *wcd_type);
codec_bringdown_fn wcd9xxx_bringdown_fn(int type);
codec_bringup_fn wcd9xxx_bringup_fn(int type);
diff --git a/asoc/codecs/wcd_cmi_api.h b/asoc/codecs/wcd_cmi_api.h
index 39be641..bc7bd86 100644
--- a/asoc/codecs/wcd_cmi_api.h
+++ b/asoc/codecs/wcd_cmi_api.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __CMI_API__
diff --git a/asoc/codecs/wcd_cpe_core.c b/asoc/codecs/wcd_cpe_core.c
index 2e154e7..00a3843 100644
--- a/asoc/codecs/wcd_cpe_core.c
+++ b/asoc/codecs/wcd_cpe_core.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -100,7 +92,7 @@
static struct wcd_cpe_core *core_d;
static struct cpe_lsm_session
*lsm_sessions[WCD_CPE_LSM_MAX_SESSIONS + 1];
-struct wcd_cpe_core * (*wcd_get_cpe_core)(struct snd_soc_codec *);
+struct wcd_cpe_core * (*wcd_get_cpe_core)(struct snd_soc_component *component);
static struct wcd_cmi_afe_port_data afe_ports[WCD_CPE_AFE_MAX_PORTS + 1];
static void wcd_cpe_svc_event_cb(const struct cpe_svc_notification *param);
static int wcd_cpe_setup_irqs(struct wcd_cpe_core *core);
@@ -378,7 +370,7 @@
return -EINVAL;
}
- ret = core->cpe_cdc_cb->cdc_clk_en(core->codec, enable);
+ ret = core->cpe_cdc_cb->cdc_clk_en(core->component, enable);
if (ret) {
dev_err(core->dev, "%s: Failed to enable RCO\n",
__func__);
@@ -393,7 +385,7 @@
* and be disabled at the last time.
*/
if (core->cpe_clk_ref == 0) {
- ret = core->cpe_cdc_cb->cpe_clk_en(core->codec, enable);
+ ret = core->cpe_cdc_cb->cpe_clk_en(core->component, enable);
if (ret) {
dev_err(core->dev,
"%s: cpe_clk_en() failed, err = %d\n",
@@ -410,7 +402,7 @@
cpe_clk_fail:
/* Release the codec clk if CPE clk enable failed */
if (enable) {
- ret1 = core->cpe_cdc_cb->cdc_clk_en(core->codec, !enable);
+ ret1 = core->cpe_cdc_cb->cdc_clk_en(core->component, !enable);
if (ret1)
dev_err(core->dev,
"%s: Fail to release codec clk, err = %d\n",
@@ -442,7 +434,7 @@
if (core->cpe_cdc_cb->bus_vote_bw) {
dev_dbg(core->dev, "%s: %s cdc bus max bandwidth\n",
__func__, vote ? "Vote" : "Unvote");
- core->cpe_cdc_cb->bus_vote_bw(core->codec, vote);
+ core->cpe_cdc_cb->bus_vote_bw(core->component, vote);
}
return 0;
@@ -462,7 +454,7 @@
{
int ret, phdr_idx;
- struct snd_soc_codec *codec = NULL;
+ struct snd_soc_component *component = NULL;
struct wcd9xxx *wcd9xxx = NULL;
const struct elf32_hdr *ehdr;
const struct elf32_phdr *phdr;
@@ -477,8 +469,8 @@
core);
return -EINVAL;
}
- codec = core->codec;
- wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ component = core->component;
+ wcd9xxx = dev_get_drvdata(component->dev->parent);
snprintf(mdt_name, sizeof(mdt_name), "%s.mdt", core->fname);
ret = request_firmware(&fw, mdt_name, core->dev);
if (ret < 0) {
@@ -625,32 +617,32 @@
/*
* wcd_cpe_get_core_handle: get the handle to wcd_cpe_core
- * @codec: codec from which this handle is to be obtained
+ * @component: codec from which this handle is to be obtained
* Codec driver should provide a callback function to obtain
* handle to wcd_cpe_core during initialization of wcd_cpe_core
*/
void *wcd_cpe_get_core_handle(
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct wcd_cpe_core *core = NULL;
- if (!codec) {
+ if (!component) {
pr_err("%s: Invalid codec handle\n",
__func__);
goto done;
}
if (!wcd_get_cpe_core) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: codec callback not available\n",
__func__);
goto done;
}
- core = wcd_get_cpe_core(codec);
+ core = wcd_get_cpe_core(component);
if (!core)
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: handle to core not available\n",
__func__);
done:
@@ -1026,7 +1018,7 @@
if (core->ssr_type == WCD_CPE_SSR_EVENT) {
if (CPE_ERR_IRQ_CB(core))
core->cpe_cdc_cb->cpe_err_irq_control(
- core->codec,
+ core->component,
CPE_ERR_IRQ_STATUS,
&status);
if (status & core->irq_info.cpe_fatal_irqs)
@@ -1088,7 +1080,7 @@
* error interrupts are cleared
*/
if (CPE_ERR_IRQ_CB(core))
- core->cpe_cdc_cb->cpe_err_irq_control(core->codec,
+ core->cpe_cdc_cb->cpe_err_irq_control(core->component,
CPE_ERR_IRQ_CLEAR, NULL);
err_ret:
@@ -1186,7 +1178,7 @@
return IRQ_HANDLED;
}
- core->cpe_cdc_cb->cpe_err_irq_control(core->codec,
+ core->cpe_cdc_cb->cpe_err_irq_control(core->component,
CPE_ERR_IRQ_STATUS, &status);
while (status != 0) {
@@ -1206,18 +1198,18 @@
* Mask the interrupt that was raised to
* avoid spurious interrupts
*/
- core->cpe_cdc_cb->cpe_err_irq_control(core->codec,
+ core->cpe_cdc_cb->cpe_err_irq_control(core->component,
CPE_ERR_IRQ_MASK, &status);
/* Clear only the interrupt that was raised */
- core->cpe_cdc_cb->cpe_err_irq_control(core->codec,
+ core->cpe_cdc_cb->cpe_err_irq_control(core->component,
CPE_ERR_IRQ_CLEAR, &status);
dev_err(core->dev,
"%s: err_interrupt status = 0x%x\n",
__func__, status);
/* Read status for pending interrupts */
- core->cpe_cdc_cb->cpe_err_irq_control(core->codec,
+ core->cpe_cdc_cb->cpe_err_irq_control(core->component,
CPE_ERR_IRQ_STATUS, &status);
}
@@ -1337,7 +1329,7 @@
*/
static void wcd_cpe_svc_event_cb(const struct cpe_svc_notification *param)
{
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct wcd_cpe_core *core;
struct cpe_svc_boot_event *boot_data;
bool active_sessions;
@@ -1347,14 +1339,14 @@
return;
}
- codec = param->private_data;
- if (!codec) {
+ component = param->private_data;
+ if (!component) {
pr_err("%s: Invalid handle to codec\n",
__func__);
return;
}
- core = wcd_cpe_get_core_handle(codec);
+ core = wcd_cpe_get_core_handle(component);
if (!core) {
pr_err("%s: Invalid handle to core\n",
__func__);
@@ -1430,8 +1422,8 @@
static void wcd_cpe_cleanup_irqs(struct wcd_cpe_core *core)
{
- struct snd_soc_codec *codec = core->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component = core->component;
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_core_resource *core_res = &wcd9xxx->core_res;
wcd9xxx_free_irq(core_res,
@@ -1452,8 +1444,8 @@
static int wcd_cpe_setup_irqs(struct wcd_cpe_core *core)
{
int ret;
- struct snd_soc_codec *codec = core->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
+ struct snd_soc_component *component = core->component;
+ struct wcd9xxx *wcd9xxx = dev_get_drvdata(component->dev->parent);
struct wcd9xxx_core_resource *core_res = &wcd9xxx->core_res;
ret = wcd9xxx_request_irq(core_res,
@@ -1469,14 +1461,14 @@
/* Make sure all error interrupts are cleared */
if (CPE_ERR_IRQ_CB(core))
core->cpe_cdc_cb->cpe_err_irq_control(
- core->codec,
+ core->component,
CPE_ERR_IRQ_CLEAR,
NULL);
/* Enable required error interrupts */
if (CPE_ERR_IRQ_CB(core))
core->cpe_cdc_cb->cpe_err_irq_control(
- core->codec,
+ core->component,
CPE_ERR_IRQ_UNMASK,
NULL);
@@ -1862,27 +1854,27 @@
}
static int wcd_cpe_validate_params(
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
struct wcd_cpe_params *params)
{
- if (!codec) {
+ if (!component) {
pr_err("%s: Invalid codec\n", __func__);
return -EINVAL;
}
if (!params) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: No params supplied for codec %s\n",
- __func__, codec->component.name);
+ __func__, component->name);
return -EINVAL;
}
- if (!params->codec || !params->get_cpe_core ||
+ if (!params->component || !params->get_cpe_core ||
!params->cdc_cb) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid params for codec %s\n",
- __func__, codec->component.name);
+ __func__, component->name);
return -EINVAL;
}
@@ -1892,14 +1884,14 @@
/*
* wcd_cpe_init: Initialize CPE related structures
* @img_fname: filename for firmware image
- * @codec: handle to codec requesting for image download
+ * @component: handle to codec requesting for image download
* @params: parameter structure passed from caller
*
* This API will initialize the cpe core but will not
* download the image or boot the cpe core.
*/
struct wcd_cpe_core *wcd_cpe_init(const char *img_fname,
- struct snd_soc_codec *codec,
+ struct snd_soc_component *component,
struct wcd_cpe_params *params)
{
struct wcd_cpe_core *core;
@@ -1912,7 +1904,7 @@
const struct cpe_svc_hw_cfg *hw_info;
int id = 0;
- if (wcd_cpe_validate_params(codec, params))
+ if (wcd_cpe_validate_params(component, params))
return NULL;
core = kzalloc(sizeof(struct wcd_cpe_core), GFP_KERNEL);
@@ -1924,8 +1916,8 @@
wcd_get_cpe_core = params->get_cpe_core;
- core->codec = params->codec;
- core->dev = params->codec->dev;
+ core->component = params->component;
+ core->dev = params->component->dev;
core->cpe_debug_mode = params->dbg_mode;
core->cdc_info.major_version = params->cdc_major_ver;
@@ -1977,7 +1969,7 @@
goto fail_cpe_register;
}
- card = codec->component.card->snd_card;
+ card = component->card->snd_card;
snprintf(proc_name, (sizeof("cpe") + sizeof("_state") +
sizeof(id) - 2), "%s%d%s", cpe_name, id, state_name);
entry = snd_info_create_card_entry(card, proc_name,
@@ -3256,10 +3248,10 @@
struct cpe_lsm_session *session)
{
struct wcd_cpe_core *core = core_handle;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
int rc = 0;
- if (!core || !core->codec) {
+ if (!core || !core->component) {
pr_err("%s: Invalid handle to %s\n",
__func__,
(!core) ? "core" : "codec");
@@ -3283,8 +3275,8 @@
goto done;
}
- codec = core->codec;
- rc = core->cpe_cdc_cb->get_afe_out_port_id(codec,
+ component = core->component;
+ rc = core->cpe_cdc_cb->get_afe_out_port_id(component,
&session->afe_out_port_id);
if (rc) {
dev_err(core->dev,
@@ -3675,11 +3667,11 @@
enum wcd_cpe_event event)
{
struct wcd_cpe_core *core = core_handle;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
int rc = 0;
u8 cpe_intr_bits;
- if (!core || !core->codec) {
+ if (!core || !core->component) {
pr_err("%s: Invalid handle to %s\n",
__func__,
(!core) ? "core" : "codec");
@@ -3697,14 +3689,14 @@
goto done;
}
- codec = core->codec;
+ component = core->component;
dev_dbg(core->dev,
"%s: event = 0x%x\n",
__func__, event);
switch (event) {
case WCD_CPE_PRE_ENABLE:
- rc = core->cpe_cdc_cb->cdc_ext_clk(codec, true, false);
+ rc = core->cpe_cdc_cb->cdc_ext_clk(component, true, false);
if (rc) {
dev_err(core->dev,
"%s: failed to enable cdc clk, err = %d\n",
@@ -3712,13 +3704,14 @@
goto done;
}
- rc = core->cpe_cdc_cb->lab_cdc_ch_ctl(codec,
+ rc = core->cpe_cdc_cb->lab_cdc_ch_ctl(component,
true);
if (rc) {
dev_err(core->dev,
"%s: failed to enable cdc port, err = %d\n",
__func__, rc);
- rc = core->cpe_cdc_cb->cdc_ext_clk(codec, false, false);
+ rc = core->cpe_cdc_cb->cdc_ext_clk(
+ component, false, false);
goto done;
}
@@ -3739,11 +3732,11 @@
cpe_intr_bits = ~(core->irq_info.cpe_fatal_irqs & 0xFF);
if (CPE_ERR_IRQ_CB(core))
core->cpe_cdc_cb->cpe_err_irq_control(
- core->codec,
+ core->component,
CPE_ERR_IRQ_MASK,
&cpe_intr_bits);
- rc = core->cpe_cdc_cb->lab_cdc_ch_ctl(codec,
+ rc = core->cpe_cdc_cb->lab_cdc_ch_ctl(component,
false);
if (rc)
dev_err(core->dev,
@@ -3765,7 +3758,7 @@
"%s: Failed to disable lab\n", __func__);
/* Continue with disabling even if toggle lab fails */
- rc = core->cpe_cdc_cb->cdc_ext_clk(codec, false, false);
+ rc = core->cpe_cdc_cb->cdc_ext_clk(component, false, false);
if (rc)
dev_err(core->dev,
"%s: failed to disable cdc clk, err = %d\n",
@@ -3775,7 +3768,7 @@
cpe_intr_bits = ~(core->irq_info.cpe_fatal_irqs & 0xFF);
if (CPE_ERR_IRQ_CB(core))
core->cpe_cdc_cb->cpe_err_irq_control(
- core->codec,
+ core->component,
CPE_ERR_IRQ_UNMASK,
&cpe_intr_bits);
break;
@@ -3915,7 +3908,7 @@
/*
* wcd_cpe_get_lsm_ops: register lsm driver to codec
* @lsm_ops: structure with lsm callbacks
- * @codec: codec to which this lsm driver is registered to
+ * @component: codec to which this lsm driver is registered to
*/
int wcd_cpe_get_lsm_ops(struct wcd_cpe_lsm_ops *lsm_ops)
{
diff --git a/asoc/codecs/wcd_cpe_core.h b/asoc/codecs/wcd_cpe_core.h
index 269c5f2..105ece0 100644
--- a/asoc/codecs/wcd_cpe_core.h
+++ b/asoc/codecs/wcd_cpe_core.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef WCD_CPE_CORE_H
@@ -58,18 +50,20 @@
struct wcd_cpe_cdc_cb {
/* codec provided callback to enable RCO */
- int (*cdc_clk_en)(struct snd_soc_codec *, bool);
+ int (*cdc_clk_en)(struct snd_soc_component *cpmponent, bool enable);
/* callback for FLL setup for codec */
- int (*cpe_clk_en)(struct snd_soc_codec *, bool);
- int (*cdc_ext_clk)(struct snd_soc_codec *codec, int enable, bool dapm);
- int (*lab_cdc_ch_ctl)(struct snd_soc_codec *codec, u8 event);
- int (*get_afe_out_port_id)(struct snd_soc_codec *codec, u16 *port_id);
- int (*bus_vote_bw)(struct snd_soc_codec *codec,
+ int (*cpe_clk_en)(struct snd_soc_component *component, bool enable);
+ int (*cdc_ext_clk)(struct snd_soc_component *component, int enable,
+ bool dapm);
+ int (*lab_cdc_ch_ctl)(struct snd_soc_component *component, u8 event);
+ int (*get_afe_out_port_id)(struct snd_soc_component *component,
+ u16 *port_id);
+ int (*bus_vote_bw)(struct snd_soc_component *component,
bool vote);
/* Callback to control the cpe error interrupt mask/status/clear */
- int (*cpe_err_irq_control)(struct snd_soc_codec *codec,
+ int (*cpe_err_irq_control)(struct snd_soc_component *component,
enum cpe_err_irq_cntl_type cntl_type,
u8 *status);
};
@@ -122,7 +116,7 @@
void *cmi_afe_handle;
/* handle to codec */
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
/* codec device */
struct device *dev;
@@ -208,9 +202,9 @@
};
struct wcd_cpe_params {
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct wcd_cpe_core * (*get_cpe_core)(
- struct snd_soc_codec *);
+ struct snd_soc_component *component);
const struct wcd_cpe_cdc_cb *cdc_cb;
int dbg_mode;
u16 cdc_major_ver;
@@ -226,7 +220,7 @@
int wcd_cpe_ssr_event(void *core_handle,
enum wcd_cpe_ssr_state_event event);
struct wcd_cpe_core *wcd_cpe_init(const char *img_fname,
-struct snd_soc_codec *codec, struct wcd_cpe_params *params);
+struct snd_soc_component *component, struct wcd_cpe_params *params);
#else /* CONFIG_SND_SOC_WCD_CPE */
static inline int wcd_cpe_ssr_event(void *core_handle,
enum wcd_cpe_ssr_state_event event)
@@ -234,8 +228,8 @@
return 0;
}
static inline struct wcd_cpe_core *wcd_cpe_init(const char *img_fname,
- struct snd_soc_codec *codec,
- struct wcd_cpe_params *params)
+ struct snd_soc_component *component,
+ struct wcd_cpe_params *params)
{
return NULL;
}
diff --git a/asoc/codecs/wcd_cpe_services.c b/asoc/codecs/wcd_cpe_services.c
index e584cf0..a443963 100644
--- a/asoc/codecs/wcd_cpe_services.c
+++ b/asoc/codecs/wcd_cpe_services.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
diff --git a/asoc/codecs/wcd_cpe_services.h b/asoc/codecs/wcd_cpe_services.h
index 68eb619..1627cd8 100644
--- a/asoc/codecs/wcd_cpe_services.h
+++ b/asoc/codecs/wcd_cpe_services.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __CPE_SERVICES__
diff --git a/asoc/codecs/wcdcal-hwdep.c b/asoc/codecs/wcdcal-hwdep.c
index 31eae69..162c407 100644
--- a/asoc/codecs/wcdcal-hwdep.c
+++ b/asoc/codecs/wcdcal-hwdep.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2015, 2017-2018 The Linux Foundation. All rights reserved.
*
*/
#include <linux/kernel.h>
@@ -160,7 +152,8 @@
return 0;
}
-int wcd_cal_create_hwdep(void *data, int node, struct snd_soc_codec *codec)
+int wcd_cal_create_hwdep(void *data, int node,
+ struct snd_soc_component *component)
{
char hwname[40];
struct snd_hwdep *hwdep;
@@ -168,23 +161,23 @@
struct fw_info *fw_data = data;
int err, cal_bit;
- if (!fw_data || !codec) {
+ if (!fw_data || !component) {
pr_err("%s: wrong arguments passed\n", __func__);
return -EINVAL;
}
fw = fw_data->fw;
snprintf(hwname, strlen("Codec %s"), "Codec %s",
- codec->component.name);
- err = snd_hwdep_new(codec->component.card->snd_card,
+ component->name);
+ err = snd_hwdep_new(component->card->snd_card,
hwname, node, &hwdep);
if (err < 0) {
- dev_err(codec->dev, "%s: new hwdep failed %d\n",
+ dev_err(component->dev, "%s: new hwdep failed %d\n",
__func__, err);
return err;
}
snprintf(hwdep->name, strlen("Codec %s"), "Codec %s",
- codec->component.name);
+ component->name);
hwdep->iface = SNDRV_HWDEP_IFACE_AUDIO_CODEC;
hwdep->private_data = fw_data;
hwdep->ops.ioctl_compat = wcdcal_hwdep_ioctl_compat;
@@ -196,11 +189,8 @@
set_bit(WCDCAL_UNINITIALISED,
&fw_data->wcdcal_state[cal_bit]);
fw[cal_bit] = kzalloc(sizeof *(fw[cal_bit]), GFP_KERNEL);
- if (!fw[cal_bit]) {
- dev_err(codec->dev, "%s: no memory for %s cal\n",
- __func__, cal_name_info[cal_bit]);
+ if (!fw[cal_bit])
goto end;
- }
}
for_each_set_bit(cal_bit, fw_data->cal_bit, WCD9XXX_MAX_CAL) {
fw[cal_bit]->data = kzalloc(cal_size_info[cal_bit],
diff --git a/asoc/codecs/wcdcal-hwdep.h b/asoc/codecs/wcdcal-hwdep.h
index 632e2f1..9606cd5 100644
--- a/asoc/codecs/wcdcal-hwdep.h
+++ b/asoc/codecs/wcdcal-hwdep.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2014, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2014, 2018, The Linux Foundation. All rights reserved.
*/
#ifndef __WCD9XXX_HWDEP_H__
#define __WCD9XXX_HWDEP_H__
@@ -34,7 +26,8 @@
};
struct snd_soc_codec;
-int wcd_cal_create_hwdep(void *fw, int node, struct snd_soc_codec *codec);
+int wcd_cal_create_hwdep(void *fw, int node,
+ struct snd_soc_component *component);
struct firmware_cal *wcdcal_get_fw_cal(struct fw_info *fw_data,
enum wcd_cal_type type);
#endif /* __WCD9XXX_HWDEP_H__ */
diff --git a/asoc/codecs/wsa881x-registers.h b/asoc/codecs/wsa881x-registers.h
index 825a5f0..c39edef 100644
--- a/asoc/codecs/wsa881x-registers.h
+++ b/asoc/codecs/wsa881x-registers.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef WSA881X_REGISTERS_H
diff --git a/asoc/codecs/wsa881x-regmap.c b/asoc/codecs/wsa881x-regmap.c
index 63bbbfa..8663db9 100644
--- a/asoc/codecs/wsa881x-regmap.c
+++ b/asoc/codecs/wsa881x-regmap.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/regmap.h>
diff --git a/asoc/codecs/wsa881x-tables.c b/asoc/codecs/wsa881x-tables.c
index 4f1212b..e531832 100644
--- a/asoc/codecs/wsa881x-tables.c
+++ b/asoc/codecs/wsa881x-tables.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/regmap.h>
diff --git a/asoc/codecs/wsa881x-temp-sensor.c b/asoc/codecs/wsa881x-temp-sensor.c
index 2a1291f..598449c 100644
--- a/asoc/codecs/wsa881x-temp-sensor.c
+++ b/asoc/codecs/wsa881x-temp-sensor.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015, 2017-2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/bitops.h>
@@ -38,7 +30,7 @@
int *temp)
{
struct wsa881x_tz_priv *pdata;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct wsa_temp_register reg;
int dmeas, d1, d2;
int ret = 0;
@@ -52,8 +44,8 @@
if (thermal->devdata) {
pdata = thermal->devdata;
- if (pdata->codec) {
- codec = pdata->codec;
+ if (pdata->component) {
+ component = pdata->component;
} else {
pr_err("%s: codec is NULL\n", __func__);
return -EINVAL;
@@ -78,7 +70,7 @@
temp_retry:
if (pdata->wsa_temp_reg_read) {
- ret = pdata->wsa_temp_reg_read(codec, ®);
+ ret = pdata->wsa_temp_reg_read(component, ®);
if (ret) {
pr_err("%s: temp read failed: %d, current temp: %d\n",
__func__, ret, pdata->curr_temp);
diff --git a/asoc/codecs/wsa881x-temp-sensor.h b/asoc/codecs/wsa881x-temp-sensor.h
index 26828b7..7c90526 100644
--- a/asoc/codecs/wsa881x-temp-sensor.h
+++ b/asoc/codecs/wsa881x-temp-sensor.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2015, 2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef WSA881X_TEMP_SENSOR_H
#define WSA881X_TEMP_SENSOR_H
@@ -23,11 +15,11 @@
u8 dmeas_msb;
u8 dmeas_lsb;
};
-typedef int32_t (*wsa_temp_register_read)(struct snd_soc_codec *codec,
+typedef int32_t (*wsa_temp_register_read)(struct snd_soc_component *component,
struct wsa_temp_register *wsa_temp_reg);
struct wsa881x_tz_priv {
struct thermal_zone_device *tz_dev;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
struct wsa_temp_register *wsa_temp_reg;
char name[80];
wsa_temp_register_read wsa_temp_reg_read;
diff --git a/asoc/codecs/wsa881x.c b/asoc/codecs/wsa881x.c
index c8ae53d..da33494 100644
--- a/asoc/codecs/wsa881x.c
+++ b/asoc/codecs/wsa881x.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
@@ -36,6 +28,7 @@
#include "wsa881x.h"
#include "wsa881x-temp-sensor.h"
+#define DRV_NAME "wsa-codec"
#define WSA881X_NUM_RETRY 5
enum {
@@ -88,7 +81,7 @@
struct regmap *regmap;
struct device *dev;
struct swr_device *swr_slave;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
bool comp_enable;
bool boost_enable;
bool visense_enable;
@@ -135,7 +128,7 @@
static unsigned int read_data;
static unsigned int devnum;
-static int32_t wsa881x_resource_acquire(struct snd_soc_codec *codec,
+static int32_t wsa881x_resource_acquire(struct snd_soc_component *component,
bool enable);
static const char * const wsa_pa_gain_text[] = {
@@ -150,12 +143,14 @@
static int wsa_pa_gain_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = wsa881x->pa_gain;
- dev_dbg(codec->dev, "%s: PA gain = 0x%x\n", __func__, wsa881x->pa_gain);
+ dev_dbg(component->dev, "%s: PA gain = 0x%x\n", __func__,
+ wsa881x->pa_gain);
return 0;
}
@@ -163,10 +158,11 @@
static int wsa_pa_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
wsa881x->pa_gain = ucontrol->value.integer.value[0];
@@ -178,8 +174,9 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = wsa881x->pa_mute;
@@ -189,15 +186,17 @@
static int wsa881x_set_mute(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
int value = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: mute current %d, new %d\n",
+ dev_dbg(component->dev, "%s: mute current %d, new %d\n",
__func__, wsa881x->pa_mute, value);
if (value)
- snd_soc_update_bits(codec, WSA881X_SPKR_DRV_EN, 0x80, 0x00);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_DRV_EN,
+ 0x80, 0x00);
wsa881x->pa_mute = value;
return 0;
@@ -207,12 +206,13 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
struct wsa881x_tz_priv *pdata = &wsa881x->tz_pdata;
ucontrol->value.integer.value[0] = pdata->t0_init;
- dev_dbg(codec->dev, "%s: t0 init %d\n", __func__, pdata->t0_init);
+ dev_dbg(component->dev, "%s: t0 init %d\n", __func__, pdata->t0_init);
return 0;
}
@@ -220,12 +220,13 @@
static int wsa881x_set_t0_init(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
struct wsa881x_tz_priv *pdata = &wsa881x->tz_pdata;
pdata->t0_init = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: t0 init %d\n", __func__, pdata->t0_init);
+ dev_dbg(component->dev, "%s: t0 init %d\n", __func__, pdata->t0_init);
return 0;
}
@@ -294,7 +295,7 @@
/*
* wsa881x_codec_info_create_codec_entry - creates wsa881x module
* @codec_root: The parent directory
- * @codec: Codec instance
+ * @component: Codec instance
*
* Creates wsa881x module and version entry under the given
* parent directory.
@@ -302,18 +303,18 @@
* Return: 0 on success or negative error code on failure.
*/
int wsa881x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
struct snd_info_entry *version_entry;
struct wsa881x_priv *wsa881x;
struct snd_soc_card *card;
char name[80];
- if (!codec_root || !codec)
+ if (!codec_root || !component)
return -EINVAL;
- wsa881x = snd_soc_codec_get_drvdata(codec);
- card = codec->component.card;
+ wsa881x = snd_soc_component_get_drvdata(component);
+ card = component->card;
snprintf(name, sizeof(name), "%s.%x", "wsa881x",
(u32)wsa881x->swr_slave->addr);
@@ -321,7 +322,7 @@
(const char *)name,
codec_root);
if (!wsa881x->entry) {
- dev_dbg(codec->dev, "%s: failed to create wsa881x entry\n",
+ dev_dbg(component->dev, "%s: failed to create wsa881x entry\n",
__func__);
return -ENOMEM;
}
@@ -330,7 +331,7 @@
"version",
wsa881x->entry);
if (!version_entry) {
- dev_dbg(codec->dev, "%s: failed to create wsa881x version entry\n",
+ dev_dbg(component->dev, "%s: failed to create wsa881x version entry\n",
__func__);
return -ENOMEM;
}
@@ -538,13 +539,15 @@
{WSA881X_SPKR_PROT_FE_GAIN, 0x47, 0},
};
-static int wsa881x_boost_ctrl(struct snd_soc_codec *codec, bool enable)
+static int wsa881x_boost_ctrl(struct snd_soc_component *component, bool enable)
{
- dev_dbg(codec->dev, "%s: enable:%d\n", __func__, enable);
+ dev_dbg(component->dev, "%s: enable:%d\n", __func__, enable);
if (enable)
- snd_soc_update_bits(codec, WSA881X_BOOST_EN_CTL, 0x80, 0x80);
+ snd_soc_component_update_bits(component, WSA881X_BOOST_EN_CTL,
+ 0x80, 0x80);
else
- snd_soc_update_bits(codec, WSA881X_BOOST_EN_CTL, 0x80, 0x00);
+ snd_soc_component_update_bits(component, WSA881X_BOOST_EN_CTL,
+ 0x80, 0x00);
/*
* 1.5ms sleep is needed after boost enable/disable as per
* HW requirement
@@ -553,13 +556,13 @@
return 0;
}
-static int wsa881x_visense_txfe_ctrl(struct snd_soc_codec *codec, bool enable,
- u8 isense1_gain, u8 isense2_gain,
- u8 vsense_gain)
+static int wsa881x_visense_txfe_ctrl(struct snd_soc_component *component,
+ bool enable, u8 isense1_gain,
+ u8 isense2_gain, u8 vsense_gain)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev,
+ dev_dbg(component->dev,
"%s: enable:%d, isense1 gain: %d, isense2 gain: %d, vsense_gain %d\n",
__func__, enable, isense1_gain, isense2_gain, vsense_gain);
@@ -568,79 +571,91 @@
wsa881x_vi_txfe_en_2_0,
ARRAY_SIZE(wsa881x_vi_txfe_en_2_0));
} else {
- snd_soc_update_bits(codec, WSA881X_SPKR_PROT_FE_VSENSE_VCM,
- 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WSA881X_SPKR_PROT_FE_VSENSE_VCM,
+ 0x08, 0x08);
/*
* 200us sleep is needed after visense txfe disable as per
* HW requirement.
*/
usleep_range(200, 210);
- snd_soc_update_bits(codec, WSA881X_SPKR_PROT_FE_GAIN,
- 0x01, 0x00);
+ snd_soc_component_update_bits(component,
+ WSA881X_SPKR_PROT_FE_GAIN,
+ 0x01, 0x00);
}
return 0;
}
-static int wsa881x_visense_adc_ctrl(struct snd_soc_codec *codec, bool enable)
+static int wsa881x_visense_adc_ctrl(struct snd_soc_component *component,
+ bool enable)
{
- dev_dbg(codec->dev, "%s: enable:%d\n", __func__, enable);
- snd_soc_update_bits(codec, WSA881X_ADC_EN_MODU_V, (0x01 << 7),
- (enable << 7));
- snd_soc_update_bits(codec, WSA881X_ADC_EN_MODU_I, (0x01 << 7),
- (enable << 7));
+ dev_dbg(component->dev, "%s: enable:%d\n", __func__, enable);
+ snd_soc_component_update_bits(component, WSA881X_ADC_EN_MODU_V,
+ (0x01 << 7), (enable << 7));
+ snd_soc_component_update_bits(component, WSA881X_ADC_EN_MODU_I,
+ (0x01 << 7), (enable << 7));
return 0;
}
-static void wsa881x_bandgap_ctrl(struct snd_soc_codec *codec, bool enable)
+static void wsa881x_bandgap_ctrl(struct snd_soc_component *component,
+ bool enable)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s: enable:%d, bg_count:%d\n", __func__,
+ dev_dbg(component->dev, "%s: enable:%d, bg_count:%d\n", __func__,
enable, wsa881x->bg_cnt);
mutex_lock(&wsa881x->bg_lock);
if (enable) {
++wsa881x->bg_cnt;
if (wsa881x->bg_cnt == 1) {
- snd_soc_update_bits(codec, WSA881X_TEMP_OP,
- 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WSA881X_TEMP_OP,
+ 0x08, 0x08);
/* 400usec sleep is needed as per HW requirement */
usleep_range(400, 410);
- snd_soc_update_bits(codec, WSA881X_TEMP_OP,
- 0x04, 0x04);
+ snd_soc_component_update_bits(component,
+ WSA881X_TEMP_OP,
+ 0x04, 0x04);
}
} else {
--wsa881x->bg_cnt;
if (wsa881x->bg_cnt <= 0) {
WARN_ON(wsa881x->bg_cnt < 0);
wsa881x->bg_cnt = 0;
- snd_soc_update_bits(codec, WSA881X_TEMP_OP, 0x04, 0x00);
- snd_soc_update_bits(codec, WSA881X_TEMP_OP, 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WSA881X_TEMP_OP, 0x04, 0x00);
+ snd_soc_component_update_bits(component,
+ WSA881X_TEMP_OP, 0x08, 0x00);
}
}
mutex_unlock(&wsa881x->bg_lock);
}
-static void wsa881x_clk_ctrl(struct snd_soc_codec *codec, bool enable)
+static void wsa881x_clk_ctrl(struct snd_soc_component *component, bool enable)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s: enable:%d, clk_count:%d\n", __func__,
+ dev_dbg(component->dev, "%s: enable:%d, clk_count:%d\n", __func__,
enable, wsa881x->clk_cnt);
mutex_lock(&wsa881x->res_lock);
if (enable) {
++wsa881x->clk_cnt;
if (wsa881x->clk_cnt == 1) {
- snd_soc_write(codec, WSA881X_CDC_DIG_CLK_CTL, 0x01);
- snd_soc_write(codec, WSA881X_CDC_ANA_CLK_CTL, 0x01);
+ snd_soc_component_write(component,
+ WSA881X_CDC_DIG_CLK_CTL, 0x01);
+ snd_soc_component_write(component,
+ WSA881X_CDC_ANA_CLK_CTL, 0x01);
}
} else {
--wsa881x->clk_cnt;
if (wsa881x->clk_cnt <= 0) {
WARN_ON(wsa881x->clk_cnt < 0);
wsa881x->clk_cnt = 0;
- snd_soc_write(codec, WSA881X_CDC_DIG_CLK_CTL, 0x00);
- snd_soc_write(codec, WSA881X_CDC_ANA_CLK_CTL, 0x00);
+ snd_soc_component_write(component,
+ WSA881X_CDC_DIG_CLK_CTL, 0x00);
+ snd_soc_component_write(component,
+ WSA881X_CDC_ANA_CLK_CTL, 0x00);
}
}
mutex_unlock(&wsa881x->res_lock);
@@ -650,8 +665,9 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = wsa881x->comp_enable;
return 0;
@@ -660,11 +676,12 @@
static int wsa881x_set_compander(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
int value = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: Compander enable current %d, new %d\n",
+ dev_dbg(component->dev, "%s: Compander enable current %d, new %d\n",
__func__, wsa881x->comp_enable, value);
wsa881x->comp_enable = value;
return 0;
@@ -674,8 +691,9 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = wsa881x->boost_enable;
return 0;
@@ -684,11 +702,12 @@
static int wsa881x_set_boost(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
int value = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: Boost enable current %d, new %d\n",
+ dev_dbg(component->dev, "%s: Boost enable current %d, new %d\n",
__func__, wsa881x->boost_enable, value);
wsa881x->boost_enable = value;
return 0;
@@ -698,8 +717,9 @@
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = wsa881x->visense_enable;
return 0;
@@ -708,11 +728,12 @@
static int wsa881x_set_visense(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
int value = ucontrol->value.integer.value[0];
- dev_dbg(codec->dev, "%s: VIsense enable current %d, new %d\n",
+ dev_dbg(component->dev, "%s: VIsense enable current %d, new %d\n",
__func__, wsa881x->visense_enable, value);
wsa881x->visense_enable = value;
return 0;
@@ -721,14 +742,15 @@
static int wsa881x_set_boost_level(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u8 wsa_boost_level = 0;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
wsa_boost_level = ucontrol->value.integer.value[0];
- snd_soc_update_bits(codec, WSA881X_BOOST_PRESET_OUT1,
+ snd_soc_component_update_bits(component, WSA881X_BOOST_PRESET_OUT1,
0xff, wsa_boost_level);
return 0;
@@ -737,12 +759,14 @@
static int wsa881x_get_boost_level(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
u8 wsa_boost_level = 0;
- wsa_boost_level = snd_soc_read(codec, WSA881X_BOOST_PRESET_OUT1);
+ wsa_boost_level = snd_soc_component_read32(component,
+ WSA881X_BOOST_PRESET_OUT1);
ucontrol->value.integer.value[0] = wsa_boost_level;
- dev_dbg(codec->dev, "%s: boost level = 0x%x\n", __func__,
+ dev_dbg(component->dev, "%s: boost level = 0x%x\n", __func__,
wsa_boost_level);
return 0;
@@ -766,11 +790,11 @@
SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0)
};
-static int wsa881x_set_port(struct snd_soc_codec *codec, int port_idx,
+static int wsa881x_set_port(struct snd_soc_component *component, int port_idx,
u8 *port_id, u8 *num_ch, u8 *ch_mask, u32 *ch_rate,
u8 *port_type)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
*port_id = wsa881x->port[port_idx].port_id;
*num_ch = wsa881x->port[port_idx].num_ch;
@@ -783,8 +807,9 @@
static int wsa881x_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
u8 port_id[WSA881X_MAX_SWR_PORTS];
u8 num_ch[WSA881X_MAX_SWR_PORTS];
u8 ch_mask[WSA881X_MAX_SWR_PORTS];
@@ -792,35 +817,35 @@
u8 port_type[WSA881X_MAX_SWR_PORTS];
u8 num_port = 0;
- dev_dbg(codec->dev, "%s: event %d name %s\n", __func__,
+ dev_dbg(component->dev, "%s: event %d name %s\n", __func__,
event, w->name);
if (wsa881x == NULL)
return -EINVAL;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- wsa881x_set_port(codec, SWR_DAC_PORT,
+ wsa881x_set_port(component, SWR_DAC_PORT,
&port_id[num_port], &num_ch[num_port],
&ch_mask[num_port], &ch_rate[num_port],
&port_type[num_port]);
++num_port;
if (wsa881x->comp_enable) {
- wsa881x_set_port(codec, SWR_COMP_PORT,
+ wsa881x_set_port(component, SWR_COMP_PORT,
&port_id[num_port], &num_ch[num_port],
&ch_mask[num_port], &ch_rate[num_port],
&port_type[num_port]);
++num_port;
}
if (wsa881x->boost_enable) {
- wsa881x_set_port(codec, SWR_BOOST_PORT,
+ wsa881x_set_port(component, SWR_BOOST_PORT,
&port_id[num_port], &num_ch[num_port],
&ch_mask[num_port], &ch_rate[num_port],
&port_type[num_port]);
++num_port;
}
if (wsa881x->visense_enable) {
- wsa881x_set_port(codec, SWR_VISENSE_PORT,
+ wsa881x_set_port(component, SWR_VISENSE_PORT,
&port_id[num_port], &num_ch[num_port],
&ch_mask[num_port], &ch_rate[num_port],
&port_type[num_port]);
@@ -835,28 +860,28 @@
case SND_SOC_DAPM_PRE_PMD:
break;
case SND_SOC_DAPM_POST_PMD:
- wsa881x_set_port(codec, SWR_DAC_PORT,
+ wsa881x_set_port(component, SWR_DAC_PORT,
&port_id[num_port], &num_ch[num_port],
&ch_mask[num_port], &ch_rate[num_port],
&port_type[num_port]);
++num_port;
if (wsa881x->comp_enable) {
- wsa881x_set_port(codec, SWR_COMP_PORT,
+ wsa881x_set_port(component, SWR_COMP_PORT,
&port_id[num_port], &num_ch[num_port],
&ch_mask[num_port], &ch_rate[num_port],
&port_type[num_port]);
++num_port;
}
if (wsa881x->boost_enable) {
- wsa881x_set_port(codec, SWR_BOOST_PORT,
+ wsa881x_set_port(component, SWR_BOOST_PORT,
&port_id[num_port], &num_ch[num_port],
&ch_mask[num_port], &ch_rate[num_port],
&port_type[num_port]);
++num_port;
}
if (wsa881x->visense_enable) {
- wsa881x_set_port(codec, SWR_VISENSE_PORT,
+ wsa881x_set_port(component, SWR_VISENSE_PORT,
&port_id[num_port], &num_ch[num_port],
&ch_mask[num_port], &ch_rate[num_port],
&port_type[num_port]);
@@ -874,40 +899,41 @@
static int wsa881x_rdac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s: %s %d boost %d visense %d\n", __func__,
+ dev_dbg(component->dev, "%s: %s %d boost %d visense %d\n", __func__,
w->name, event, wsa881x->boost_enable,
wsa881x->visense_enable);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
mutex_lock(&wsa881x->temp_lock);
- wsa881x_resource_acquire(codec, ENABLE);
+ wsa881x_resource_acquire(component, ENABLE);
mutex_unlock(&wsa881x->temp_lock);
- wsa881x_boost_ctrl(codec, ENABLE);
+ wsa881x_boost_ctrl(component, ENABLE);
break;
case SND_SOC_DAPM_POST_PMD:
swr_slvdev_datapath_control(wsa881x->swr_slave,
wsa881x->swr_slave->dev_num,
false);
- wsa881x_boost_ctrl(codec, DISABLE);
+ wsa881x_boost_ctrl(component, DISABLE);
mutex_lock(&wsa881x->temp_lock);
- wsa881x_resource_acquire(codec, DISABLE);
+ wsa881x_resource_acquire(component, DISABLE);
mutex_unlock(&wsa881x->temp_lock);
break;
}
return 0;
}
-static int wsa881x_ramp_pa_gain(struct snd_soc_codec *codec,
+static int wsa881x_ramp_pa_gain(struct snd_soc_component *component,
int min_gain, int max_gain, int udelay)
{
int val;
for (val = min_gain; max_gain <= val; val--) {
- snd_soc_update_bits(codec, WSA881X_SPKR_DRV_GAIN,
+ snd_soc_component_update_bits(component, WSA881X_SPKR_DRV_GAIN,
0xF0, val << 4);
/*
* 1ms delay is needed for every step change in gain as per
@@ -922,20 +948,22 @@
{
struct wsa881x_priv *wsa881x;
struct delayed_work *dwork;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
int temp_val;
dwork = to_delayed_work(work);
wsa881x = container_of(dwork, struct wsa881x_priv, ocp_ctl_work);
- codec = wsa881x->codec;
+ component = wsa881x->component;
wsa881x_get_temp(wsa881x->tz_pdata.tz_dev, &temp_val);
- dev_dbg(codec->dev, " temp = %d\n", temp_val);
+ dev_dbg(component->dev, " temp = %d\n", temp_val);
if (temp_val <= WSA881X_OCP_CTL_TEMP_CELSIUS)
- snd_soc_update_bits(codec, WSA881X_SPKR_OCP_CTL, 0xC0, 0x00);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_OCP_CTL,
+ 0xC0, 0x00);
else
- snd_soc_update_bits(codec, WSA881X_SPKR_OCP_CTL, 0xC0, 0xC0);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_OCP_CTL,
+ 0xC0, 0xC0);
schedule_delayed_work(&wsa881x->ocp_ctl_work,
msecs_to_jiffies(wsa881x_ocp_poll_timer_sec * 1000));
@@ -944,14 +972,16 @@
static int wsa881x_spkr_pa_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
int min_gain, max_gain;
- dev_dbg(codec->dev, "%s: %s %d\n", __func__, w->name, event);
+ dev_dbg(component->dev, "%s: %s %d\n", __func__, w->name, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, WSA881X_SPKR_OCP_CTL, 0xC0, 0x80);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_OCP_CTL,
+ 0xC0, 0x80);
regmap_multi_reg_write(wsa881x->regmap,
wsa881x_pre_pmu_pa_2_0,
ARRAY_SIZE(wsa881x_pre_pmu_pa_2_0));
@@ -960,11 +990,13 @@
true);
/* Set register mode if compander is not enabled */
if (!wsa881x->comp_enable)
- snd_soc_update_bits(codec, WSA881X_SPKR_DRV_GAIN,
- 0x08, 0x08);
+ snd_soc_component_update_bits(component,
+ WSA881X_SPKR_DRV_GAIN,
+ 0x08, 0x08);
else
- snd_soc_update_bits(codec, WSA881X_SPKR_DRV_GAIN,
- 0x08, 0x00);
+ snd_soc_component_update_bits(component,
+ WSA881X_SPKR_DRV_GAIN,
+ 0x08, 0x00);
break;
case SND_SOC_DAPM_POST_PMU:
@@ -983,14 +1015,16 @@
* as per HW requirement.
*/
usleep_range(1000, 1010);
- wsa881x_ramp_pa_gain(codec, min_gain, max_gain, 1000);
+ wsa881x_ramp_pa_gain(component, min_gain, max_gain,
+ 1000);
}
if (wsa881x->visense_enable) {
- wsa881x_visense_txfe_ctrl(codec, ENABLE,
+ wsa881x_visense_txfe_ctrl(component, ENABLE,
0x00, 0x03, 0x01);
- snd_soc_update_bits(codec, WSA881X_ADC_EN_SEL_IBAIS,
- 0x07, 0x01);
- wsa881x_visense_adc_ctrl(codec, ENABLE);
+ snd_soc_component_update_bits(component,
+ WSA881X_ADC_EN_SEL_IBAIS,
+ 0x07, 0x01);
+ wsa881x_visense_adc_ctrl(component, ENABLE);
}
schedule_delayed_work(&wsa881x->ocp_ctl_work,
msecs_to_jiffies(WSA881X_OCP_CTL_TIMER_SEC * 1000));
@@ -1000,12 +1034,13 @@
break;
case SND_SOC_DAPM_POST_PMD:
if (wsa881x->visense_enable) {
- wsa881x_visense_adc_ctrl(codec, DISABLE);
- wsa881x_visense_txfe_ctrl(codec, DISABLE,
+ wsa881x_visense_adc_ctrl(component, DISABLE);
+ wsa881x_visense_txfe_ctrl(component, DISABLE,
0x00, 0x01, 0x01);
}
cancel_delayed_work_sync(&wsa881x->ocp_ctl_work);
- snd_soc_update_bits(codec, WSA881X_SPKR_OCP_CTL, 0xC0, 0xC0);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_OCP_CTL,
+ 0xC0, 0xC0);
break;
}
return 0;
@@ -1037,16 +1072,16 @@
{"SPKR", NULL, "SPKR PGA"},
};
-int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port, u8 num_port,
- unsigned int *ch_mask, unsigned int *ch_rate,
- u8 *port_type)
+int wsa881x_set_channel_map(struct snd_soc_component *component, u8 *port,
+ u8 num_port, unsigned int *ch_mask,
+ unsigned int *ch_rate, u8 *port_type)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
int i;
if (!port || !ch_mask || !ch_rate ||
(num_port > WSA881X_MAX_SWR_PORTS)) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s: Invalid port=%pK, ch_mask=%pK, ch_rate=%pK\n",
__func__, port, ch_mask, ch_rate);
return -EINVAL;
@@ -1063,70 +1098,91 @@
}
EXPORT_SYMBOL(wsa881x_set_channel_map);
-static void wsa881x_init(struct snd_soc_codec *codec)
+static void wsa881x_init(struct snd_soc_component *component)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
- wsa881x->version = snd_soc_read(codec, WSA881X_CHIP_ID1);
+ wsa881x->version =
+ snd_soc_component_read32(component, WSA881X_CHIP_ID1);
wsa881x_regmap_defaults(wsa881x->regmap, wsa881x->version);
/* Enable software reset output from soundwire slave */
- snd_soc_update_bits(codec, WSA881X_SWR_RESET_EN, 0x07, 0x07);
+ snd_soc_component_update_bits(component, WSA881X_SWR_RESET_EN,
+ 0x07, 0x07);
/* Bring out of analog reset */
- snd_soc_update_bits(codec, WSA881X_CDC_RST_CTL, 0x02, 0x02);
+ snd_soc_component_update_bits(component, WSA881X_CDC_RST_CTL,
+ 0x02, 0x02);
/* Bring out of digital reset */
- snd_soc_update_bits(codec, WSA881X_CDC_RST_CTL, 0x01, 0x01);
+ snd_soc_component_update_bits(component, WSA881X_CDC_RST_CTL,
+ 0x01, 0x01);
- snd_soc_update_bits(codec, WSA881X_CLOCK_CONFIG, 0x10, 0x10);
- snd_soc_update_bits(codec, WSA881X_SPKR_OCP_CTL, 0x02, 0x02);
- snd_soc_update_bits(codec, WSA881X_SPKR_MISC_CTL1, 0xC0, 0x80);
- snd_soc_update_bits(codec, WSA881X_SPKR_MISC_CTL1, 0x06, 0x06);
- snd_soc_update_bits(codec, WSA881X_SPKR_BIAS_INT, 0xFF, 0x00);
- snd_soc_update_bits(codec, WSA881X_SPKR_PA_INT, 0xF0, 0x40);
- snd_soc_update_bits(codec, WSA881X_SPKR_PA_INT, 0x0E, 0x0E);
- snd_soc_update_bits(codec, WSA881X_BOOST_LOOP_STABILITY,
- 0x03, 0x03);
- snd_soc_update_bits(codec, WSA881X_BOOST_MISC2_CTL, 0xFF, 0x14);
- snd_soc_update_bits(codec, WSA881X_BOOST_START_CTL, 0x80, 0x80);
- snd_soc_update_bits(codec, WSA881X_BOOST_START_CTL, 0x03, 0x00);
- snd_soc_update_bits(codec, WSA881X_BOOST_SLOPE_COMP_ISENSE_FB,
- 0x0C, 0x04);
- snd_soc_update_bits(codec, WSA881X_BOOST_SLOPE_COMP_ISENSE_FB,
- 0x03, 0x00);
- if (snd_soc_read(codec, WSA881X_OTP_REG_0))
- snd_soc_update_bits(codec, WSA881X_BOOST_PRESET_OUT1,
- 0xF0, 0x70);
- snd_soc_update_bits(codec, WSA881X_BOOST_PRESET_OUT2,
- 0xF0, 0x30);
- snd_soc_update_bits(codec, WSA881X_SPKR_DRV_EN, 0x08, 0x08);
- snd_soc_update_bits(codec, WSA881X_BOOST_CURRENT_LIMIT,
- 0x0F, 0x08);
- snd_soc_update_bits(codec, WSA881X_SPKR_OCP_CTL, 0x30, 0x30);
- snd_soc_update_bits(codec, WSA881X_SPKR_OCP_CTL, 0x0C, 0x00);
- snd_soc_update_bits(codec, WSA881X_OTP_REG_28, 0x3F, 0x3A);
- snd_soc_update_bits(codec, WSA881X_BONGO_RESRV_REG1,
- 0xFF, 0xB2);
- snd_soc_update_bits(codec, WSA881X_BONGO_RESRV_REG2,
- 0xFF, 0x05);
+ snd_soc_component_update_bits(component, WSA881X_CLOCK_CONFIG,
+ 0x10, 0x10);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_OCP_CTL,
+ 0x02, 0x02);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_MISC_CTL1,
+ 0xC0, 0x80);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_MISC_CTL1,
+ 0x06, 0x06);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_BIAS_INT,
+ 0xFF, 0x00);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_PA_INT,
+ 0xF0, 0x40);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_PA_INT,
+ 0x0E, 0x0E);
+ snd_soc_component_update_bits(component, WSA881X_BOOST_LOOP_STABILITY,
+ 0x03, 0x03);
+ snd_soc_component_update_bits(component, WSA881X_BOOST_MISC2_CTL,
+ 0xFF, 0x14);
+ snd_soc_component_update_bits(component, WSA881X_BOOST_START_CTL,
+ 0x80, 0x80);
+ snd_soc_component_update_bits(component, WSA881X_BOOST_START_CTL,
+ 0x03, 0x00);
+ snd_soc_component_update_bits(component,
+ WSA881X_BOOST_SLOPE_COMP_ISENSE_FB,
+ 0x0C, 0x04);
+ snd_soc_component_update_bits(component,
+ WSA881X_BOOST_SLOPE_COMP_ISENSE_FB,
+ 0x03, 0x00);
+ if (snd_soc_component_read32(component, WSA881X_OTP_REG_0))
+ snd_soc_component_update_bits(component,
+ WSA881X_BOOST_PRESET_OUT1,
+ 0xF0, 0x70);
+ snd_soc_component_update_bits(component, WSA881X_BOOST_PRESET_OUT2,
+ 0xF0, 0x30);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_DRV_EN,
+ 0x08, 0x08);
+ snd_soc_component_update_bits(component, WSA881X_BOOST_CURRENT_LIMIT,
+ 0x0F, 0x08);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_OCP_CTL,
+ 0x30, 0x30);
+ snd_soc_component_update_bits(component, WSA881X_SPKR_OCP_CTL,
+ 0x0C, 0x00);
+ snd_soc_component_update_bits(component, WSA881X_OTP_REG_28,
+ 0x3F, 0x3A);
+ snd_soc_component_update_bits(component, WSA881X_BONGO_RESRV_REG1,
+ 0xFF, 0xB2);
+ snd_soc_component_update_bits(component, WSA881X_BONGO_RESRV_REG2,
+ 0xFF, 0x05);
}
-static int32_t wsa881x_resource_acquire(struct snd_soc_codec *codec,
+static int32_t wsa881x_resource_acquire(struct snd_soc_component *component,
bool enable)
{
- wsa881x_clk_ctrl(codec, enable);
- wsa881x_bandgap_ctrl(codec, enable);
+ wsa881x_clk_ctrl(component, enable);
+ wsa881x_bandgap_ctrl(component, enable);
return 0;
}
-static int32_t wsa881x_temp_reg_read(struct snd_soc_codec *codec,
+static int32_t wsa881x_temp_reg_read(struct snd_soc_component *component,
struct wsa_temp_register *wsa_temp_reg)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
struct swr_device *dev;
u8 retry = WSA881X_NUM_RETRY;
u8 devnum = 0;
if (!wsa881x) {
- dev_err(codec->dev, "%s: wsa881x is NULL\n", __func__);
+ dev_err(component->dev, "%s: wsa881x is NULL\n", __func__);
return -EINVAL;
}
dev = wsa881x->swr_slave;
@@ -1137,7 +1193,7 @@
usleep_range(1000, 1100);
}
if (retry == 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"%s get devnum %d for dev addr %lx failed\n",
__func__, devnum, dev->addr);
return -EINVAL;
@@ -1145,81 +1201,78 @@
}
wsa881x_regcache_sync(wsa881x);
mutex_lock(&wsa881x->temp_lock);
- wsa881x_resource_acquire(codec, ENABLE);
+ wsa881x_resource_acquire(component, ENABLE);
- snd_soc_update_bits(codec, WSA881X_TADC_VALUE_CTL, 0x01, 0x00);
- wsa_temp_reg->dmeas_msb = snd_soc_read(codec, WSA881X_TEMP_MSB);
- wsa_temp_reg->dmeas_lsb = snd_soc_read(codec, WSA881X_TEMP_LSB);
- snd_soc_update_bits(codec, WSA881X_TADC_VALUE_CTL, 0x01, 0x01);
- wsa_temp_reg->d1_msb = snd_soc_read(codec, WSA881X_OTP_REG_1);
- wsa_temp_reg->d1_lsb = snd_soc_read(codec, WSA881X_OTP_REG_2);
- wsa_temp_reg->d2_msb = snd_soc_read(codec, WSA881X_OTP_REG_3);
- wsa_temp_reg->d2_lsb = snd_soc_read(codec, WSA881X_OTP_REG_4);
+ snd_soc_component_update_bits(component, WSA881X_TADC_VALUE_CTL,
+ 0x01, 0x00);
+ wsa_temp_reg->dmeas_msb = snd_soc_component_read32(
+ component, WSA881X_TEMP_MSB);
+ wsa_temp_reg->dmeas_lsb = snd_soc_component_read32(
+ component, WSA881X_TEMP_LSB);
+ snd_soc_component_update_bits(component, WSA881X_TADC_VALUE_CTL,
+ 0x01, 0x01);
+ wsa_temp_reg->d1_msb = snd_soc_component_read32(
+ component, WSA881X_OTP_REG_1);
+ wsa_temp_reg->d1_lsb = snd_soc_component_read32(
+ component, WSA881X_OTP_REG_2);
+ wsa_temp_reg->d2_msb = snd_soc_component_read32(
+ component, WSA881X_OTP_REG_3);
+ wsa_temp_reg->d2_lsb = snd_soc_component_read32(
+ component, WSA881X_OTP_REG_4);
- wsa881x_resource_acquire(codec, DISABLE);
+ wsa881x_resource_acquire(component, DISABLE);
mutex_unlock(&wsa881x->temp_lock);
return 0;
}
-static int wsa881x_probe(struct snd_soc_codec *codec)
+static int wsa881x_probe(struct snd_soc_component *component)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
struct swr_device *dev;
if (!wsa881x)
return -EINVAL;
+ snd_soc_component_init_regmap(component, wsa881x->regmap);
dev = wsa881x->swr_slave;
- wsa881x->codec = codec;
+ wsa881x->component = component;
mutex_init(&wsa881x->bg_lock);
- wsa881x_init(codec);
+ wsa881x_init(component);
snprintf(wsa881x->tz_pdata.name, sizeof(wsa881x->tz_pdata.name),
"%s.%x", "wsatz", (u8)dev->addr);
wsa881x->bg_cnt = 0;
wsa881x->clk_cnt = 0;
- wsa881x->tz_pdata.codec = codec;
+ wsa881x->tz_pdata.component = component;
wsa881x->tz_pdata.wsa_temp_reg_read = wsa881x_temp_reg_read;
wsa881x_init_thermal(&wsa881x->tz_pdata);
- snd_soc_add_codec_controls(codec, wsa_snd_controls,
+ snd_soc_add_component_controls(component, wsa_snd_controls,
ARRAY_SIZE(wsa_snd_controls));
INIT_DELAYED_WORK(&wsa881x->ocp_ctl_work, wsa881x_ocp_ctl_work);
return 0;
}
-static int wsa881x_remove(struct snd_soc_codec *codec)
+static void wsa881x_remove(struct snd_soc_component *component)
{
- struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
+ struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(component);
if (wsa881x->tz_pdata.tz_dev)
wsa881x_deinit_thermal(wsa881x->tz_pdata.tz_dev);
mutex_destroy(&wsa881x->bg_lock);
- return 0;
+ return;
}
-static struct regmap *wsa881x_get_regmap(struct device *dev)
-{
- struct wsa881x_priv *control = swr_get_dev_data(to_swr_device(dev));
-
- if (!control)
- return NULL;
-
- return control->regmap;
-}
-
-static struct snd_soc_codec_driver soc_codec_dev_wsa881x = {
+static const struct snd_soc_component_driver soc_codec_dev_wsa881x = {
+ .name = DRV_NAME,
.probe = wsa881x_probe,
.remove = wsa881x_remove,
- .get_regmap = wsa881x_get_regmap,
- .component_driver = {
- .controls = wsa881x_snd_controls,
- .num_controls = ARRAY_SIZE(wsa881x_snd_controls),
- .dapm_widgets = wsa881x_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(wsa881x_dapm_widgets),
- .dapm_routes = wsa881x_audio_map,
- .num_dapm_routes = ARRAY_SIZE(wsa881x_audio_map),
- },
+ .controls = wsa881x_snd_controls,
+ .num_controls = ARRAY_SIZE(wsa881x_snd_controls),
+ .dapm_widgets = wsa881x_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(wsa881x_dapm_widgets),
+ .dapm_routes = wsa881x_audio_map,
+ .num_dapm_routes = ARRAY_SIZE(wsa881x_audio_map),
};
static int wsa881x_gpio_ctrl(struct wsa881x_priv *wsa881x, bool enable)
@@ -1369,7 +1422,7 @@
goto dev_err;
}
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wsa881x,
+ ret = snd_soc_register_component(&pdev->dev, &soc_codec_dev_wsa881x,
NULL, 0);
if (ret) {
dev_err(&pdev->dev, "%s: Codec registration failed\n",
@@ -1402,7 +1455,7 @@
debugfs_wsa881x_dent = NULL;
mutex_destroy(&wsa881x->res_lock);
mutex_destroy(&wsa881x->temp_lock);
- snd_soc_unregister_codec(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
if (wsa881x->pd_gpio)
gpio_free(wsa881x->pd_gpio);
swr_set_dev_data(pdev, NULL);
diff --git a/asoc/codecs/wsa881x.h b/asoc/codecs/wsa881x.h
index 9f998e3..3922fc8 100644
--- a/asoc/codecs/wsa881x.h
+++ b/asoc/codecs/wsa881x.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WSA881X_H
@@ -21,28 +13,28 @@
#define WSA881X_MAX_SWR_PORTS 4
#if IS_ENABLED(CONFIG_SND_SOC_WSA881X)
-extern int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port,
- u8 num_port, unsigned int *ch_mask,
+extern int wsa881x_set_channel_map(struct snd_soc_component *component,
+ u8 *port, u8 num_port, unsigned int *ch_mask,
unsigned int *ch_rate, u8 *port_type);
extern const u8 wsa881x_reg_readable[WSA881X_CACHE_SIZE];
extern struct regmap_config wsa881x_regmap_config;
extern int wsa881x_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
+ struct snd_soc_component *component);
void wsa881x_regmap_defaults(struct regmap *regmap, u8 version);
#else
-extern int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port,
- u8 num_port, unsigned int *ch_mask,
- unsigned int *ch_rate, u8 *port_type);
+extern int wsa881x_set_channel_map(struct snd_soc_component *component,
+ u8 *port, u8 num_port, unsigned int *ch_mask,
+ unsigned int *ch_rate, u8 *port_type)
{
return 0;
}
extern int wsa881x_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
+ struct snd_soc_component *component)
{
return 0;
}
diff --git a/asoc/device_event.h b/asoc/device_event.h
index 408d114..e63656e 100644
--- a/asoc/device_event.h
+++ b/asoc/device_event.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __DEVICE_EVENT_H
diff --git a/asoc/machine_815x_init.c b/asoc/machine_815x_init.c
index ab1bdc1..ff01a90 100644
--- a/asoc/machine_815x_init.c
+++ b/asoc/machine_815x_init.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
/*
-Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 and
-only version 2 as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-*
-*/
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ */
#include <linux/kernel.h>
#include <linux/module.h>
diff --git a/asoc/machine_815x_init.h b/asoc/machine_815x_init.h
index 4ee6d4f..d096d97 100644
--- a/asoc/machine_815x_init.h
+++ b/asoc/machine_815x_init.h
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 and
-only version 2 as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-*
*/
#ifndef __MACHINE_815X_INIT_H__
diff --git a/asoc/msm-audio-effects-q6-v2.c b/asoc/msm-audio-effects-q6-v2.c
index b4dc30a..dcc7474 100644
--- a/asoc/msm-audio-effects-q6-v2.c
+++ b/asoc/msm-audio-effects-q6-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/slab.h>
diff --git a/asoc/msm-compress-q6-v2.c b/asoc/msm-compress-q6-v2.c
index d35ed89..bf22f87 100644
--- a/asoc/msm-compress-q6-v2.c
+++ b/asoc/msm-compress-q6-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
@@ -46,6 +38,8 @@
#include "msm-pcm-routing-v2.h"
#include "msm-qti-pp-config.h"
+#define DRV_NAME "msm-compress-q6-v2"
+
#define DSP_PP_BUFFERING_IN_MSEC 25
#define PARTIAL_DRAIN_ACK_EARLY_BY_MSEC 150
#define MP3_OUTPUT_FRAME_SZ 1152
@@ -79,6 +73,8 @@
#define MAX_NUMBER_OF_STREAMS 2
+#define SND_DEC_DDP_MAX_PARAMS 18
+
struct msm_compr_gapless_state {
bool set_next_stream_id;
int32_t stream_opened[MAX_NUMBER_OF_STREAMS];
@@ -199,6 +195,12 @@
struct query_audio_effect query;
};
+struct snd_dec_ddp {
+ __u32 params_length;
+ __u32 params_id[SND_DEC_DDP_MAX_PARAMS];
+ __u32 params_value[SND_DEC_DDP_MAX_PARAMS];
+} __attribute__((packed, aligned(4)));
+
struct msm_compr_dec_params {
struct snd_dec_ddp ddp_params;
};
@@ -346,6 +348,7 @@
uint32_t avg_vol, gain_list[VOLUME_CONTROL_MAX_CHANNELS];
uint32_t num_channels;
struct snd_soc_pcm_runtime *rtd;
+ struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata;
bool use_default = true;
u8 *chmap = NULL;
@@ -358,12 +361,13 @@
}
rtd = cstream->private_data;
prtd = cstream->runtime->private_data;
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
- if (!rtd || !rtd->platform || !prtd || !prtd->audio_client) {
+ if (!rtd || !component || !prtd || !prtd->audio_client) {
pr_err("%s: invalid rtd, prtd or audio client", __func__);
return rc;
}
- pdata = snd_soc_platform_get_drvdata(rtd->platform);
+ pdata = snd_soc_component_get_drvdata(component);
if (prtd->compr_passthr != LEGACY_PCM) {
pr_debug("%s: No volume config for passthrough %d\n",
@@ -952,8 +956,8 @@
struct snd_compr_runtime *runtime = cstream->runtime;
struct msm_compr_audio *prtd = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct msm_compr_pdata *pdata =
- snd_soc_platform_get_drvdata(rtd->platform);
+ struct snd_soc_component *component =NULL;
+ struct msm_compr_pdata *pdata = NULL;
struct asm_aac_cfg aac_cfg;
struct asm_wma_cfg wma_cfg;
struct asm_wmapro_cfg wma_pro_cfg;
@@ -974,6 +978,13 @@
pr_debug("%s: use_gapless_codec_options %d\n",
__func__, use_gapless_codec_options);
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+ pdata = snd_soc_component_get_drvdata(component);
+
if (use_gapless_codec_options)
codec_options = &(prtd->gapless_state.codec_options);
else
@@ -1598,11 +1609,17 @@
{
struct snd_compr_runtime *runtime = cstream->runtime;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
+ struct snd_soc_component *component = NULL;
struct msm_compr_audio *prtd = NULL;
- struct msm_compr_pdata *pdata =
- snd_soc_platform_get_drvdata(rtd->platform);
+ struct msm_compr_pdata *pdata = NULL;
pr_debug("%s\n", __func__);
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+ pdata = snd_soc_component_get_drvdata(component);
if (pdata->is_in_use[rtd->dai_link->id] == true) {
pr_err("%s: %s is already in use, err: %d\n",
__func__, rtd->dai_link->cpu_dai_name, -EBUSY);
@@ -1699,13 +1716,23 @@
{
struct snd_compr_runtime *runtime = cstream->runtime;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
+ struct snd_soc_component *component = NULL;
struct msm_compr_audio *prtd;
- struct msm_compr_pdata *pdata =
- snd_soc_platform_get_drvdata(rtd->platform);
+ struct msm_compr_pdata *pdata = NULL;
pr_debug("%s\n", __func__);
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+ pdata = snd_soc_component_get_drvdata(component);
+ if (!pdata) {
+ pr_err("%s: pdata is NULL\n", __func__);
+ return -EINVAL;
+ }
prtd = kzalloc(sizeof(struct msm_compr_audio), GFP_KERNEL);
- if (prtd == NULL) {
+ if (!prtd) {
pr_err("Failed to allocate memory for msm_compr_audio\n");
return -ENOMEM;
}
@@ -1766,6 +1793,7 @@
struct snd_compr_runtime *runtime;
struct msm_compr_audio *prtd;
struct snd_soc_pcm_runtime *soc_prtd;
+ struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata;
struct audio_client *ac;
int dir = IN, ret = 0, stream_id;
@@ -1780,8 +1808,9 @@
}
runtime = cstream->runtime;
soc_prtd = cstream->private_data;
- if (!runtime || !soc_prtd || !(soc_prtd->platform)) {
- pr_err("%s runtime or soc_prtd or platform is null\n",
+ component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
+ if (!runtime || !soc_prtd || !component) {
+ pr_err("%s runtime or soc_prtd or component is null\n",
__func__);
return 0;
}
@@ -1792,7 +1821,7 @@
}
prtd->cmd_interrupt = 1;
wake_up(&prtd->drain_wait);
- pdata = snd_soc_platform_get_drvdata(soc_prtd->platform);
+ pdata = snd_soc_component_get_drvdata(component);
ac = prtd->audio_client;
if (!pdata || !ac) {
pr_err("%s pdata or ac is null\n", __func__);
@@ -1867,6 +1896,7 @@
struct snd_compr_runtime *runtime;
struct msm_compr_audio *prtd;
struct snd_soc_pcm_runtime *soc_prtd;
+ struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata;
struct audio_client *ac;
int dir = OUT, stream_id;
@@ -1879,8 +1909,9 @@
}
runtime = cstream->runtime;
soc_prtd = cstream->private_data;
- if (!runtime || !soc_prtd || !(soc_prtd->platform)) {
- pr_err("%s runtime or soc_prtd or platform is null\n",
+ component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
+ if (!runtime || !soc_prtd || !component) {
+ pr_err("%s runtime or soc_prtd or component is null\n",
__func__);
return 0;
}
@@ -1889,7 +1920,7 @@
pr_err("%s prtd is null\n", __func__);
return 0;
}
- pdata = snd_soc_platform_get_drvdata(soc_prtd->platform);
+ pdata = snd_soc_component_get_drvdata(component);
ac = prtd->audio_client;
if (!pdata || !ac) {
pr_err("%s pdata or ac is null\n", __func__);
@@ -2207,9 +2238,9 @@
struct snd_compr_runtime *runtime = cstream->runtime;
struct msm_compr_audio *prtd = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct msm_compr_pdata *pdata =
- snd_soc_platform_get_drvdata(rtd->platform);
- uint32_t *volume = pdata->volume[rtd->dai_link->id];
+ struct snd_soc_component *component = NULL;
+ struct msm_compr_pdata *pdata = NULL;
+ uint32_t *volume = NULL;
struct audio_client *ac = prtd->audio_client;
unsigned long fe_id = rtd->dai_link->id;
int rc = 0;
@@ -2219,6 +2250,18 @@
uint32_t stream_index;
uint16_t bits_per_sample = 16;
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+ pdata = snd_soc_component_get_drvdata(component);
+ if (!pdata) {
+ pr_err("%s: pdata is NULL\n", __func__);
+ return -EINVAL;
+ }
+ volume = pdata->volume[rtd->dai_link->id];
+
spin_lock_irqsave(&prtd->lock, flags);
if (atomic_read(&prtd->error)) {
pr_err("%s Got RESET EVENTS notification, return immediately",
@@ -2676,6 +2719,7 @@
struct snd_compr_runtime *runtime = cstream->runtime;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct msm_compr_audio *prtd = runtime->private_data;
+ struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata = NULL;
struct snd_compr_tstamp tstamp;
uint64_t timestamp = 0;
@@ -2683,7 +2727,17 @@
unsigned long flags;
uint32_t gapless_transition;
- pdata = snd_soc_platform_get_drvdata(rtd->platform);
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+ pdata = snd_soc_component_get_drvdata(component);
+ if (!pdata) {
+ pr_err("%s: pdata is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pr_debug("%s\n", __func__);
memset(&tstamp, 0x0, sizeof(struct snd_compr_tstamp));
@@ -3906,7 +3960,7 @@
msm_compr_gapless_put),
};
-static int msm_compr_probe(struct snd_soc_platform *platform)
+static int msm_compr_probe(struct snd_soc_component *component)
{
struct msm_compr_pdata *pdata;
int i;
@@ -3919,7 +3973,7 @@
if (!pdata)
return -ENOMEM;
- snd_soc_platform_set_drvdata(platform, pdata);
+ snd_soc_component_set_drvdata(component, pdata);
for (i = 0; i < MSM_FRONTEND_DAI_MAX; i++) {
pdata->volume[i][0] = COMPRESSED_LR_VOL_MAX_STEPS;
@@ -3931,10 +3985,10 @@
pdata->is_in_use[i] = false;
}
- snd_soc_add_platform_controls(platform, msm_compr_gapless_controls,
+ snd_soc_add_component_controls(component, msm_compr_gapless_controls,
ARRAY_SIZE(msm_compr_gapless_controls));
- rc = of_property_read_string(platform->dev->of_node,
+ rc = of_property_read_string(component->dev->of_node,
"qcom,adsp-version", &qdsp_version);
if (!rc) {
if (!strcmp(qdsp_version, "MDSP 1.2"))
@@ -4018,6 +4072,7 @@
static int msm_compr_add_volume_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Compress Playback";
const char *deviceNo = "NN";
const char *suffix = "Volume";
@@ -4041,6 +4096,12 @@
pr_err("%s NULL rtd\n", __func__);
return 0;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return 0;
+ }
+
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -4056,7 +4117,7 @@
fe_volume_control[0].name = mixer_str;
fe_volume_control[0].private_value = rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s", mixer_str);
- snd_soc_add_platform_controls(rtd->platform, fe_volume_control,
+ snd_soc_add_component_controls(component, fe_volume_control,
ARRAY_SIZE(fe_volume_control));
kfree(mixer_str);
return 0;
@@ -4064,6 +4125,7 @@
static int msm_compr_add_audio_effects_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Audio Effects Config";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -4080,12 +4142,17 @@
}
};
-
if (!rtd) {
pr_err("%s NULL rtd\n", __func__);
return 0;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return 0;
+ }
+
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -4101,7 +4168,7 @@
fe_audio_effects_config_control[0].name = mixer_str;
fe_audio_effects_config_control[0].private_value = rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s\n", mixer_str);
- snd_soc_add_platform_controls(rtd->platform,
+ snd_soc_add_component_controls(component,
fe_audio_effects_config_control,
ARRAY_SIZE(fe_audio_effects_config_control));
kfree(mixer_str);
@@ -4111,6 +4178,7 @@
static int msm_compr_add_query_audio_effect_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Query Audio Effect Param";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -4130,6 +4198,13 @@
pr_err("%s NULL rtd\n", __func__);
return 0;
}
+
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return 0;
+ }
+
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -4143,7 +4218,7 @@
fe_query_audio_effect_control[0].name = mixer_str;
fe_query_audio_effect_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: registering new mixer ctl %s\n", __func__, mixer_str);
- snd_soc_add_platform_controls(rtd->platform,
+ snd_soc_add_component_controls(component,
fe_query_audio_effect_control,
ARRAY_SIZE(fe_query_audio_effect_control));
kfree(mixer_str);
@@ -4153,6 +4228,7 @@
static int msm_compr_add_audio_adsp_stream_cmd_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CMD;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -4170,23 +4246,26 @@
if (!rtd) {
pr_err("%s NULL rtd\n", __func__);
- ret = -EINVAL;
- goto done;
+ return -EINVAL;
+ }
+
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
- if (!mixer_str) {
- ret = -ENOMEM;
- goto done;
- }
+ if (!mixer_str)
+ return -ENOMEM;
snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name, rtd->pcm->device);
fe_audio_adsp_stream_cmd_config_control[0].name = mixer_str;
fe_audio_adsp_stream_cmd_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_audio_adsp_stream_cmd_config_control,
ARRAY_SIZE(fe_audio_adsp_stream_cmd_config_control));
if (ret < 0)
@@ -4201,6 +4280,7 @@
static int msm_compr_add_audio_adsp_stream_callback_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -4224,6 +4304,12 @@
goto done;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@@ -4236,7 +4322,7 @@
fe_audio_adsp_callback_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_audio_adsp_callback_config_control,
ARRAY_SIZE(fe_audio_adsp_callback_config_control));
if (ret < 0) {
@@ -4264,6 +4350,7 @@
static int msm_compr_add_dec_runtime_params_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Audio Stream";
const char *deviceNo = "NN";
const char *suffix = "Dec Params";
@@ -4286,6 +4373,12 @@
return 0;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return 0;
+ }
+
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -4303,7 +4396,7 @@
fe_dec_params_control[0].name = mixer_str;
fe_dec_params_control[0].private_value = rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s", mixer_str);
- snd_soc_add_platform_controls(rtd->platform,
+ snd_soc_add_component_controls(component,
fe_dec_params_control,
ARRAY_SIZE(fe_dec_params_control));
kfree(mixer_str);
@@ -4312,6 +4405,7 @@
static int msm_compr_add_app_type_cfg_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *playback_mixer_ctl_name = "Audio Stream";
const char *capture_mixer_ctl_name = "Audio Stream Capture";
const char *deviceNo = "NN";
@@ -4335,6 +4429,12 @@
return 0;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return 0;
+ }
+
pr_debug("%s: added new compr FE ctl with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -4372,7 +4472,7 @@
msm_compr_capture_app_type_cfg_get;
}
pr_debug("Registering new mixer ctl %s", mixer_str);
- snd_soc_add_platform_controls(rtd->platform,
+ snd_soc_add_component_controls(component,
fe_app_type_cfg_control,
ARRAY_SIZE(fe_app_type_cfg_control));
kfree(mixer_str);
@@ -4381,6 +4481,7 @@
static int msm_compr_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback Channel Map";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -4403,6 +4504,12 @@
return -EINVAL;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -4418,11 +4525,11 @@
fe_channel_map_control[0].name = mixer_str;
fe_channel_map_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- snd_soc_add_platform_controls(rtd->platform,
+ snd_soc_add_component_controls(component,
fe_channel_map_control,
ARRAY_SIZE(fe_channel_map_control));
- pdata = snd_soc_platform_get_drvdata(rtd->platform);
+ pdata = snd_soc_component_get_drvdata(component);
pdata->ch_map[rtd->dai_link->id] =
kzalloc(sizeof(struct msm_compr_ch_map), GFP_KERNEL);
if (!pdata->ch_map[rtd->dai_link->id]) {
@@ -4437,6 +4544,7 @@
static int msm_compr_add_io_fd_cmd_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback ION FD";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -4454,22 +4562,25 @@
if (!rtd) {
pr_err("%s NULL rtd\n", __func__);
- ret = -EINVAL;
- goto done;
+ return -EINVAL;
+ }
+
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
- if (!mixer_str) {
- ret = -ENOMEM;
- goto done;
- }
+ if (!mixer_str)
+ return -ENOMEM;
snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name, rtd->pcm->device);
fe_ion_fd_config_control[0].name = mixer_str;
fe_ion_fd_config_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_ion_fd_config_control,
ARRAY_SIZE(fe_ion_fd_config_control));
if (ret < 0)
@@ -4482,6 +4593,7 @@
static int msm_compr_add_event_ack_cmd_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback Event Ack";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -4499,22 +4611,25 @@
if (!rtd) {
pr_err("%s NULL rtd\n", __func__);
- ret = -EINVAL;
- goto done;
+ return -EINVAL;
+ }
+
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
- if (!mixer_str) {
- ret = -ENOMEM;
- goto done;
- }
+ if (!mixer_str)
+ return -ENOMEM;
snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name, rtd->pcm->device);
fe_event_ack_config_control[0].name = mixer_str;
fe_event_ack_config_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_event_ack_config_control,
ARRAY_SIZE(fe_event_ack_config_control));
if (ret < 0)
@@ -4593,7 +4708,8 @@
.get_codec_caps = msm_compr_get_codec_caps,
};
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.probe = msm_compr_probe,
.compr_ops = &msm_compr_ops,
.pcm_new = msm_compr_new,
@@ -4603,13 +4719,13 @@
{
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_component, NULL, 0);
}
static int msm_compr_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-cpe-lsm.c b/asoc/msm-cpe-lsm.c
index 4094c1e..19f57a1 100644
--- a/asoc/msm-cpe-lsm.c
+++ b/asoc/msm-cpe-lsm.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -28,6 +20,8 @@
#include "msm-slim-dma.h"
#include "codecs/cpe_core.h"
+#define DRV_NAME "msm-cpe-lsm"
+
#define SAMPLE_RATE_48KHZ 48000
#define SAMPLE_RATE_16KHZ 16000
#define LSM_VOICE_WAKEUP_APP_V2 2
@@ -3210,55 +3204,57 @@
}
/*
- * msm_asoc_cpe_lsm_probe: ASoC framework for lsm platform driver
- * @platform: platform registered with ASoC core
+ * msm_asoc_cpe_lsm_probe: ASoC framework for lsm component driver
+ * @component: component registered with ASoC core
*
- * Allocate the private data for this platform and obtain the ops for
+ * Allocate the private data for this component and obtain the ops for
* lsm and afe modules from underlying driver. Also find the codec
- * for this platform as specified by machine driver for ASoC framework.
+ * for this component as specified by machine driver for ASoC framework.
*/
-static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform)
+static int msm_asoc_cpe_lsm_probe(struct snd_soc_component *component)
{
struct snd_soc_card *card;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_codec *codec;
struct cpe_priv *cpe_priv;
+ struct snd_soc_component *component_rtd = NULL;
const struct snd_kcontrol_new *kcontrol;
bool found_runtime = false;
const char *cpe_dev_id = "qcom,msm-cpe-lsm-id";
u32 port_id = 0;
int ret = 0;
- if (!platform || !platform->component.card) {
- pr_err("%s: Invalid platform or card\n",
+ if (!component || !component->card) {
+ pr_err("%s: Invalid component or card\n",
__func__);
return -EINVAL;
}
- card = platform->component.card;
+ card = component->card;
- /* Match platform to codec */
+ /* Match component to codec */
list_for_each_entry(rtd, &card->rtd_list, list) {
- if (!rtd->platform)
+ component_rtd = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component_rtd)
continue;
- if (!strcmp(rtd->platform->component.name,
- platform->component.name)) {
+ if (!strcmp(component_rtd->name,
+ component->name)) {
found_runtime = true;
break;
}
}
if (!found_runtime) {
- dev_err(platform->dev,
- "%s: Failed to find runtime for platform\n",
+ dev_err(component->dev,
+ "%s: Failed to find runtime for component\n",
__func__);
return -EINVAL;
}
- ret = of_property_read_u32(platform->dev->of_node, cpe_dev_id,
+ ret = of_property_read_u32(component->dev->of_node, cpe_dev_id,
&port_id);
if (ret) {
- dev_dbg(platform->dev,
+ dev_dbg(component->dev,
"%s: missing 0x%x in dt node\n", __func__, port_id);
port_id = 1;
}
@@ -3275,7 +3271,7 @@
wcd_cpe_get_lsm_ops(&cpe_priv->lsm_ops);
wcd_cpe_get_afe_ops(&cpe_priv->afe_ops);
- snd_soc_platform_set_drvdata(platform, cpe_priv);
+ snd_soc_component_set_drvdata(component, cpe_priv);
kcontrol = &msm_cpe_kcontrols[0];
snd_ctl_add(card->snd_card, snd_ctl_new1(kcontrol, cpe_priv));
return 0;
@@ -3293,7 +3289,8 @@
.compat_ioctl = msm_cpe_lsm_ioctl_compat,
};
-static struct snd_soc_platform_driver msm_soc_cpe_platform = {
+static struct snd_soc_component_driver msm_soc_cpe_component = {
+ .name = DRV_NAME,
.ops = &msm_cpe_lsm_ops,
.probe = msm_asoc_cpe_lsm_probe,
};
@@ -3307,8 +3304,9 @@
static int msm_cpe_lsm_probe(struct platform_device *pdev)
{
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_cpe_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_cpe_component,
+ NULL, 0);
}
/*
@@ -3319,7 +3317,7 @@
*/
static int msm_cpe_lsm_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_commponent(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-dai-fe.c b/asoc/msm-dai-fe.c
index 7654e56..36fa5dd 100644
--- a/asoc/msm-dai-fe.c
+++ b/asoc/msm-dai-fe.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
diff --git a/asoc/msm-dai-q6-hdmi-v2.c b/asoc/msm-dai-q6-hdmi-v2.c
index 4291077..69332fc 100644
--- a/asoc/msm-dai-q6-hdmi-v2.c
+++ b/asoc/msm-dai-q6-hdmi-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
diff --git a/asoc/msm-dai-q6-v2.c b/asoc/msm-dai-q6-v2.c
index 9516867..b77c08f 100644
--- a/asoc/msm-dai-q6-v2.c
+++ b/asoc/msm-dai-q6-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
diff --git a/asoc/msm-dai-q6-v2.h b/asoc/msm-dai-q6-v2.h
index 2327cfd..91737c9 100644
--- a/asoc/msm-dai-q6-v2.h
+++ b/asoc/msm-dai-q6-v2.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __MSM_DAI_Q6_PDATA_H__
diff --git a/asoc/msm-dai-slim.c b/asoc/msm-dai-slim.c
index e8bdf13..db8f3dd 100644
--- a/asoc/msm-dai-slim.c
+++ b/asoc/msm-dai-slim.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
diff --git a/asoc/msm-dai-stub-v2.c b/asoc/msm-dai-stub-v2.c
index c8b6b77..76ea52c 100644
--- a/asoc/msm-dai-stub-v2.c
+++ b/asoc/msm-dai-stub-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
#include <linux/module.h>
diff --git a/asoc/msm-dolby-common.h b/asoc/msm-dolby-common.h
index 885d283..c56e115 100644
--- a/asoc/msm-dolby-common.h
+++ b/asoc/msm-dolby-common.h
@@ -1,13 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved.
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2013-2014, 2016, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_DOLBY_COMMON_H_
diff --git a/asoc/msm-dolby-dap-config.h b/asoc/msm-dolby-dap-config.h
index b2b7139..f7e21d6 100644
--- a/asoc/msm-dolby-dap-config.h
+++ b/asoc/msm-dolby-dap-config.h
@@ -1,13 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2013-2014, 2017-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_DOLBY_DAP_CONFIG_H_
@@ -74,7 +67,7 @@
return 0;
}
void msm_dolby_dap_deinit(int port_id) { }
-void msm_dolby_dap_add_controls(struct snd_soc_platform *platform) { }
+void msm_dolby_dap_add_controls(struct snd_soc_component *component) { }
int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx,
bool is_custom_stereo_enabled)
{
diff --git a/asoc/msm-ds2-dap-config.c b/asoc/msm-ds2-dap-config.c
index ad7a3c6..4971907 100644
--- a/asoc/msm-ds2-dap-config.c
+++ b/asoc/msm-ds2-dap-config.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/err.h>
diff --git a/asoc/msm-ds2-dap-config.h b/asoc/msm-ds2-dap-config.h
index 4d6b5eb..d734790 100644
--- a/asoc/msm-ds2-dap-config.h
+++ b/asoc/msm-ds2-dap-config.h
@@ -1,13 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2013-2014, 2017-2018 The Linux Foundation. All rights reserved.
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_DS2_DAP_CONFIG_H_
diff --git a/asoc/msm-lsm-client.c b/asoc/msm-lsm-client.c
index 391d719..74263e3 100644
--- a/asoc/msm-lsm-client.c
+++ b/asoc/msm-lsm-client.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
#include <linux/err.h>
@@ -33,6 +25,8 @@
#include <dsp/q6lsm.h>
#include "msm-pcm-routing-v2.h"
+#define DRV_NAME "msm-lsm-client"
+
#define CAPTURE_MIN_NUM_PERIODS 2
#define CAPTURE_MAX_NUM_PERIODS 8
#define CAPTURE_MAX_PERIOD_SIZE 61440
@@ -737,7 +731,7 @@
struct lsm_priv *prtd = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct lsm_hw_params *out_hw_params = &prtd->lsm_client->out_hw_params;
- u8 chmap[out_hw_params->num_chs];
+ u8 *chmap = NULL;
u32 ch_idx;
int rc = 0, stage_idx = p_info->stage_idx;
@@ -748,11 +742,15 @@
return rc;
}
+ chmap = kzalloc(out_hw_params->num_chs, GFP_KERNEL);
+ if (!chmap)
+ return -ENOMEM;
+
rc = q6lsm_lab_control(prtd->lsm_client, enable, p_info);
if (rc) {
dev_err(rtd->dev, "%s: Failed to set lab_control param, err = %d\n",
__func__, rc);
- return rc;
+ goto fail;
} else {
if (LSM_IS_LAST_STAGE(prtd->lsm_client, stage_idx)) {
rc = msm_lsm_lab_buffer_alloc(prtd,
@@ -761,7 +759,7 @@
dev_err(rtd->dev,
"%s: msm_lsm_lab_buffer_alloc failed rc %d for %s\n",
__func__, rc, enable ? "ALLOC" : "DEALLOC");
- return rc;
+ goto fail;
} else {
/* set client level flag based on last stage control */
prtd->lsm_client->lab_enable = enable;
@@ -771,7 +769,6 @@
prtd->lsm_client->stage_cfg[stage_idx].lab_enable = enable;
}
- memset(chmap, 0, out_hw_params->num_chs);
/*
* First channel to be read from lab is always the
* best channel (0xff). For second channel onwards,
@@ -786,6 +783,8 @@
dev_err(rtd->dev, "%s: Failed to set lab out ch cfg %d\n",
__func__, rc);
+fail:
+ kfree(chmap);
return rc;
}
@@ -2935,14 +2934,15 @@
return ret;
}
-static int msm_asoc_lsm_probe(struct snd_soc_platform *platform)
+static int msm_asoc_lsm_probe(struct snd_soc_component *component)
{
pr_debug("enter %s\n", __func__);
return 0;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_lsm_ops,
.pcm_new = msm_asoc_lsm_new,
.probe = msm_asoc_lsm_probe,
@@ -2951,12 +2951,13 @@
static int msm_lsm_probe(struct platform_device *pdev)
{
- return snd_soc_register_platform(&pdev->dev, &msm_soc_platform);
+ return snd_soc_register_component(&pdev->dev, &msm_soc_component,
+ NULL, 0);
}
static int msm_lsm_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-pcm-afe-v2.c b/asoc/msm-pcm-afe-v2.c
index 3a65fe5..a34514b 100644
--- a/asoc/msm-pcm-afe-v2.c
+++ b/asoc/msm-pcm-afe-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
@@ -32,6 +24,8 @@
#include <dsp/q6adm-v2.h>
#include "msm-pcm-afe-v2.h"
+#define DRV_NAME "msm-pcm-afe-v2"
+
#define MIN_PLAYBACK_PERIOD_SIZE (128 * 2)
#define MAX_PLAYBACK_PERIOD_SIZE (128 * 2 * 2 * 6)
#define MIN_PLAYBACK_NUM_PERIODS (4)
@@ -862,13 +856,14 @@
return ret;
}
-static int msm_afe_afe_probe(struct snd_soc_platform *platform)
+static int msm_afe_afe_probe(struct snd_soc_component *component)
{
pr_debug("%s\n", __func__);
return 0;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_afe_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_afe_afe_probe,
@@ -878,14 +873,14 @@
{
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_component, NULL, 0);
}
static int msm_afe_remove(struct platform_device *pdev)
{
pr_debug("%s\n", __func__);
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
static const struct of_device_id msm_pcm_afe_dt_match[] = {
diff --git a/asoc/msm-pcm-afe-v2.h b/asoc/msm-pcm-afe-v2.h
index 926b626..ca9dfcc 100644
--- a/asoc/msm-pcm-afe-v2.h
+++ b/asoc/msm-pcm-afe-v2.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012,2015-2016 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _MSM_PCM_AFE_H
#define _MSM_PCM_AFE_H
diff --git a/asoc/msm-pcm-dtmf-v2.c b/asoc/msm-pcm-dtmf-v2.c
index 77dc81c..e8eb468 100644
--- a/asoc/msm-pcm-dtmf-v2.c
+++ b/asoc/msm-pcm-dtmf-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2013-2014, 2017-2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -26,6 +18,8 @@
#include "msm-pcm-q6-v2.h"
#include "msm-pcm-routing-v2.h"
+#define DRV_NAME "msm-pcm-dtmf-v2"
+
enum {
DTMF_IN_RX,
DTMF_IN_TX,
@@ -165,9 +159,9 @@
msm_dtmf_detect_volte_rx_put),
};
-static int msm_pcm_dtmf_probe(struct snd_soc_platform *platform)
+static int msm_pcm_dtmf_probe(struct snd_soc_component *component)
{
- snd_soc_add_platform_controls(platform, msm_dtmf_controls,
+ snd_soc_add_component_controls(component, msm_dtmf_controls,
ARRAY_SIZE(msm_dtmf_controls));
return 0;
}
@@ -539,7 +533,8 @@
return ret;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_dtmf_probe,
@@ -549,13 +544,13 @@
{
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_component, NULL, 0);
}
static int msm_pcm_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-pcm-host-voice-v2.c b/asoc/msm-pcm-host-voice-v2.c
index 7486ad7..9fc7c88 100644
--- a/asoc/msm-pcm-host-voice-v2.c
+++ b/asoc/msm-pcm-host-voice-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -28,6 +20,8 @@
#include <dsp/msm_audio_ion.h>
#include <dsp/q6voice.h>
+#define DRV_NAME "msm-pcm-host-voice-v2"
+
#define HPCM_MAX_Q_LEN 2
#define HPCM_MIN_VOC_PKT_SIZE 320
#define HPCM_MAX_VOC_PKT_SIZE 640
@@ -1443,15 +1437,16 @@
return 0;
}
-static int msm_pcm_hpcm_probe(struct snd_soc_platform *platform)
+static int msm_pcm_hpcm_probe(struct snd_soc_component *component)
{
- snd_soc_add_platform_controls(platform, msm_hpcm_controls,
+ snd_soc_add_component_controls(component, msm_hpcm_controls,
ARRAY_SIZE(msm_hpcm_controls));
return 0;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_hpcm_probe,
@@ -1461,12 +1456,13 @@
{
pr_info("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
- return snd_soc_register_platform(&pdev->dev, &msm_soc_platform);
+ return snd_soc_register_component(&pdev->dev, &msm_soc_component,
+ NULL, 0);
}
static int msm_pcm_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-pcm-hostless.c b/asoc/msm-pcm-hostless.c
index e2850a4..9a0c52b 100644
--- a/asoc/msm-pcm-hostless.c
+++ b/asoc/msm-pcm-hostless.c
@@ -1,13 +1,5 @@
-/* Copyright (c) 2011-2014, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2011-2014, 2017-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -18,6 +10,7 @@
#include <sound/soc.h>
#include <sound/pcm.h>
+#define DRV_NAME "msm-pcm-hostless"
static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream)
{
@@ -33,7 +26,8 @@
.prepare = msm_pcm_hostless_prepare
};
-static struct snd_soc_platform_driver msm_soc_hostless_platform = {
+static struct snd_soc_component_driver msm_soc_hostless_component = {
+ .name = DRV_NAME,
.ops = &msm_pcm_hostless_ops,
};
@@ -41,13 +35,14 @@
{
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_hostless_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_hostless_component,
+ NULL, 0);
}
static int msm_pcm_hostless_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-pcm-loopback-v2.c b/asoc/msm-pcm-loopback-v2.c
index 32c727a..9b90935 100644
--- a/asoc/msm-pcm-loopback-v2.c
+++ b/asoc/msm-pcm-loopback-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -29,6 +21,8 @@
#include "msm-pcm-routing-v2.h"
+#define DRV_NAME "msm-pcm-loopback-v2"
+
#define LOOPBACK_VOL_MAX_STEPS 0x2000
#define LOOPBACK_SESSION_MAX 4
@@ -159,9 +153,9 @@
msm_loopback_session_mute_put),
};
-static int msm_pcm_loopback_probe(struct snd_soc_platform *platform)
+static int msm_pcm_loopback_probe(struct snd_soc_component *component)
{
- snd_soc_add_platform_controls(platform, msm_loopback_controls,
+ snd_soc_add_component_controls(component, msm_loopback_controls,
ARRAY_SIZE(msm_loopback_controls));
return 0;
@@ -188,10 +182,17 @@
static int msm_pcm_loopback_get_session(struct snd_soc_pcm_runtime *rtd,
struct msm_pcm_loopback **pcm)
{
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(rtd, DRV_NAME);
int ret = 0;
int n, index = -1;
- dev_dbg(rtd->platform->dev, "%s: stream %s\n", __func__,
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
+ dev_dbg(component->dev, "%s: stream %s\n", __func__,
rtd->dai_link->stream_name);
mutex_lock(&loopback_session_lock);
@@ -214,7 +215,7 @@
}
if (index < 0) {
- dev_err(rtd->platform->dev, "%s: Max Sessions allocated\n",
+ dev_err(component->dev, "%s: Max Sessions allocated\n",
__func__);
ret = -EAGAIN;
goto exit;
@@ -230,7 +231,7 @@
strlcpy(session_map[index].stream_name,
rtd->dai_link->stream_name,
sizeof(session_map[index].stream_name));
- dev_dbg(rtd->platform->dev, "%s: stream %s index %d\n",
+ dev_dbg(component->dev, "%s: stream %s index %d\n",
__func__, session_map[index].stream_name, index);
mutex_init(&session_map[index].loopback_priv->lock);
@@ -244,6 +245,8 @@
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct msm_pcm_loopback *pcm = NULL;
int ret = 0;
uint16_t bits_per_sample = 16;
@@ -252,6 +255,11 @@
uint32_t param_id;
struct msm_pcm_pdata *pdata;
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ret = msm_pcm_loopback_get_session(rtd, &pcm);
if (ret)
return ret;
@@ -266,7 +274,7 @@
pcm->capture_substream = substream;
pcm->instance++;
- dev_dbg(rtd->platform->dev, "%s: pcm out open: %d,%d\n", __func__,
+ dev_dbg(component->dev, "%s: pcm out open: %d,%d\n", __func__,
pcm->instance, substream->stream);
if (pcm->instance == 2) {
struct snd_soc_pcm_runtime *soc_pcm_rx =
@@ -277,9 +285,9 @@
stop_pcm(pcm);
pdata = (struct msm_pcm_pdata *)
- dev_get_drvdata(rtd->platform->dev);
+ dev_get_drvdata(component->dev);
if (!pdata) {
- dev_err(rtd->platform->dev,
+ dev_err(component->dev,
"%s: platform data not populated\n", __func__);
mutex_unlock(&pcm->lock);
return -EINVAL;
@@ -288,7 +296,7 @@
pcm->audio_client = q6asm_audio_client_alloc(
(app_cb)msm_pcm_loopback_event_handler, pcm);
if (!pcm->audio_client) {
- dev_err(rtd->platform->dev,
+ dev_err(component->dev,
"%s: Could not allocate memory\n", __func__);
mutex_unlock(&pcm->lock);
return -ENOMEM;
@@ -298,7 +306,7 @@
ret = q6asm_open_loopback_v2(pcm->audio_client,
bits_per_sample);
if (ret < 0) {
- dev_err(rtd->platform->dev,
+ dev_err(component->dev,
"%s: pcm out open failed\n", __func__);
q6asm_audio_client_free(pcm->audio_client);
mutex_unlock(&pcm->lock);
@@ -317,7 +325,7 @@
pcm->playback_substream = substream;
ret = pcm_loopback_set_volume(pcm, pcm->volume);
if (ret < 0)
- dev_err(rtd->platform->dev,
+ dev_err(component->dev,
"Error %d setting volume", ret);
}
/* Set to largest negative value */
@@ -335,7 +343,7 @@
&asm_mtmx_strtr_window,
param_id);
}
- dev_info(rtd->platform->dev, "%s: Instance = %d, Stream ID = %s\n",
+ dev_info(component->dev, "%s: Instance = %d, Stream ID = %s\n",
__func__, pcm->instance, substream->pcm->id);
runtime->private_data = pcm;
@@ -372,12 +380,19 @@
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_pcm_loopback *pcm = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(rtd, DRV_NAME);
int ret = 0, n;
bool found = false;
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
mutex_lock(&pcm->lock);
- dev_dbg(rtd->platform->dev, "%s: end pcm call:%d\n",
+ dev_dbg(component->dev, "%s: end pcm call:%d\n",
__func__, substream->stream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
pcm->playback_start = 0;
@@ -386,7 +401,7 @@
pcm->instance--;
if (!pcm->playback_start || !pcm->capture_start) {
- dev_dbg(rtd->platform->dev, "%s: end pcm call\n", __func__);
+ dev_dbg(component->dev, "%s: end pcm call\n", __func__);
stop_pcm(pcm);
}
@@ -406,7 +421,7 @@
mutex_destroy(&session_map[n].loopback_priv->lock);
session_map[n].loopback_priv = NULL;
kfree(pcm);
- dev_dbg(rtd->platform->dev, "%s: stream freed %s\n",
+ dev_dbg(component->dev, "%s: stream freed %s\n",
__func__, rtd->dai_link->stream_name);
mutex_unlock(&loopback_session_lock);
return 0;
@@ -423,10 +438,17 @@
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_pcm_loopback *pcm = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
mutex_lock(&pcm->lock);
- dev_dbg(rtd->platform->dev, "%s: ASM loopback stream:%d\n",
+ dev_dbg(component->dev, "%s: ASM loopback stream:%d\n",
__func__, substream->stream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (!pcm->playback_start)
@@ -445,12 +467,19 @@
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_pcm_loopback *pcm = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- dev_dbg(rtd->platform->dev,
+ dev_dbg(component->dev,
"%s: playback_start:%d,capture_start:%d\n", __func__,
pcm->playback_start, pcm->capture_start);
if (pcm->playback_start && pcm->capture_start)
@@ -459,7 +488,7 @@
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_STOP:
- dev_dbg(rtd->platform->dev,
+ dev_dbg(component->dev,
"%s:Pause/Stop - playback_start:%d,capture_start:%d\n",
__func__, pcm->playback_start, pcm->capture_start);
if (pcm->playback_start && pcm->capture_start)
@@ -735,7 +764,8 @@
return ret;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_loopback_probe,
@@ -760,13 +790,14 @@
dev_set_drvdata(&pdev->dev, pdata);
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_component,
+ NULL, 0);
}
static int msm_pcm_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-pcm-q6-noirq.c b/asoc/msm-pcm-q6-noirq.c
index be34903..aac3fe0 100644
--- a/asoc/msm-pcm-q6-noirq.c
+++ b/asoc/msm-pcm-q6-noirq.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -41,6 +33,9 @@
#include "msm-pcm-q6-v2.h"
#include "msm-pcm-routing-v2.h"
+
+#define DRV_NAME "msm-pcm-q6-noirq"
+
#define PCM_MASTER_VOL_MAX_STEPS 0x2000
static const DECLARE_TLV_DB_LINEAR(msm_pcm_vol_gain, 0,
PCM_MASTER_VOL_MAX_STEPS);
@@ -264,6 +259,8 @@
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_audio *prtd = runtime->private_data;
struct msm_plat_data *pdata;
struct snd_dma_buffer *dma_buf = &substream->dma_buffer;
@@ -278,8 +275,13 @@
bool use_default_chmap = true;
char *chmap = NULL;
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pdata = (struct msm_plat_data *)
- dev_get_drvdata(soc_prtd->platform->dev);
+ dev_get_drvdata(component->dev);
if (!pdata) {
ret = -EINVAL;
pr_err("%s: platform data not populated ret: %d\n", __func__,
@@ -798,6 +800,7 @@
static int msm_pcm_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback Channel Map";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -820,6 +823,12 @@
return -EINVAL;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pr_debug("%s: added new pcm FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -834,11 +843,11 @@
fe_channel_map_control[0].name = mixer_str;
fe_channel_map_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- snd_soc_add_platform_controls(rtd->platform,
+ snd_soc_add_component_controls(component,
fe_channel_map_control,
ARRAY_SIZE(fe_channel_map_control));
- pdata = snd_soc_platform_get_drvdata(rtd->platform);
+ pdata = snd_soc_component_get_drvdata(component);
pdata->ch_map[rtd->dai_link->id] =
kzalloc(sizeof(struct msm_pcm_ch_map), GFP_KERNEL);
if (!pdata->ch_map[rtd->dai_link->id]) {
@@ -901,6 +910,7 @@
static int msm_pcm_add_fe_topology_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "PCM_Dev";
const char *deviceNo = "NN";
const char *topo_text = "Topology";
@@ -919,6 +929,12 @@
},
};
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1 +
strlen(topo_text) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
@@ -931,7 +947,7 @@
topology_control[0].name = mixer_str;
topology_control[0].private_value = rtd->dai_link->id;
- ret = snd_soc_add_platform_controls(rtd->platform, topology_control,
+ ret = snd_soc_add_component_controls(component, topology_control,
ARRAY_SIZE(topology_control));
msm_pcm_fe_topology[rtd->dai_link->id] = 0;
kfree(mixer_str);
@@ -1248,7 +1264,8 @@
.close = msm_pcm_close,
};
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
};
@@ -1287,8 +1304,9 @@
dev_dbg(&pdev->dev, "%s: dev name %s\n",
__func__, dev_name(&pdev->dev));
dev_dbg(&pdev->dev, "Pull mode driver register\n");
- rc = snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ rc = snd_soc_register_component(&pdev->dev,
+ &msm_soc_component,
+ NULL, 0);
if (rc)
dev_err(&pdev->dev, "Failed to register pull mode driver\n");
@@ -1303,7 +1321,7 @@
dev_dbg(&pdev->dev, "Pull mode remove\n");
pdata = dev_get_drvdata(&pdev->dev);
devm_kfree(&pdev->dev, pdata);
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
static const struct of_device_id msm_pcm_noirq_dt_match[] = {
diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c
index 5da9795..1ad10db 100644
--- a/asoc/msm-pcm-q6-v2.c
+++ b/asoc/msm-pcm-q6-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
@@ -42,6 +34,8 @@
#include "msm-pcm-routing-v2.h"
#include "msm-qti-pp-config.h"
+#define DRV_NAME "msm-pcm-q6-v2"
+
enum stream_state {
IDLE = 0,
STOPPED,
@@ -320,6 +314,8 @@
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_audio *prtd = runtime->private_data;
struct msm_plat_data *pdata;
struct snd_pcm_hw_params *params;
@@ -328,8 +324,13 @@
uint16_t bits_per_sample;
uint16_t sample_word_size;
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pdata = (struct msm_plat_data *)
- dev_get_drvdata(soc_prtd->platform->dev);
+ dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s: platform data not populated\n", __func__);
return -EINVAL;
@@ -472,6 +473,8 @@
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_audio *prtd = runtime->private_data;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_plat_data *pdata;
struct snd_pcm_hw_params *params;
struct msm_pcm_routing_evt event;
@@ -480,8 +483,13 @@
uint16_t bits_per_sample = 16;
uint16_t sample_word_size;
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pdata = (struct msm_plat_data *)
- dev_get_drvdata(soc_prtd->platform->dev);
+ dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s: platform data not populated\n", __func__);
return -EINVAL;
@@ -666,12 +674,19 @@
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_audio *prtd;
struct msm_plat_data *pdata;
int ret = 0;
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pdata = (struct msm_plat_data *)
- dev_get_drvdata(soc_prtd->platform->dev);
+ dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s: platform data not populated\n", __func__);
return -EINVAL;
@@ -690,7 +705,7 @@
return -ENOMEM;
}
- prtd->audio_client->dev = soc_prtd->platform->dev;
+ prtd->audio_client->dev = component->dev;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
runtime->hw = msm_pcm_hardware_playback;
@@ -866,6 +881,8 @@
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct msm_audio *prtd = runtime->private_data;
+ struct snd_soc_component *component =
+ snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_plat_data *pdata;
uint32_t timeout;
int dir = 0;
@@ -875,13 +892,17 @@
if (prtd->audio_client) {
dir = IN;
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
/*
* Unvote to downgrade the Rx thread priority from
* RT Thread for Low-Latency use case.
*/
pdata = (struct msm_plat_data *)
- dev_get_drvdata(soc_prtd->platform->dev);
+ dev_get_drvdata(component->dev);
if (pdata) {
if (pdata->perf_mode == LOW_LATENCY_PCM_MODE)
apr_end_rx_rt(prtd->audio_client->apr);
@@ -1147,14 +1168,20 @@
static int msm_pcm_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_component *pcm = snd_kcontrol_chip(kcontrol);
- struct snd_soc_platform *platform = snd_soc_component_to_platform(pcm);
- struct msm_plat_data *pdata = dev_get_drvdata(platform->dev);
+ struct snd_soc_component *component =
+ snd_soc_kcontrol_component(kcontrol);
+ struct msm_plat_data *pdata = NULL;
struct snd_pcm_substream *substream;
struct msm_audio *prtd;
int ret = 0;
struct msm_adsp_event_data *event_data = NULL;
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
+ pdata = dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s pdata is NULL\n", __func__);
ret = -ENODEV;
@@ -1215,6 +1242,7 @@
static int msm_pcm_add_audio_adsp_stream_cmd_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CMD;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -1236,6 +1264,12 @@
goto done;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@@ -1248,7 +1282,7 @@
fe_audio_adsp_stream_cmd_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s\n", mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_audio_adsp_stream_cmd_config_control,
ARRAY_SIZE(fe_audio_adsp_stream_cmd_config_control));
if (ret < 0)
@@ -1263,6 +1297,7 @@
static int msm_pcm_add_audio_adsp_stream_callback_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -1286,6 +1321,12 @@
goto done;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pr_debug("%s: added new pcm FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -1301,7 +1342,7 @@
fe_audio_adsp_callback_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_audio_adsp_callback_config_control,
ARRAY_SIZE(fe_audio_adsp_callback_config_control));
if (ret < 0) {
@@ -1427,9 +1468,8 @@
static int msm_pcm_compress_ctl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
- struct snd_soc_platform *platform = snd_soc_component_to_platform(comp);
- struct msm_plat_data *pdata = dev_get_drvdata(platform->dev);
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct msm_plat_data *pdata = dev_get_drvdata(comp->dev);
struct snd_pcm_substream *substream;
struct msm_audio *prtd;
@@ -1456,9 +1496,8 @@
struct snd_ctl_elem_value *ucontrol)
{
int rc = 0;
- struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
- struct snd_soc_platform *platform = snd_soc_component_to_platform(comp);
- struct msm_plat_data *pdata = dev_get_drvdata(platform->dev);
+ struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+ struct msm_plat_data *pdata = dev_get_drvdata(comp->dev);
struct snd_pcm_substream *substream;
struct msm_audio *prtd;
int compress = ucontrol->value.integer.value[0];
@@ -1488,6 +1527,7 @@
static int msm_pcm_add_compress_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback ";
const char *mixer_ctl_end_name = " Compress";
const char *deviceNo = "NN";
@@ -1512,6 +1552,12 @@
return -EINVAL;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ctl_len = strlen(mixer_ctl_name) + strlen(deviceNo) +
strlen(mixer_ctl_end_name) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
@@ -1525,16 +1571,16 @@
pcm_compress_control[0].name = mixer_str;
pcm_compress_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- pdata = dev_get_drvdata(rtd->platform->dev);
+ pdata = dev_get_drvdata(component->dev);
if (pdata) {
if (!pdata->pcm) {
pdata->pcm = rtd->pcm;
- snd_soc_add_platform_controls(rtd->platform,
+ snd_soc_add_component_controls(component,
pcm_compress_control,
ARRAY_SIZE
(pcm_compress_control));
pr_debug("%s: add control success plt = %pK\n",
- __func__, rtd->platform);
+ __func__, component);
}
} else {
pr_err("%s: NULL pdata\n", __func__);
@@ -1868,7 +1914,8 @@
return frames;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.delay_blk = msm_pcm_delay_blk,
@@ -1915,8 +1962,9 @@
dev_dbg(&pdev->dev, "%s: dev name %s\n",
__func__, dev_name(&pdev->dev));
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_component,
+ NULL, 0);
}
static int msm_pcm_remove(struct platform_device *pdev)
@@ -1925,7 +1973,7 @@
pdata = dev_get_drvdata(&pdev->dev);
kfree(pdata);
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
static const struct of_device_id msm_pcm_dt_match[] = {
diff --git a/asoc/msm-pcm-q6-v2.h b/asoc/msm-pcm-q6-v2.h
index 201c7e5..ca18a85 100644
--- a/asoc/msm-pcm-q6-v2.h
+++ b/asoc/msm-pcm-q6-v2.h
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you can find it at http://www.fsf.org.
*/
#ifndef _MSM_PCM_H
diff --git a/asoc/msm-pcm-routing-devdep.c b/asoc/msm-pcm-routing-devdep.c
index 7335951..6d26c54 100644
--- a/asoc/msm-pcm-routing-devdep.c
+++ b/asoc/msm-pcm-routing-devdep.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2014, 2016-2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/asoc/msm-pcm-routing-devdep.h b/asoc/msm-pcm-routing-devdep.h
index 8a0b967..651edd9 100644
--- a/asoc/msm-pcm-routing-devdep.h
+++ b/asoc/msm-pcm-routing-devdep.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2014-2015, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _MSM_PCM_ROUTING_DEVDEP_H_
diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c
index 0d07dd4..db5713b 100644
--- a/asoc/msm-pcm-routing-v2.c
+++ b/asoc/msm-pcm-routing-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -46,6 +38,8 @@
#include "msm-dolby-dap-config.h"
#include "msm-ds2-dap-config.h"
+#define DRV_NAME "msm-pcm-routing-v2"
+
#ifndef CONFIG_DOLBY_DAP
#undef DOLBY_ADM_COPP_TOPOLOGY_ID
#define DOLBY_ADM_COPP_TOPOLOGY_ID 0xFFFFFFFE
@@ -84,6 +78,7 @@
static bool is_ds2_on;
static bool swap_ch;
static int aanc_level;
+static int num_app_cfg_types;
#define WEIGHT_0_DB 0x4000
/* all the FEs which can support channel mixer */
@@ -17238,6 +17233,23 @@
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
+ int shift = ((struct soc_multi_mixer_control *)
+ kcontrol->private_value)->shift;
+ int i = 0, j = 0;
+
+ ucontrol->value.integer.value[i] = num_app_cfg_types;
+
+ for (j = 0; j < num_app_cfg_types; ++j) {
+ ucontrol->value.integer.value[++i] =
+ lsm_app_type_cfg[j].app_type;
+ ucontrol->value.integer.value[++i] =
+ lsm_app_type_cfg[j].sample_rate;
+ ucontrol->value.integer.value[++i] =
+ lsm_app_type_cfg[j].bit_width;
+ if (shift == 1)
+ ucontrol->value.integer.value[++i] =
+ lsm_app_type_cfg[j].num_out_channels;
+ }
return 0;
}
@@ -17248,18 +17260,18 @@
int shift = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
int i = 0, j;
- int num_app_types = ucontrol->value.integer.value[i++];
+ num_app_cfg_types = ucontrol->value.integer.value[i++];
memset(lsm_app_type_cfg, 0, MAX_APP_TYPES*
sizeof(struct msm_pcm_routing_app_type_data));
- if (num_app_types > MAX_APP_TYPES) {
+ if (num_app_cfg_types > MAX_APP_TYPES) {
pr_err("%s: number of app types exceed the max supported\n",
__func__);
return -EINVAL;
}
- for (j = 0; j < num_app_types; j++) {
+ for (j = 0; j < num_app_cfg_types; j++) {
lsm_app_type_cfg[j].app_type =
ucontrol->value.integer.value[i++];
lsm_app_type_cfg[j].sample_rate =
@@ -23578,75 +23590,76 @@
};
/* Not used but frame seems to require it */
-static int msm_routing_probe(struct snd_soc_platform *platform)
+static int msm_routing_probe(struct snd_soc_component *component)
{
- snd_soc_dapm_new_controls(&platform->component.dapm, msm_qdsp6_widgets,
+ snd_soc_dapm_new_controls(&component->dapm, msm_qdsp6_widgets,
ARRAY_SIZE(msm_qdsp6_widgets));
- snd_soc_dapm_add_routes(&platform->component.dapm, intercon,
+ snd_soc_dapm_add_routes(&component->dapm, intercon,
ARRAY_SIZE(intercon));
- snd_soc_dapm_new_widgets(platform->component.dapm.card);
+ snd_soc_dapm_new_widgets(component->dapm.card);
- snd_soc_add_platform_controls(platform, lsm_controls,
+ snd_soc_add_component_controls(component, lsm_controls,
ARRAY_SIZE(lsm_controls));
- snd_soc_add_platform_controls(platform, aanc_slim_0_rx_mux,
+ snd_soc_add_component_controls(component, aanc_slim_0_rx_mux,
ARRAY_SIZE(aanc_slim_0_rx_mux));
- snd_soc_add_platform_controls(platform, aanc_noise_level,
+ snd_soc_add_component_controls(component, aanc_noise_level,
ARRAY_SIZE(aanc_noise_level));
- snd_soc_add_platform_controls(platform, msm_voc_session_controls,
+ snd_soc_add_component_controls(component, msm_voc_session_controls,
ARRAY_SIZE(msm_voc_session_controls));
- snd_soc_add_platform_controls(platform, app_type_cfg_controls,
+ snd_soc_add_component_controls(component, app_type_cfg_controls,
ARRAY_SIZE(app_type_cfg_controls));
- snd_soc_add_platform_controls(platform, lsm_app_type_cfg_controls,
+ snd_soc_add_component_controls(component, lsm_app_type_cfg_controls,
ARRAY_SIZE(lsm_app_type_cfg_controls));
- snd_soc_add_platform_controls(platform, module_cfg_controls,
+ snd_soc_add_component_controls(component, module_cfg_controls,
ARRAY_SIZE(module_cfg_controls));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
stereo_to_custom_stereo_controls,
ARRAY_SIZE(stereo_to_custom_stereo_controls));
- snd_soc_add_platform_controls(platform, ec_ref_param_controls,
+ snd_soc_add_component_controls(component, ec_ref_param_controls,
ARRAY_SIZE(ec_ref_param_controls));
- snd_soc_add_platform_controls(platform, channel_mixer_controls,
+ snd_soc_add_component_controls(component, channel_mixer_controls,
ARRAY_SIZE(channel_mixer_controls));
- msm_qti_pp_add_controls(platform);
+ msm_qti_pp_add_controls(component);
- msm_dts_srs_tm_add_controls(platform);
+ msm_dts_srs_tm_add_controls(component);
- msm_dolby_dap_add_controls(platform);
+ msm_dolby_dap_add_controls(component);
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
use_ds1_or_ds2_controls,
ARRAY_SIZE(use_ds1_or_ds2_controls));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
device_pp_params_mixer_controls,
ARRAY_SIZE(device_pp_params_mixer_controls));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
msm_routing_be_dai_name_table_mixer_controls,
ARRAY_SIZE(msm_routing_be_dai_name_table_mixer_controls));
- snd_soc_add_platform_controls(platform, msm_source_tracking_controls,
+ snd_soc_add_component_controls(component, msm_source_tracking_controls,
ARRAY_SIZE(msm_source_tracking_controls));
- snd_soc_add_platform_controls(platform, adm_channel_config_controls,
+ snd_soc_add_component_controls(component, adm_channel_config_controls,
ARRAY_SIZE(adm_channel_config_controls));
- snd_soc_add_platform_controls(platform, aptx_dec_license_controls,
+ snd_soc_add_component_controls(component, aptx_dec_license_controls,
ARRAY_SIZE(aptx_dec_license_controls));
- snd_soc_add_platform_controls(platform, stereo_channel_reverse_control,
+ snd_soc_add_component_controls(component,
+ stereo_channel_reverse_control,
ARRAY_SIZE(stereo_channel_reverse_control));
- snd_soc_add_platform_controls(
- platform, msm_routing_feature_support_mixer_controls,
+ snd_soc_add_component_controls(
+ component, msm_routing_feature_support_mixer_controls,
ARRAY_SIZE(msm_routing_feature_support_mixer_controls));
return 0;
@@ -23662,7 +23675,8 @@
msm_pcm_routing_hwdep_free(pcm);
}
-static struct snd_soc_platform_driver msm_soc_routing_platform = {
+static struct snd_soc_component_driver msm_soc_routing_component = {
+ .name = DRV_NAME,
.ops = &msm_routing_pcm_ops,
.probe = msm_routing_probe,
.pcm_new = msm_routing_pcm_new,
@@ -23673,13 +23687,14 @@
{
dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_routing_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_routing_component,
+ NULL, 0);
}
static int msm_routing_pcm_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-pcm-routing-v2.h b/asoc/msm-pcm-routing-v2.h
index f06dfc0..92fd3c2 100644
--- a/asoc/msm-pcm-routing-v2.h
+++ b/asoc/msm-pcm-routing-v2.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _MSM_PCM_ROUTING_H
#define _MSM_PCM_ROUTING_H
diff --git a/asoc/msm-pcm-voice-v2.c b/asoc/msm-pcm-voice-v2.c
index 38da7e7..3fd8339 100644
--- a/asoc/msm-pcm-voice-v2.c
+++ b/asoc/msm-pcm-voice-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -30,6 +22,8 @@
#include "msm-pcm-voice-v2.h"
+#define DRV_NAME "msm-pcm-voice-v2"
+
static struct msm_voice voice_info[VOICE_SESSION_INDEX_MAX];
static struct snd_pcm_hardware msm_pcm_hardware = {
@@ -705,15 +699,16 @@
return ret;
}
-static int msm_pcm_voice_probe(struct snd_soc_platform *platform)
+static int msm_pcm_voice_probe(struct snd_soc_component *component)
{
- snd_soc_add_platform_controls(platform, msm_voice_controls,
+ snd_soc_add_component_controls(component, msm_voice_controls,
ARRAY_SIZE(msm_voice_controls));
return 0;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_voice_probe,
@@ -750,8 +745,9 @@
is_destroy_cvd);
voc_set_destroy_cvd_flag(destroy_cvd);
- rc = snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ rc = snd_soc_register_component(&pdev->dev,
+ &msm_soc_component,
+ NULL, 0);
done:
return rc;
@@ -759,7 +755,7 @@
static int msm_pcm_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-pcm-voice-v2.h b/asoc/msm-pcm-voice-v2.h
index 60f5adc..671c1aa 100644
--- a/asoc/msm-pcm-voice-v2.h
+++ b/asoc/msm-pcm-voice-v2.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _MSM_PCM_VOICE_H
#define _MSM_PCM_VOICE_H
diff --git a/asoc/msm-pcm-voip-v2.c b/asoc/msm-pcm-voip-v2.c
index b8d7390..ac12b90 100644
--- a/asoc/msm-pcm-voip-v2.c
+++ b/asoc/msm-pcm-voip-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -31,6 +23,8 @@
#include "msm-pcm-q6-v2.h"
#include "msm-pcm-routing-v2.h"
+#define DRV_NAME "msm-pcm-voip-v2"
+
#define SHARED_MEM_BUF 2
#define VOIP_MAX_Q_LEN 10
#define VOIP_MAX_VOC_PKT_SIZE 4096
@@ -308,9 +302,9 @@
msm_voip_dtx_mode_get, msm_voip_dtx_mode_put),
};
-static int msm_pcm_voip_probe(struct snd_soc_platform *platform)
+static int msm_pcm_voip_probe(struct snd_soc_component *component)
{
- snd_soc_add_platform_controls(platform, msm_voip_controls,
+ snd_soc_add_component_controls(component, msm_voip_controls,
ARRAY_SIZE(msm_voip_controls));
return 0;
@@ -1613,7 +1607,8 @@
return ret;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_voip_probe,
@@ -1650,8 +1645,9 @@
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
- rc = snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ rc = snd_soc_register_component(&pdev->dev,
+ &msm_soc_component,
+ NULL, 0);
done:
return rc;
@@ -1659,7 +1655,7 @@
static int msm_pcm_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/msm-qti-pp-config.c b/asoc/msm-qti-pp-config.c
index a8e20bc..e5d1ba2 100644
--- a/asoc/msm-qti-pp-config.c
+++ b/asoc/msm-qti-pp-config.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/err.h>
@@ -1569,63 +1561,68 @@
};
#ifdef CONFIG_QTI_PP
-void msm_qti_pp_add_controls(struct snd_soc_platform *platform)
+void msm_qti_pp_add_controls(struct snd_soc_component *component)
{
- snd_soc_add_platform_controls(platform, int_fm_vol_mixer_controls,
+ snd_soc_add_component_controls(component, int_fm_vol_mixer_controls,
ARRAY_SIZE(int_fm_vol_mixer_controls));
- snd_soc_add_platform_controls(platform, pri_mi2s_lb_vol_mixer_controls,
+ snd_soc_add_component_controls(component,
+ pri_mi2s_lb_vol_mixer_controls,
ARRAY_SIZE(pri_mi2s_lb_vol_mixer_controls));
- snd_soc_add_platform_controls(platform, sec_mi2s_lb_vol_mixer_controls,
+ snd_soc_add_component_controls(component,
+ sec_mi2s_lb_vol_mixer_controls,
ARRAY_SIZE(sec_mi2s_lb_vol_mixer_controls));
- snd_soc_add_platform_controls(platform, tert_mi2s_lb_vol_mixer_controls,
+ snd_soc_add_component_controls(component,
+ tert_mi2s_lb_vol_mixer_controls,
ARRAY_SIZE(tert_mi2s_lb_vol_mixer_controls));
- snd_soc_add_platform_controls(platform, slimbus_7_lb_vol_mixer_controls,
+ snd_soc_add_component_controls(component,
+ slimbus_7_lb_vol_mixer_controls,
ARRAY_SIZE(slimbus_7_lb_vol_mixer_controls));
- snd_soc_add_platform_controls(platform, slimbus_8_lb_vol_mixer_controls,
+ snd_soc_add_component_controls(component,
+ slimbus_8_lb_vol_mixer_controls,
ARRAY_SIZE(slimbus_8_lb_vol_mixer_controls));
- snd_soc_add_platform_controls(platform, int_hfp_vol_mixer_controls,
+ snd_soc_add_component_controls(component, int_hfp_vol_mixer_controls,
ARRAY_SIZE(int_hfp_vol_mixer_controls));
- snd_soc_add_platform_controls(platform, int_icc_vol_mixer_controls,
+ snd_soc_add_component_controls(component, int_icc_vol_mixer_controls,
ARRAY_SIZE(int_icc_vol_mixer_controls));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
pri_auxpcm_lb_vol_mixer_controls,
ARRAY_SIZE(pri_auxpcm_lb_vol_mixer_controls));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
sec_auxpcm_lb_vol_mixer_controls,
ARRAY_SIZE(sec_auxpcm_lb_vol_mixer_controls));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
multi_ch_channel_map_mixer_controls,
ARRAY_SIZE(multi_ch_channel_map_mixer_controls));
- snd_soc_add_platform_controls(platform, get_rms_controls,
+ snd_soc_add_component_controls(component, get_rms_controls,
ARRAY_SIZE(get_rms_controls));
- snd_soc_add_platform_controls(platform, eq_enable_mixer_controls,
+ snd_soc_add_component_controls(component, eq_enable_mixer_controls,
ARRAY_SIZE(eq_enable_mixer_controls));
- snd_soc_add_platform_controls(platform, eq_band_mixer_controls,
+ snd_soc_add_component_controls(component, eq_band_mixer_controls,
ARRAY_SIZE(eq_band_mixer_controls));
- snd_soc_add_platform_controls(platform, eq_coeff_mixer_controls,
+ snd_soc_add_component_controls(component, eq_coeff_mixer_controls,
ARRAY_SIZE(eq_coeff_mixer_controls));
- snd_soc_add_platform_controls(platform, asphere_mixer_controls,
+ snd_soc_add_component_controls(component, asphere_mixer_controls,
ARRAY_SIZE(asphere_mixer_controls));
- snd_soc_add_platform_controls(platform, msm_multichannel_ec_controls,
+ snd_soc_add_component_controls(component, msm_multichannel_ec_controls,
ARRAY_SIZE(msm_multichannel_ec_controls));
- snd_soc_add_platform_controls(platform, dsp_bit_width_controls,
+ snd_soc_add_component_controls(component, dsp_bit_width_controls,
ARRAY_SIZE(dsp_bit_width_controls));
}
#endif /* CONFIG_QTI_PP */
diff --git a/asoc/msm-qti-pp-config.h b/asoc/msm-qti-pp-config.h
index edbd603..8d10337 100644
--- a/asoc/msm-qti-pp-config.h
+++ b/asoc/msm-qti-pp-config.h
@@ -1,13 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_QTI_PP_H_
@@ -33,7 +26,7 @@
uint16_t op_FL_ip_FR_weight,
uint16_t op_FR_ip_FL_weight,
uint16_t op_FR_ip_FR_weight);
-void msm_qti_pp_add_controls(struct snd_soc_platform *platform);
+void msm_qti_pp_add_controls(struct snd_soc_component *component);
int msm_qti_pp_send_chmix_cfg_cmd(int port_id, int copp_idx,
unsigned int session_id, int ip_channel_count,
int out_channel_cnt, int *ch_wght_coeff,
diff --git a/asoc/msm-slim-dma.h b/asoc/msm-slim-dma.h
index daf394b..f179a2e 100644
--- a/asoc/msm-slim-dma.h
+++ b/asoc/msm-slim-dma.h
@@ -1,15 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2014, 2017 The Linux Foundation. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#ifndef _MSM_SLIMBUS_DMA_H
#define _MSM_SLIMBUS_DMA_H
diff --git a/asoc/msm-transcode-loopback-q6-v2.c b/asoc/msm-transcode-loopback-q6-v2.c
index f44e87d..12863a2 100644
--- a/asoc/msm-transcode-loopback-q6-v2.c
+++ b/asoc/msm-transcode-loopback-q6-v2.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
@@ -41,6 +33,8 @@
#include "msm-pcm-routing-v2.h"
#include "msm-qti-pp-config.h"
+#define DRV_NAME "msm-transcode-loopback-v2"
+
#define LOOPBACK_SESSION_MAX_NUM_STREAMS 2
/* Max volume corresponding to 24dB */
#define TRANSCODE_LR_VOL_MAX_DB 0xFFFF
@@ -207,6 +201,7 @@
struct snd_soc_pcm_runtime *rtd;
struct msm_transcode_loopback *trans = &transcode_info;
struct trans_loopback_pdata *pdata;
+ struct snd_soc_component *component;
if (cstream == NULL) {
pr_err("%s: Invalid substream\n", __func__);
@@ -214,7 +209,13 @@
}
runtime = cstream->runtime;
rtd = snd_pcm_substream_chip(cstream);
- pdata = snd_soc_platform_get_drvdata(rtd->platform);
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
+ pdata = snd_soc_component_get_drvdata(component);
pdata->cstream[rtd->dai_link->id] = cstream;
pdata->audio_effects[rtd->dai_link->id] =
kzalloc(sizeof(struct msm_transcode_audio_effects), GFP_KERNEL);
@@ -307,10 +308,17 @@
struct snd_compr_runtime *runtime = cstream->runtime;
struct msm_transcode_loopback *trans = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(cstream);
+ struct snd_soc_component *component;
struct trans_loopback_pdata *pdata;
int ret = 0;
- pdata = snd_soc_platform_get_drvdata(rtd->platform);
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
+ pdata = snd_soc_component_get_drvdata(component);
mutex_lock(&trans->lock);
@@ -412,6 +420,7 @@
struct snd_soc_pcm_runtime *soc_pcm_rx;
struct snd_soc_pcm_runtime *soc_pcm_tx;
struct snd_soc_pcm_runtime *rtd;
+ struct snd_soc_component *component;
struct trans_loopback_pdata *pdata;
uint32_t bit_width = 16;
int ret = 0;
@@ -424,7 +433,8 @@
mutex_lock(&trans->lock);
rtd = snd_pcm_substream_chip(cstream);
- pdata = snd_soc_platform_get_drvdata(rtd->platform);
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ pdata = snd_soc_component_get_drvdata(component);
if (cstream->direction == SND_COMPRESS_PLAYBACK) {
if (codec_param->codec.id == SND_AUDIOCODEC_PCM) {
@@ -578,6 +588,7 @@
struct snd_soc_pcm_runtime *rtd;
struct trans_loopback_pdata *pdata;
struct msm_transcode_loopback *prtd = NULL;
+ struct snd_soc_component *component;
struct audio_client *ac = NULL;
if (!metadata || !cstream) {
@@ -586,7 +597,8 @@
}
rtd = snd_pcm_substream_chip(cstream);
- pdata = snd_soc_platform_get_drvdata(rtd->platform);
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ pdata = snd_soc_component_get_drvdata(component);
prtd = cstream->runtime->private_data;
@@ -878,7 +890,7 @@
rtd = cstream->private_data;
prtd = cstream->runtime->private_data;
- if (!rtd || !rtd->platform || !prtd || !prtd->audio_client) {
+ if (!rtd || !prtd || !prtd->audio_client) {
pr_err("%s: invalid rtd, prtd or audio client", __func__);
return -EINVAL;
}
@@ -1073,6 +1085,7 @@
static int msm_transcode_add_audio_effects_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Audio Effects Config";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -1096,6 +1109,12 @@
goto done;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n", __func__,
rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@@ -1112,7 +1131,7 @@
fe_audio_effects_config_control[0].name = mixer_str;
fe_audio_effects_config_control[0].private_value = rtd->dai_link->id;
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_audio_effects_config_control,
ARRAY_SIZE(fe_audio_effects_config_control));
if (ret < 0)
@@ -1126,6 +1145,7 @@
static int msm_transcode_stream_cmd_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CMD;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -1147,6 +1167,12 @@
goto done;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@@ -1159,7 +1185,7 @@
fe_loopback_stream_cmd_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_loopback_stream_cmd_config_control,
ARRAY_SIZE(fe_loopback_stream_cmd_config_control));
if (ret < 0)
@@ -1174,6 +1200,7 @@
static int msm_transcode_stream_callback_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -1197,6 +1224,12 @@
goto done;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@@ -1209,7 +1242,7 @@
fe_loopback_callback_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_loopback_callback_config_control,
ARRAY_SIZE(fe_loopback_callback_config_control));
if (ret < 0) {
@@ -1235,6 +1268,7 @@
static int msm_transcode_add_ion_fd_cmd_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback ION FD";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -1256,6 +1290,12 @@
goto done;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@@ -1267,7 +1307,7 @@
fe_ion_fd_config_control[0].name = mixer_str;
fe_ion_fd_config_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_ion_fd_config_control,
ARRAY_SIZE(fe_ion_fd_config_control));
if (ret < 0)
@@ -1281,6 +1321,7 @@
static int msm_transcode_add_event_ack_cmd_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback Event Ack";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@@ -1302,6 +1343,12 @@
goto done;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@@ -1313,7 +1360,7 @@
fe_event_ack_config_control[0].name = mixer_str;
fe_event_ack_config_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
- ret = snd_soc_add_platform_controls(rtd->platform,
+ ret = snd_soc_add_component_controls(component,
fe_event_ack_config_control,
ARRAY_SIZE(fe_event_ack_config_control));
if (ret < 0)
@@ -1337,6 +1384,7 @@
static int msm_transcode_add_app_type_cfg_control(
struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
char mixer_str[32];
struct snd_kcontrol_new fe_app_type_cfg_control[1] = {
{
@@ -1354,6 +1402,12 @@
return -EINVAL;
}
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
if (rtd->compr->direction == SND_COMPRESS_PLAYBACK) {
snprintf(mixer_str, sizeof(mixer_str),
"Audio Stream %d App Type Cfg",
@@ -1368,7 +1422,7 @@
msm_transcode_playback_app_type_cfg_get;
pr_debug("Registering new mixer ctl %s", mixer_str);
- snd_soc_add_platform_controls(rtd->platform,
+ snd_soc_add_component_controls(component,
fe_app_type_cfg_control,
ARRAY_SIZE(fe_app_type_cfg_control));
}
@@ -1387,6 +1441,7 @@
static int msm_transcode_add_volume_control(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_component *component = NULL;
struct snd_kcontrol_new fe_volume_control[1] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1404,11 +1459,18 @@
pr_err("%s NULL rtd\n", __func__);
return -EINVAL;
}
+
+ component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+ if (!component) {
+ pr_err("%s: component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
if (rtd->compr->direction == SND_COMPRESS_PLAYBACK) {
fe_volume_control[0].private_value = rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s",
fe_volume_control[0].name);
- snd_soc_add_platform_controls(rtd->platform, fe_volume_control,
+ snd_soc_add_component_controls(component, fe_volume_control,
ARRAY_SIZE(fe_volume_control));
}
return 0;
@@ -1465,7 +1527,7 @@
};
-static int msm_transcode_loopback_probe(struct snd_soc_platform *platform)
+static int msm_transcode_loopback_probe(struct snd_soc_component *component)
{
struct trans_loopback_pdata *pdata = NULL;
int i;
@@ -1481,21 +1543,22 @@
for (i = 0; i < MSM_FRONTEND_DAI_MAX; i++)
pdata->audio_effects[i] = NULL;
- snd_soc_platform_set_drvdata(platform, pdata);
+ snd_soc_component_set_drvdata(component, pdata);
return 0;
}
-static int msm_transcode_loopback_remove(struct snd_soc_platform *platform)
+static void msm_transcode_loopback_remove(struct snd_soc_component *component)
{
struct trans_loopback_pdata *pdata = NULL;
pdata = (struct trans_loopback_pdata *)
- snd_soc_platform_get_drvdata(platform);
+ snd_soc_component_get_drvdata(component);
kfree(pdata);
- return 0;
+ return;
}
-static struct snd_soc_platform_driver msm_soc_platform = {
+static struct snd_soc_component_driver msm_soc_component = {
+ .name = DRV_NAME,
.probe = msm_transcode_loopback_probe,
.compr_ops = &msm_transcode_loopback_ops,
.pcm_new = msm_transcode_loopback_new,
@@ -1509,13 +1572,14 @@
if (pdev->dev.of_node)
dev_set_name(&pdev->dev, "%s", "msm-transcode-loopback");
- return snd_soc_register_platform(&pdev->dev,
- &msm_soc_platform);
+ return snd_soc_register_component(&pdev->dev,
+ &msm_soc_component,
+ NULL, 0);
}
static int msm_transcode_remove(struct platform_device *pdev)
{
- snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_component(&pdev->dev);
return 0;
}
diff --git a/asoc/platform_init.c b/asoc/platform_init.c
index 79d0e41..3b72ebe 100644
--- a/asoc/platform_init.c
+++ b/asoc/platform_init.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
-Copyright (c) 2017, The Linux Foundation. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 and
-only version 2 as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
diff --git a/asoc/platform_init.h b/asoc/platform_init.h
index db9b32d..ff5eafb 100644
--- a/asoc/platform_init.h
+++ b/asoc/platform_init.h
@@ -1,16 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
-Copyright (c) 2017, The Linux Foundation. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 and
-only version 2 as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-*
-*/
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ */
#ifndef __PLATFORM_INIT_H__
#define __PLATFORM_INIT_H__
diff --git a/asoc/qcs405.c b/asoc/qcs405.c
index a0f5460..4d1de74 100644
--- a/asoc/qcs405.c
+++ b/asoc/qcs405.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/clk.h>
#include <linux/delay.h>
diff --git a/asoc/sa8155.c b/asoc/sa8155.c
index a477a85..8791195 100644
--- a/asoc/sa8155.c
+++ b/asoc/sa8155.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
/*
* Copyright 2011, The Android Open Source Project
diff --git a/asoc/sm6150.c b/asoc/sm6150.c
index 59bbf69..a2abeb6 100644
--- a/asoc/sm6150.c
+++ b/asoc/sm6150.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/clk.h>
diff --git a/asoc/sm8150.c b/asoc/sm8150.c
index 30f3b13..7328be3 100644
--- a/asoc/sm8150.c
+++ b/asoc/sm8150.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/clk.h>
diff --git a/config/qcs405autoconf.h b/config/qcs405autoconf.h
index fd9407b..07e5429 100644
--- a/config/qcs405autoconf.h
+++ b/config/qcs405autoconf.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#define CONFIG_PINCTRL_LPI 1
diff --git a/config/sdxpoorwillsautoconf.h b/config/sdxpoorwillsautoconf.h
index 7b7dac4..9d7158e 100644
--- a/config/sdxpoorwillsautoconf.h
+++ b/config/sdxpoorwillsautoconf.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#define CONFIG_PINCTRL_WCD 1
diff --git a/config/sm6150autoconf.h b/config/sm6150autoconf.h
index d69a9de..2a63d04 100644
--- a/config/sm6150autoconf.h
+++ b/config/sm6150autoconf.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#define CONFIG_PINCTRL_WCD 1
diff --git a/config/sm8150autoconf.h b/config/sm8150autoconf.h
index fbaca24..6f21874 100644
--- a/config/sm8150autoconf.h
+++ b/config/sm8150autoconf.h
@@ -1,13 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#define CONFIG_PINCTRL_WCD 1
diff --git a/dsp/adsp-loader.c b/dsp/adsp-loader.c
index 5afd48c..725e370 100644
--- a/dsp/adsp-loader.c
+++ b/dsp/adsp-loader.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2012-2014, 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
diff --git a/dsp/adsp_err.c b/dsp/adsp_err.c
index e34d76b..1b30b2b 100644
--- a/dsp/adsp_err.c
+++ b/dsp/adsp_err.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/errno.h>
diff --git a/dsp/adsp_err.h b/dsp/adsp_err.h
index 43be91d..9b3c4c4 100644
--- a/dsp/adsp_err.h
+++ b/dsp/adsp_err.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __ADSP_ERR__
diff --git a/dsp/audio_cal_utils.c b/dsp/audio_cal_utils.c
index 47ac5be..36068d3 100644
--- a/dsp/audio_cal_utils.c
+++ b/dsp/audio_cal_utils.c
@@ -1,14 +1,6 @@
-/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/fs.h>
diff --git a/dsp/audio_calibration.c b/dsp/audio_calibration.c
index c895fa7..93bd352 100644
--- a/dsp/audio_calibration.c
+++ b/dsp/audio_calibration.c
@@ -1,14 +1,6 @@
-/* Copyright (c) 2014, 2016-2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2014, 2016-2017, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/fs.h>
diff --git a/dsp/audio_notifier.c b/dsp/audio_notifier.c
index 485c703..cb23c4c 100644
--- a/dsp/audio_notifier.c
+++ b/dsp/audio_notifier.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
diff --git a/dsp/audio_pdr.c b/dsp/audio_pdr.c
index 75f3bbb..509d5c8 100644
--- a/dsp/audio_pdr.c
+++ b/dsp/audio_pdr.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
diff --git a/dsp/audio_pdr.h b/dsp/audio_pdr.h
index d1235bc..398d687 100644
--- a/dsp/audio_pdr.h
+++ b/dsp/audio_pdr.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __AUDIO_PDR_H_
diff --git a/dsp/audio_slimslave.c b/dsp/audio_slimslave.c
index 55982f3..69cdf59 100644
--- a/dsp/audio_slimslave.c
+++ b/dsp/audio_slimslave.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2013-2014, 2017-2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2013-2014, 2017-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
diff --git a/dsp/audio_ssr.c b/dsp/audio_ssr.c
index b1acb91..8c27097 100644
--- a/dsp/audio_ssr.c
+++ b/dsp/audio_ssr.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
diff --git a/dsp/audio_ssr.h b/dsp/audio_ssr.h
index a807021..d633ffd 100644
--- a/dsp/audio_ssr.h
+++ b/dsp/audio_ssr.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
*/
#ifndef __AUDIO_SSR_H_
diff --git a/dsp/avtimer.c b/dsp/avtimer.c
index 41718ef..ee73826 100644
--- a/dsp/avtimer.c
+++ b/dsp/avtimer.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2012-2015, 2017-2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/kernel.h>
diff --git a/dsp/codecs/aac_in.c b/dsp/codecs/aac_in.c
index e10fbee..11e7bcc 100644
--- a/dsp/codecs/aac_in.c
+++ b/dsp/codecs/aac_in.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/module.h>
#include <linux/fs.h>
diff --git a/dsp/codecs/amrnb_in.c b/dsp/codecs/amrnb_in.c
index 4e35860..266d9c8 100644
--- a/dsp/codecs/amrnb_in.c
+++ b/dsp/codecs/amrnb_in.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2010-2012, 2014, 2016-2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
diff --git a/dsp/codecs/amrwb_in.c b/dsp/codecs/amrwb_in.c
index ce9dc45..6435f25 100644
--- a/dsp/codecs/amrwb_in.c
+++ b/dsp/codecs/amrwb_in.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2011-2012, 2014, 2016-2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/dma-mapping.h>
diff --git a/dsp/codecs/audio_aac.c b/dsp/codecs/audio_aac.c
index 44444ef..bbf9c36 100644
--- a/dsp/codecs/audio_aac.c
+++ b/dsp/codecs/audio_aac.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* aac audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/msm_audio_aac.h>
diff --git a/dsp/codecs/audio_alac.c b/dsp/codecs/audio_alac.c
index 975a1e9..9ece77f 100644
--- a/dsp/codecs/audio_alac.c
+++ b/dsp/codecs/audio_alac.c
@@ -1,14 +1,6 @@
-/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/types.h>
diff --git a/dsp/codecs/audio_amrnb.c b/dsp/codecs/audio_amrnb.c
index 1b5dd94..1549f43 100644
--- a/dsp/codecs/audio_amrnb.c
+++ b/dsp/codecs/audio_amrnb.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* amrnb audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/types.h>
diff --git a/dsp/codecs/audio_amrwb.c b/dsp/codecs/audio_amrwb.c
index 1408782..63baa9d 100644
--- a/dsp/codecs/audio_amrwb.c
+++ b/dsp/codecs/audio_amrwb.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* amrwb audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/compat.h>
diff --git a/dsp/codecs/audio_amrwbplus.c b/dsp/codecs/audio_amrwbplus.c
index 9d6c118..95ada70 100644
--- a/dsp/codecs/audio_amrwbplus.c
+++ b/dsp/codecs/audio_amrwbplus.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* amr-wbplus audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/msm_audio_amrwbplus.h>
#include <linux/compat.h>
diff --git a/dsp/codecs/audio_ape.c b/dsp/codecs/audio_ape.c
index f2a6bf7..8d61791 100644
--- a/dsp/codecs/audio_ape.c
+++ b/dsp/codecs/audio_ape.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/types.h>
diff --git a/dsp/codecs/audio_evrc.c b/dsp/codecs/audio_evrc.c
index 6cddc9c..2376eb3 100644
--- a/dsp/codecs/audio_evrc.c
+++ b/dsp/codecs/audio_evrc.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* evrc audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include "audio_utils_aio.h"
diff --git a/dsp/codecs/audio_g711alaw.c b/dsp/codecs/audio_g711alaw.c
index 6382616..509fba2 100644
--- a/dsp/codecs/audio_g711alaw.c
+++ b/dsp/codecs/audio_g711alaw.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/types.h>
diff --git a/dsp/codecs/audio_g711mlaw.c b/dsp/codecs/audio_g711mlaw.c
index 9994aab..d01e336 100644
--- a/dsp/codecs/audio_g711mlaw.c
+++ b/dsp/codecs/audio_g711mlaw.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/types.h>
diff --git a/dsp/codecs/audio_hwacc_effects.c b/dsp/codecs/audio_hwacc_effects.c
index f66164b..d90c424 100644
--- a/dsp/codecs/audio_hwacc_effects.c
+++ b/dsp/codecs/audio_hwacc_effects.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/msm_audio.h>
diff --git a/dsp/codecs/audio_mp3.c b/dsp/codecs/audio_mp3.c
index 4435f3e..d676609 100644
--- a/dsp/codecs/audio_mp3.c
+++ b/dsp/codecs/audio_mp3.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* mp3 audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include "audio_utils_aio.h"
diff --git a/dsp/codecs/audio_multi_aac.c b/dsp/codecs/audio_multi_aac.c
index 87e4f4e..38b2090 100644
--- a/dsp/codecs/audio_multi_aac.c
+++ b/dsp/codecs/audio_multi_aac.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* aac audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/msm_audio_aac.h>
diff --git a/dsp/codecs/audio_native.c b/dsp/codecs/audio_native.c
index 8f21cc7..e5a038f 100644
--- a/dsp/codecs/audio_native.c
+++ b/dsp/codecs/audio_native.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
/*
-Copyright (c) 2017, The Linux Foundation. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 and
-only version 2 as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-*
-*/
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ */
#include <linux/kernel.h>
#include <linux/module.h>
diff --git a/dsp/codecs/audio_qcelp.c b/dsp/codecs/audio_qcelp.c
index 4b23bac..cd1c9e3 100644
--- a/dsp/codecs/audio_qcelp.c
+++ b/dsp/codecs/audio_qcelp.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* qcelp(v13k) audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include "audio_utils_aio.h"
diff --git a/dsp/codecs/audio_utils.c b/dsp/codecs/audio_utils.c
index e559678..7b3af38 100644
--- a/dsp/codecs/audio_utils.c
+++ b/dsp/codecs/audio_utils.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/module.h>
diff --git a/dsp/codecs/audio_utils.h b/dsp/codecs/audio_utils.h
index 3ad6903..600aee7 100644
--- a/dsp/codecs/audio_utils.h
+++ b/dsp/codecs/audio_utils.h
@@ -1,14 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2010-2015, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/msm_audio.h>
#include <linux/compat.h>
diff --git a/dsp/codecs/audio_utils_aio.c b/dsp/codecs/audio_utils_aio.c
index 445bd3f..bd3ec88 100644
--- a/dsp/codecs/audio_utils_aio.c
+++ b/dsp/codecs/audio_utils_aio.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2009-2018, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/module.h>
diff --git a/dsp/codecs/audio_utils_aio.h b/dsp/codecs/audio_utils_aio.h
index bd99c36..5d7f888 100644
--- a/dsp/codecs/audio_utils_aio.h
+++ b/dsp/codecs/audio_utils_aio.h
@@ -1,16 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2009-2018, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/fs.h>
diff --git a/dsp/codecs/audio_wma.c b/dsp/codecs/audio_wma.c
index 0e8341e..1c6bfcb 100644
--- a/dsp/codecs/audio_wma.c
+++ b/dsp/codecs/audio_wma.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* wma audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2009-2018, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/types.h>
diff --git a/dsp/codecs/audio_wmapro.c b/dsp/codecs/audio_wmapro.c
index 6b1e46f..6295c7f 100644
--- a/dsp/codecs/audio_wmapro.c
+++ b/dsp/codecs/audio_wmapro.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/* wmapro audio output device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2009-2018, The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/types.h>
diff --git a/dsp/codecs/evrc_in.c b/dsp/codecs/evrc_in.c
index 15f08e7..1cf4eae 100644
--- a/dsp/codecs/evrc_in.c
+++ b/dsp/codecs/evrc_in.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/module.h>
diff --git a/dsp/codecs/g711alaw_in.c b/dsp/codecs/g711alaw_in.c
index c668b48..18bf817 100644
--- a/dsp/codecs/g711alaw_in.c
+++ b/dsp/codecs/g711alaw_in.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/module.h>
diff --git a/dsp/codecs/g711mlaw_in.c b/dsp/codecs/g711mlaw_in.c
index 2f20c13..cbe1898 100644
--- a/dsp/codecs/g711mlaw_in.c
+++ b/dsp/codecs/g711mlaw_in.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/module.h>
diff --git a/dsp/codecs/q6audio_common.h b/dsp/codecs/q6audio_common.h
index 75f20e5..bcbcb49 100644
--- a/dsp/codecs/q6audio_common.h
+++ b/dsp/codecs/q6audio_common.h
@@ -1,14 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2014, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
diff --git a/dsp/codecs/q6audio_v2.c b/dsp/codecs/q6audio_v2.c
index ea31132..bc5cacf 100644
--- a/dsp/codecs/q6audio_v2.c
+++ b/dsp/codecs/q6audio_v2.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2012-2013, 2015-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
diff --git a/dsp/codecs/q6audio_v2_aio.c b/dsp/codecs/q6audio_v2_aio.c
index 973108d..25d1d03 100644
--- a/dsp/codecs/q6audio_v2_aio.c
+++ b/dsp/codecs/q6audio_v2_aio.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/module.h>
diff --git a/dsp/codecs/qcelp_in.c b/dsp/codecs/qcelp_in.c
index be09ea4..72465a8 100644
--- a/dsp/codecs/qcelp_in.c
+++ b/dsp/codecs/qcelp_in.c
@@ -1,14 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/module.h>
diff --git a/dsp/msm-audio-event-notify.c b/dsp/msm-audio-event-notify.c
index 3f02ebb..da3188c 100644
--- a/dsp/msm-audio-event-notify.c
+++ b/dsp/msm-audio-event-notify.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
*/
#include <dsp/msm-audio-event-notify.h>
#include <linux/export.h>
diff --git a/dsp/msm-dts-srs-tm-config.c b/dsp/msm-dts-srs-tm-config.c
index fff98b5..81bb794 100644
--- a/dsp/msm-dts-srs-tm-config.c
+++ b/dsp/msm-dts-srs-tm-config.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2012-2014, 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/err.h>
@@ -272,23 +264,23 @@
* msm_dts_srs_tm_add_controls -
* Add DTS SRS module controls
*
- * @platform: component to which controls can be registered
+ * @component: component to which controls can be registered
*
*/
-void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform)
+void msm_dts_srs_tm_add_controls(struct snd_soc_component *component)
{
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
lpa_srs_trumedia_controls,
ARRAY_SIZE(lpa_srs_trumedia_controls));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
lpa_srs_trumedia_controls_hdmi,
ARRAY_SIZE(lpa_srs_trumedia_controls_hdmi));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
lpa_srs_trumedia_controls_i2s,
ARRAY_SIZE(lpa_srs_trumedia_controls_i2s));
- snd_soc_add_platform_controls(platform,
+ snd_soc_add_component_controls(component,
lpa_srs_trumedia_controls_mi2s,
ARRAY_SIZE(lpa_srs_trumedia_controls_mi2s));
}
diff --git a/dsp/msm_audio_ion.c b/dsp/msm_audio_ion.c
index 8bfcdc4..af2b3c4 100644
--- a/dsp/msm_audio_ion.c
+++ b/dsp/msm_audio_ion.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/init.h>
diff --git a/dsp/msm_mdf.c b/dsp/msm_mdf.c
index fcc8a5c..674dd74 100644
--- a/dsp/msm_mdf.c
+++ b/dsp/msm_mdf.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/init.h>
#include <linux/kernel.h>
diff --git a/dsp/q6_init.c b/dsp/q6_init.c
index 5c194fb..bd8a2f8 100644
--- a/dsp/q6_init.c
+++ b/dsp/q6_init.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
-Copyright (c) 2017, The Linux Foundation. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 and
-only version 2 as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-*
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
diff --git a/dsp/q6_init.h b/dsp/q6_init.h
index 541fbe7..71af2da 100644
--- a/dsp/q6_init.h
+++ b/dsp/q6_init.h
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
-Copyright (c) 2017, The Linux Foundation. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 and
-only version 2 as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-*
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6_INIT_H__
diff --git a/dsp/q6adm.c b/dsp/q6adm.c
index 423b52e..4534c4c 100644
--- a/dsp/q6adm.c
+++ b/dsp/q6adm.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
#include <linux/slab.h>
diff --git a/dsp/q6afe.c b/dsp/q6afe.c
index 2810beb..8ae2739 100644
--- a/dsp/q6afe.c
+++ b/dsp/q6afe.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/debugfs.h>
diff --git a/dsp/q6afecal-hwdep.c b/dsp/q6afecal-hwdep.c
index 5fea2d2..c399fa6 100644
--- a/dsp/q6afecal-hwdep.c
+++ b/dsp/q6afecal-hwdep.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) 2015, 2017 - 2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+ * Copyright (c) 2015, 2017, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
#include <linux/platform_device.h>
diff --git a/dsp/q6afecal-hwdep.h b/dsp/q6afecal-hwdep.h
index 7e6efda..d48b80f 100644
--- a/dsp/q6afecal-hwdep.h
+++ b/dsp/q6afecal-hwdep.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2014,2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2014, 2018, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6AFECAL_HWDEP_H__
#define __Q6AFECAL_HWDEP_H__
diff --git a/dsp/q6asm.c b/dsp/q6asm.c
index 7a8b941..4732846 100644
--- a/dsp/q6asm.c
+++ b/dsp/q6asm.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- * Author: Brian Swetland <swetland@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#include <linux/fs.h>
#include <linux/mutex.h>
diff --git a/dsp/q6audio-v2.c b/dsp/q6audio-v2.c
index 5a7fa6f..29a99fe 100644
--- a/dsp/q6audio-v2.c
+++ b/dsp/q6audio-v2.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
diff --git a/dsp/q6common.c b/dsp/q6common.c
index 7a186dc..0c5427d 100644
--- a/dsp/q6common.c
+++ b/dsp/q6common.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*/
#include <dsp/q6common.h>
diff --git a/dsp/q6core.c b/dsp/q6core.c
index d4ea984..2fdc794 100644
--- a/dsp/q6core.c
+++ b/dsp/q6core.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
diff --git a/dsp/q6lsm.c b/dsp/q6lsm.c
index 46e2013..3a7cee4 100644
--- a/dsp/q6lsm.c
+++ b/dsp/q6lsm.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2013-2018, Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/fs.h>
#include <linux/mutex.h>
diff --git a/dsp/q6usm.c b/dsp/q6usm.c
index 3c335a8..70ebc9f 100644
--- a/dsp/q6usm.c
+++ b/dsp/q6usm.c
@@ -1,14 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/mutex.h>
#include <linux/wait.h>
diff --git a/dsp/q6usm.h b/dsp/q6usm.h
index ba4f9a9..975b896 100644
--- a/dsp/q6usm.h
+++ b/dsp/q6usm.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2011-2014, 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011-2014, 2018, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6_USM_H__
#define __Q6_USM_H__
diff --git a/dsp/q6voice.c b/dsp/q6voice.c
index ce86564..95a153d 100644
--- a/dsp/q6voice.c
+++ b/dsp/q6voice.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/kthread.h>
diff --git a/dsp/rtac.c b/dsp/rtac.c
index c6bca98..94cb715 100644
--- a/dsp/rtac.c
+++ b/dsp/rtac.c
@@ -1,14 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/fs.h>
diff --git a/dsp/usf.c b/dsp/usf.c
index 263ba1f..c6850e5 100644
--- a/dsp/usf.c
+++ b/dsp/usf.c
@@ -1,14 +1,6 @@
-/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
*/
#include <linux/compat.h>
diff --git a/dsp/usf.h b/dsp/usf.h
index 544b624..5aeec06 100644
--- a/dsp/usf.h
+++ b/dsp/usf.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*/
#ifndef __USF_H__
diff --git a/dsp/usfcdev.c b/dsp/usfcdev.c
index 2896166..cab7661 100644
--- a/dsp/usfcdev.c
+++ b/dsp/usfcdev.c
@@ -1,14 +1,6 @@
-/* Copyright (c) 2012-2013, 2016-2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012-2013, 2016-2017 The Linux Foundation. All rights reserved.
*/
#include <linux/sched.h>
diff --git a/dsp/usfcdev.h b/dsp/usfcdev.h
index 03b62c5..dcde63b 100644
--- a/dsp/usfcdev.h
+++ b/dsp/usfcdev.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012, The Linux Foundation. All rights reserved.
*/
#ifndef __USFCDEV_H__
#define __USFCDEV_H__
diff --git a/include/asoc/wcd-irq.h b/include/asoc/wcd-irq.h
index 63502f8..7ae15dc 100644
--- a/include/asoc/wcd-irq.h
+++ b/include/asoc/wcd-irq.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
*/
#ifndef __WCD_IRQ_H_
@@ -44,19 +37,19 @@
{
return 0;
};
-static inline int wcd_request_irq(struct wcd_irq_info *irq,
+static inline int wcd_request_irq(struct wcd_irq_info *irq_info,
int irq, const char *name,
irq_handler_t handler, void *data)
{
return 0;
};
-static inline void wcd_free_irq(struct wcd_irq_info *irq, int irq, void *data);
+static inline void wcd_free_irq(struct wcd_irq_info *irq_info, int irq, void *data);
{
};
-static inline void wcd_enable_irq(struct wcd_irq_info *irq, int irq);
+static inline void wcd_enable_irq(struct wcd_irq_info *irq_info, int irq);
{
};
-static inline void wcd_disable_irq(struct wcd_irq_info *irq, int irq);
+static inline void wcd_disable_irq(struct wcd_irq_info *irq_info, int irq);
{
};
#endif
diff --git a/include/asoc/wcd934x_registers.h b/include/asoc/wcd934x_registers.h
index a824875..785b906 100644
--- a/include/asoc/wcd934x_registers.h
+++ b/include/asoc/wcd934x_registers.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WCD934X_REGISTERS_H
diff --git a/include/asoc/wcd9xxx_registers.h b/include/asoc/wcd9xxx_registers.h
index 928dfcc..5d270cd 100644
--- a/include/asoc/wcd9xxx_registers.h
+++ b/include/asoc/wcd9xxx_registers.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _WCD9XXX_REGISTERS_H
diff --git a/include/dsp/apr_audio-v2.h b/include/dsp/apr_audio-v2.h
index 9ac7281..d8e6d34 100644
--- a/include/dsp/apr_audio-v2.h
+++ b/include/dsp/apr_audio-v2.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
diff --git a/include/dsp/audio_cal_utils.h b/include/dsp/audio_cal_utils.h
index 614ef23..c3772b0 100644
--- a/include/dsp/audio_cal_utils.h
+++ b/include/dsp/audio_cal_utils.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2014, 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2014, 2018, The Linux Foundation. All rights reserved.
*/
#ifndef _AUDIO_CAL_UTILS_H
#define _AUDIO_CAL_UTILS_H
diff --git a/include/dsp/audio_calibration.h b/include/dsp/audio_calibration.h
index 5decff9..d414d8f 100644
--- a/include/dsp/audio_calibration.h
+++ b/include/dsp/audio_calibration.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2014, 2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2014, 2017, The Linux Foundation. All rights reserved.
*/
#ifndef _AUDIO_CALIBRATION_H
#define _AUDIO_CALIBRATION_H
diff --git a/include/dsp/audio_notifier.h b/include/dsp/audio_notifier.h
index 7eda2c3..2b73826 100644
--- a/include/dsp/audio_notifier.h
+++ b/include/dsp/audio_notifier.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2016, 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2016, 2018, The Linux Foundation. All rights reserved.
*/
#ifndef __AUDIO_NOTIFIER_H_
diff --git a/include/dsp/msm-audio-effects-q6-v2.h b/include/dsp/msm-audio-effects-q6-v2.h
index 6bc2338..da7ec8b 100644
--- a/include/dsp/msm-audio-effects-q6-v2.h
+++ b/include/dsp/msm-audio-effects-q6-v2.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _MSM_AUDIO_EFFECTS_H
diff --git a/include/dsp/msm-audio-event-notify.h b/include/dsp/msm-audio-event-notify.h
index fc47eff..49c00b7 100644
--- a/include/dsp/msm-audio-event-notify.h
+++ b/include/dsp/msm-audio-event-notify.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
*/
#ifndef __MSM_AUDIO_EVENT_NOTIFY_H_
diff --git a/include/dsp/msm-dts-srs-tm-config.h b/include/dsp/msm-dts-srs-tm-config.h
index c00461b..36d25be 100644
--- a/include/dsp/msm-dts-srs-tm-config.h
+++ b/include/dsp/msm-dts-srs-tm-config.h
@@ -1,13 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Copyright (c) 2012-2014, 2017 The Linux Foundation. All rights reserved.
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2012-2014, 2017-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_DTS_SRS_TM_CONFIG_H_
@@ -28,13 +21,13 @@
void msm_dts_srs_tm_ion_memmap(struct param_outband *po_);
void msm_dts_srs_tm_init(int port_id, int copp_idx);
void msm_dts_srs_tm_deinit(int port_id);
-void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform);
+void msm_dts_srs_tm_add_controls(struct snd_soc_component *component);
#else
static inline void msm_dts_srs_tm_ion_memmap(struct param_outband *po_) { }
static inline void msm_dts_srs_tm_init(int port_id, int copp_idx) { }
static inline void msm_dts_srs_tm_deinit(int port_id) { }
static inline void msm_dts_srs_tm_add_controls(
- struct snd_soc_platform *platform) { }
+ struct snd_soc_component *component) { }
#endif
diff --git a/include/dsp/msm_audio_ion.h b/include/dsp/msm_audio_ion.h
index 9235adc..5120383 100644
--- a/include/dsp/msm_audio_ion.h
+++ b/include/dsp/msm_audio_ion.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2013-2015, 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _LINUX_MSM_AUDIO_ION_H
diff --git a/include/dsp/msm_mdf.h b/include/dsp/msm_mdf.h
index 5b27f12..efd6fc5 100644
--- a/include/dsp/msm_mdf.h
+++ b/include/dsp/msm_mdf.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef _LINUX_MSM_MDF_H
diff --git a/include/dsp/q6adm-v2.h b/include/dsp/q6adm-v2.h
index bf3d0f0..404f84c 100644
--- a/include/dsp/q6adm-v2.h
+++ b/include/dsp/q6adm-v2.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6_ADM_V2_H__
#define __Q6_ADM_V2_H__
diff --git a/include/dsp/q6afe-v2.h b/include/dsp/q6afe-v2.h
index eb5fc83..423a169 100644
--- a/include/dsp/q6afe-v2.h
+++ b/include/dsp/q6afe-v2.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6AFE_V2_H__
#define __Q6AFE_V2_H__
diff --git a/include/dsp/q6asm-v2.h b/include/dsp/q6asm-v2.h
index 2d738d6..df2c0d7 100644
--- a/include/dsp/q6asm-v2.h
+++ b/include/dsp/q6asm-v2.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6_ASM_V2_H__
#define __Q6_ASM_V2_H__
diff --git a/include/dsp/q6audio-v2.h b/include/dsp/q6audio-v2.h
index 5df88fc..4c9daeb 100644
--- a/include/dsp/q6audio-v2.h
+++ b/include/dsp/q6audio-v2.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2013, 2015 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012-2013, 2015, The Linux Foundation. All rights reserved.
*/
#ifndef _Q6_AUDIO_H_
diff --git a/include/dsp/q6common.h b/include/dsp/q6common.h
index 552f976..0d270bd 100644
--- a/include/dsp/q6common.h
+++ b/include/dsp/q6common.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6COMMON_H__
diff --git a/include/dsp/q6core.h b/include/dsp/q6core.h
index e1f8b97..5e008e1 100644
--- a/include/dsp/q6core.h
+++ b/include/dsp/q6core.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6CORE_H__
diff --git a/include/dsp/q6lsm.h b/include/dsp/q6lsm.h
index 5670d77..c6a0d60 100644
--- a/include/dsp/q6lsm.h
+++ b/include/dsp/q6lsm.h
@@ -1,14 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#ifndef __Q6LSM_H__
#define __Q6LSM_H__
diff --git a/include/dsp/q6voice.h b/include/dsp/q6voice.h
index ca42508..a674384 100644
--- a/include/dsp/q6voice.h
+++ b/include/dsp/q6voice.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __QDSP6VOICE_H__
#define __QDSP6VOICE_H__
diff --git a/include/dsp/rtac.h b/include/dsp/rtac.h
index 05dd82a..7a1fed5 100644
--- a/include/dsp/rtac.h
+++ b/include/dsp/rtac.h
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2011, 2013-2015, 2017-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#ifndef __RTAC_H__
diff --git a/include/ipc/apr.h b/include/ipc/apr.h
index 6b4817e..4e29b02 100644
--- a/include/ipc/apr.h
+++ b/include/ipc/apr.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
*/
#ifndef __APR_H_
#define __APR_H_
diff --git a/include/ipc/apr_tal.h b/include/ipc/apr_tal.h
index 534fd84..9e412e5 100644
--- a/include/ipc/apr_tal.h
+++ b/include/ipc/apr_tal.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2010-2011, 2016-2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2010-2011, 2016-2018 The Linux Foundation. All rights reserved.
*/
#ifndef __APR_TAL_H_
#define __APR_TAL_H_
diff --git a/include/ipc/apr_us.h b/include/ipc/apr_us.h
index 6e2f63d..ea9a275 100644
--- a/include/ipc/apr_us.h
+++ b/include/ipc/apr_us.h
@@ -1,14 +1,6 @@
-/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*/
#ifndef __APR_US_H__
#define __APR_US_H__
diff --git a/include/soc/soundwire.h b/include/soc/soundwire.h
index 3bc3332..daacb7a 100644
--- a/include/soc/soundwire.h
+++ b/include/soc/soundwire.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _LINUX_SOUNDWIRE_H
diff --git a/include/soc/swr-wcd.h b/include/soc/swr-wcd.h
index 7eaad27..93c5ffd 100644
--- a/include/soc/swr-wcd.h
+++ b/include/soc/swr-wcd.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2015, 2017-2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2015, 2017-2018 The Linux Foundation. All rights reserved.
*/
#ifndef _LINUX_SWR_WCD_H
diff --git a/include/uapi/linux/msm_audio.h b/include/uapi/linux/msm_audio.h
index 3213d00..171d5b3 100644
--- a/include/uapi/linux/msm_audio.h
+++ b/include/uapi/linux/msm_audio.h
@@ -1,17 +1,8 @@
-/* include/linux/msm_audio.h
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
*
* Copyright (C) 2008 Google, Inc.
* Copyright (c) 2012, 2014, 2017 The Linux Foundation. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
#ifndef _UAPI_LINUX_MSM_AUDIO_H
diff --git a/ipc/apr.c b/ipc/apr.c
index 990a103..573d52d 100644
--- a/ipc/apr.c
+++ b/ipc/apr.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2010-2014, 2016-2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2010-2014, 2016-2018 The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
diff --git a/ipc/apr_tal_rpmsg.c b/ipc/apr_tal_rpmsg.c
index aaadca4..a4175b4 100644
--- a/ipc/apr_tal_rpmsg.c
+++ b/ipc/apr_tal_rpmsg.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/module.h>
diff --git a/ipc/apr_v2.c b/ipc/apr_v2.c
index e85173c..f74218e 100644
--- a/ipc/apr_v2.c
+++ b/ipc/apr_v2.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
*/
#include <linux/types.h>
diff --git a/ipc/apr_v3.c b/ipc/apr_v3.c
index fa68daf..a2df4d8 100644
--- a/ipc/apr_v3.c
+++ b/ipc/apr_v3.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/types.h>
diff --git a/ipc/wcd-dsp-glink.c b/ipc/wcd-dsp-glink.c
index 79ff26a..455a348 100644
--- a/ipc/wcd-dsp-glink.c
+++ b/ipc/wcd-dsp-glink.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
diff --git a/soc/pinctrl-lpi.c b/soc/pinctrl-lpi.c
index 279ec00..91a0bce 100644
--- a/soc/pinctrl-lpi.c
+++ b/soc/pinctrl-lpi.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/gpio.h>
diff --git a/soc/pinctrl-wcd.c b/soc/pinctrl-wcd.c
index d7695db..8dc97bd 100644
--- a/soc/pinctrl-wcd.c
+++ b/soc/pinctrl-wcd.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/gpio.h>
diff --git a/soc/regmap-swr.c b/soc/regmap-swr.c
index ba092a2..7f00aab 100644
--- a/soc/regmap-swr.c
+++ b/soc/regmap-swr.c
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/device.h>
diff --git a/soc/soundwire.c b/soc/soundwire.c
index 573d39d..bd91caf 100644
--- a/soc/soundwire.c
+++ b/soc/soundwire.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c
index efb20f7..7fa0737 100644
--- a/soc/swr-mstr-ctrl.c
+++ b/soc/swr-mstr-ctrl.c
@@ -1,13 +1,6 @@
-/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/irq.h>
diff --git a/soc/swr-mstr-ctrl.h b/soc/swr-mstr-ctrl.h
index b3e358a..085a065 100644
--- a/soc/swr-mstr-ctrl.h
+++ b/soc/swr-mstr-ctrl.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _SWR_WCD_CTRL_H
diff --git a/soc/swr-wcd-ctrl.c b/soc/swr-wcd-ctrl.c
index ecca5f6..ed410fd 100644
--- a/soc/swr-wcd-ctrl.c
+++ b/soc/swr-wcd-ctrl.c
@@ -1,13 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/irq.h>
diff --git a/soc/swr-wcd-ctrl.h b/soc/swr-wcd-ctrl.h
index 14b2b48..23b4434 100644
--- a/soc/swr-wcd-ctrl.h
+++ b/soc/swr-wcd-ctrl.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _SWR_WCD_CTRL_H
diff --git a/soc/swrm_port_config.h b/soc/swrm_port_config.h
index 6dbd1de..8c29032 100644
--- a/soc/swrm_port_config.h
+++ b/soc/swrm_port_config.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2018 The Linux Foundation. All rights reserved.
*/
#ifndef _SWRM_PORT_CONFIG
diff --git a/soc/swrm_registers.h b/soc/swrm_registers.h
index ecff48d..c8ec2a3 100644
--- a/soc/swrm_registers.h
+++ b/soc/swrm_registers.h
@@ -1,13 +1,6 @@
-/* Copyright (c) 2015, 2018 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2015, 2018 The Linux Foundation. All rights reserved.
*/
#ifndef _SWRM_REGISTERS_H