This commit is contained in:
Mark Brown 2019-02-26 12:18:11 +00:00
commit ae3f563a85
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
5 changed files with 87 additions and 34 deletions

View File

@ -42,7 +42,7 @@ struct pcm186x_priv {
bool is_master_mode;
};
static const DECLARE_TLV_DB_SCALE(pcm186x_pga_tlv, -1200, 4000, 50);
static const DECLARE_TLV_DB_SCALE(pcm186x_pga_tlv, -1200, 50, 0);
static const struct snd_kcontrol_new pcm1863_snd_controls[] = {
SOC_DOUBLE_R_S_TLV("ADC Capture Volume", PCM186X_PGA_VAL_CH1_L,
@ -158,7 +158,7 @@ static const struct snd_soc_dapm_widget pcm1863_dapm_widgets[] = {
* Put the codec into SLEEP mode when not in use, allowing the
* Energysense mechanism to operate.
*/
SND_SOC_DAPM_ADC("ADC", "HiFi Capture", PCM186X_POWER_CTRL, 1, 0),
SND_SOC_DAPM_ADC("ADC", "HiFi Capture", PCM186X_POWER_CTRL, 1, 1),
};
static const struct snd_soc_dapm_widget pcm1865_dapm_widgets[] = {
@ -184,8 +184,8 @@ static const struct snd_soc_dapm_widget pcm1865_dapm_widgets[] = {
* Put the codec into SLEEP mode when not in use, allowing the
* Energysense mechanism to operate.
*/
SND_SOC_DAPM_ADC("ADC1", "HiFi Capture 1", PCM186X_POWER_CTRL, 1, 0),
SND_SOC_DAPM_ADC("ADC2", "HiFi Capture 2", PCM186X_POWER_CTRL, 1, 0),
SND_SOC_DAPM_ADC("ADC1", "HiFi Capture 1", PCM186X_POWER_CTRL, 1, 1),
SND_SOC_DAPM_ADC("ADC2", "HiFi Capture 2", PCM186X_POWER_CTRL, 1, 1),
};
static const struct snd_soc_dapm_route pcm1863_dapm_routes[] = {

View File

@ -3529,6 +3529,23 @@ static int wm_adsp_buffer_free(struct wm_adsp *dsp)
return 0;
}
static int wm_adsp_buffer_get_error(struct wm_adsp_compr_buf *buf)
{
int ret;
ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(error), &buf->error);
if (ret < 0) {
adsp_err(buf->dsp, "Failed to check buffer error: %d\n", ret);
return ret;
}
if (buf->error != 0) {
adsp_err(buf->dsp, "Buffer error occurred: %d\n", buf->error);
return -EIO;
}
return 0;
}
int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd)
{
struct wm_adsp_compr *compr = stream->runtime->private_data;
@ -3550,6 +3567,10 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd)
}
}
ret = wm_adsp_buffer_get_error(compr->buf);
if (ret < 0)
break;
wm_adsp_buffer_clear(compr->buf);
/* Trigger the IRQ at one fragment of data */
@ -3625,23 +3646,6 @@ static int wm_adsp_buffer_update_avail(struct wm_adsp_compr_buf *buf)
return 0;
}
static int wm_adsp_buffer_get_error(struct wm_adsp_compr_buf *buf)
{
int ret;
ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(error), &buf->error);
if (ret < 0) {
compr_err(buf, "Failed to check buffer error: %d\n", ret);
return ret;
}
if (buf->error != 0) {
compr_err(buf, "Buffer error occurred: %d\n", buf->error);
return -EIO;
}
return 0;
}
int wm_adsp_compr_handle_irq(struct wm_adsp *dsp)
{
struct wm_adsp_compr_buf *buf;

View File

@ -255,6 +255,30 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)
RSND_GEN_M_REG(SSI_MODE, 0xc, 0x80),
RSND_GEN_M_REG(SSI_CTRL, 0x10, 0x80),
RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80),
RSND_GEN_S_REG(SSI9_BUSIF0_MODE, 0x48c),
RSND_GEN_S_REG(SSI9_BUSIF0_ADINR, 0x484),
RSND_GEN_S_REG(SSI9_BUSIF0_DALIGN, 0x488),
RSND_GEN_S_REG(SSI9_BUSIF1_MODE, 0x4a0),
RSND_GEN_S_REG(SSI9_BUSIF1_ADINR, 0x4a4),
RSND_GEN_S_REG(SSI9_BUSIF1_DALIGN, 0x4a8),
RSND_GEN_S_REG(SSI9_BUSIF2_MODE, 0x4c0),
RSND_GEN_S_REG(SSI9_BUSIF2_ADINR, 0x4c4),
RSND_GEN_S_REG(SSI9_BUSIF2_DALIGN, 0x4c8),
RSND_GEN_S_REG(SSI9_BUSIF3_MODE, 0x4e0),
RSND_GEN_S_REG(SSI9_BUSIF3_ADINR, 0x4e4),
RSND_GEN_S_REG(SSI9_BUSIF3_DALIGN, 0x4e8),
RSND_GEN_S_REG(SSI9_BUSIF4_MODE, 0xd80),
RSND_GEN_S_REG(SSI9_BUSIF4_ADINR, 0xd84),
RSND_GEN_S_REG(SSI9_BUSIF4_DALIGN, 0xd88),
RSND_GEN_S_REG(SSI9_BUSIF5_MODE, 0xda0),
RSND_GEN_S_REG(SSI9_BUSIF5_ADINR, 0xda4),
RSND_GEN_S_REG(SSI9_BUSIF5_DALIGN, 0xda8),
RSND_GEN_S_REG(SSI9_BUSIF6_MODE, 0xdc0),
RSND_GEN_S_REG(SSI9_BUSIF6_ADINR, 0xdc4),
RSND_GEN_S_REG(SSI9_BUSIF6_DALIGN, 0xdc8),
RSND_GEN_S_REG(SSI9_BUSIF7_MODE, 0xde0),
RSND_GEN_S_REG(SSI9_BUSIF7_ADINR, 0xde4),
RSND_GEN_S_REG(SSI9_BUSIF7_DALIGN, 0xde8),
};
static const struct rsnd_regmap_field_conf conf_scu[] = {

View File

@ -191,6 +191,30 @@ enum rsnd_reg {
SSI_SYS_STATUS7,
HDMI0_SEL,
HDMI1_SEL,
SSI9_BUSIF0_MODE,
SSI9_BUSIF1_MODE,
SSI9_BUSIF2_MODE,
SSI9_BUSIF3_MODE,
SSI9_BUSIF4_MODE,
SSI9_BUSIF5_MODE,
SSI9_BUSIF6_MODE,
SSI9_BUSIF7_MODE,
SSI9_BUSIF0_ADINR,
SSI9_BUSIF1_ADINR,
SSI9_BUSIF2_ADINR,
SSI9_BUSIF3_ADINR,
SSI9_BUSIF4_ADINR,
SSI9_BUSIF5_ADINR,
SSI9_BUSIF6_ADINR,
SSI9_BUSIF7_ADINR,
SSI9_BUSIF0_DALIGN,
SSI9_BUSIF1_DALIGN,
SSI9_BUSIF2_DALIGN,
SSI9_BUSIF3_DALIGN,
SSI9_BUSIF4_DALIGN,
SSI9_BUSIF5_DALIGN,
SSI9_BUSIF6_DALIGN,
SSI9_BUSIF7_DALIGN,
/* SSI */
SSICR,
@ -209,6 +233,9 @@ enum rsnd_reg {
#define SSI_BUSIF_MODE(i) (SSI_BUSIF0_MODE + (i))
#define SSI_BUSIF_ADINR(i) (SSI_BUSIF0_ADINR + (i))
#define SSI_BUSIF_DALIGN(i) (SSI_BUSIF0_DALIGN + (i))
#define SSI9_BUSIF_MODE(i) (SSI9_BUSIF0_MODE + (i))
#define SSI9_BUSIF_ADINR(i) (SSI9_BUSIF0_ADINR + (i))
#define SSI9_BUSIF_DALIGN(i) (SSI9_BUSIF0_DALIGN + (i))
#define SSI_SYS_STATUS(i) (SSI_SYS_STATUS0 + (i))

View File

@ -181,28 +181,26 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
if (rsnd_ssi_use_busif(io)) {
int id = rsnd_mod_id(mod);
int busif = rsnd_mod_id_sub(mod);
enum rsnd_reg adinr_reg, mode_reg, dalign_reg;
/*
* FIXME
*
* We can't support SSI9-4/5/6/7, because its address is
* out of calculation rule
*/
if ((id == 9) && (busif >= 4)) {
struct device *dev = rsnd_priv_to_dev(priv);
dev_err(dev, "This driver doesn't support SSI%d-%d, so far",
id, busif);
adinr_reg = SSI9_BUSIF_ADINR(busif);
mode_reg = SSI9_BUSIF_MODE(busif);
dalign_reg = SSI9_BUSIF_DALIGN(busif);
} else {
adinr_reg = SSI_BUSIF_ADINR(busif);
mode_reg = SSI_BUSIF_MODE(busif);
dalign_reg = SSI_BUSIF_DALIGN(busif);
}
rsnd_mod_write(mod, SSI_BUSIF_ADINR(busif),
rsnd_mod_write(mod, adinr_reg,
rsnd_get_adinr_bit(mod, io) |
(rsnd_io_is_play(io) ?
rsnd_runtime_channel_after_ctu(io) :
rsnd_runtime_channel_original(io)));
rsnd_mod_write(mod, SSI_BUSIF_MODE(busif),
rsnd_mod_write(mod, mode_reg,
rsnd_get_busif_shift(io, mod) | 1);
rsnd_mod_write(mod, SSI_BUSIF_DALIGN(busif),
rsnd_mod_write(mod, dalign_reg,
rsnd_get_dalign(mod, io));
}