ASoC: codec: Update codec driver to component driver

Some alsa API are removed in kernel-4.19 which would cause
codec driver compile failure. Update codec driver to fix it.

Change-Id: Ie358ec1863082166958059c179300b453d2a03ad
Signed-off-by: Meng Wang <mengw@codeaurora.org>
此提交包含在:
Meng Wang
2018-09-06 10:49:18 +08:00
提交者 Gerrit - the friendly Code Review server
父節點 ee084a068e
當前提交 15c825d077
共有 59 個檔案被更改,包括 8532 行新增6916 行删除

查看文件

@@ -19,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},
@@ -247,7 +249,7 @@ static bool csra66x0_readable_registers(struct device *dev, unsigned int reg)
/* 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;
@@ -312,7 +314,7 @@ static ssize_t debugfs_codec_write_op(struct file *filp,
{
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];
@@ -328,46 +330,47 @@ static ssize_t debugfs_codec_write_op(struct file *filp,
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;
}
@@ -384,12 +387,12 @@ static ssize_t debugfs_codec_read_op(struct file *filp,
{
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;
}
@@ -415,16 +418,17 @@ static int csra66x0_get_volume(struct snd_kcontrol *kcontrol,
{
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;
@@ -436,8 +440,10 @@ static int csra66x0_set_volume(struct snd_kcontrol *kcontrol,
{
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];
@@ -449,10 +455,10 @@ static int csra66x0_set_volume(struct snd_kcontrol *kcontrol,
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;
}
@@ -526,51 +532,66 @@ static const struct snd_soc_dapm_route csra66x0_dapm_routes[] = {
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);
@@ -579,37 +600,39 @@ static int csra66x0_init(struct csra66x0_priv *csra66x0)
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;
@@ -617,51 +640,58 @@ static int csra66x0_reset(struct csra66x0_priv *csra66x0)
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))) {
@@ -669,21 +699,21 @@ static int csra66x0_soc_probe(struct snd_soc_codec *codec)
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);
}
@@ -694,53 +724,45 @@ static int csra66x0_soc_probe(struct snd_soc_codec *codec)
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 = {
@@ -758,19 +780,20 @@ static struct regmap_config csra66x0_regmap_config = {
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;
@@ -780,7 +803,7 @@ static irqreturn_t csra66x0_irq(int irq, void *data)
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;
@@ -790,7 +813,7 @@ static irqreturn_t csra66x0_irq(int irq, void *data)
}
/* 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;
@@ -800,7 +823,7 @@ static irqreturn_t csra66x0_irq(int irq, void *data)
}
/* 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;
@@ -958,7 +981,7 @@ static int csra66x0_i2c_probe(struct i2c_client *client_i2c,
#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",
@@ -985,7 +1008,7 @@ static int csra66x0_i2c_remove(struct i2c_client *i2c_client)
debugfs_remove_recursive(csra66x0->debugfs_dir);
#endif
}
snd_soc_unregister_codec(&i2c_client->dev);
snd_soc_unregister_component(&i2c_client->dev);
return 0;
}