Commit d00a9e02 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/fix/cs4265', 'asoc/fix/intel' and...

Merge remote-tracking branches 'asoc/fix/cs4265', 'asoc/fix/intel' and 'asoc/fix/topology' into asoc-linus
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
#define SND_SOC_TPLG_NUM_TEXTS 16 #define SND_SOC_TPLG_NUM_TEXTS 16
/* ABI version */ /* ABI version */
#define SND_SOC_TPLG_ABI_VERSION 0x2 #define SND_SOC_TPLG_ABI_VERSION 0x3
/* Max size of TLV data */ /* Max size of TLV data */
#define SND_SOC_TPLG_TLV_SIZE 32 #define SND_SOC_TPLG_TLV_SIZE 32
...@@ -97,7 +97,8 @@ ...@@ -97,7 +97,8 @@
#define SND_SOC_TPLG_TYPE_PCM 7 #define SND_SOC_TPLG_TYPE_PCM 7
#define SND_SOC_TPLG_TYPE_MANIFEST 8 #define SND_SOC_TPLG_TYPE_MANIFEST 8
#define SND_SOC_TPLG_TYPE_CODEC_LINK 9 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9
#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_CODEC_LINK #define SND_SOC_TPLG_TYPE_PDATA 10
#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_PDATA
/* vendor block IDs - please add new vendor types to end */ /* vendor block IDs - please add new vendor types to end */
#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
...@@ -137,11 +138,19 @@ struct snd_soc_tplg_private { ...@@ -137,11 +138,19 @@ struct snd_soc_tplg_private {
/* /*
* Kcontrol TLV data. * Kcontrol TLV data.
*/ */
struct snd_soc_tplg_tlv_dbscale {
__le32 min;
__le32 step;
__le32 mute;
} __attribute__((packed));
struct snd_soc_tplg_ctl_tlv { struct snd_soc_tplg_ctl_tlv {
__le32 size; /* in bytes aligned to 4 */ __le32 size; /* in bytes of this structure */
__le32 numid; /* control element numeric identification */ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
__le32 count; /* number of elem in data array */ union {
__le32 data[SND_SOC_TPLG_TLV_SIZE]; __le32 data[SND_SOC_TPLG_TLV_SIZE];
struct snd_soc_tplg_tlv_dbscale scale;
};
} __attribute__((packed)); } __attribute__((packed));
/* /*
...@@ -155,9 +164,11 @@ struct snd_soc_tplg_channel { ...@@ -155,9 +164,11 @@ struct snd_soc_tplg_channel {
} __attribute__((packed)); } __attribute__((packed));
/* /*
* Kcontrol Operations IDs * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
* Kcontrol ops need get/put/info.
* Bytes ext ops need get/put.
*/ */
struct snd_soc_tplg_kcontrol_ops_id { struct snd_soc_tplg_io_ops {
__le32 get; __le32 get;
__le32 put; __le32 put;
__le32 info; __le32 info;
...@@ -171,8 +182,8 @@ struct snd_soc_tplg_ctl_hdr { ...@@ -171,8 +182,8 @@ struct snd_soc_tplg_ctl_hdr {
__le32 type; __le32 type;
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le32 access; __le32 access;
struct snd_soc_tplg_kcontrol_ops_id ops; struct snd_soc_tplg_io_ops ops;
__le32 tlv_size; /* non zero means control has TLV data */ struct snd_soc_tplg_ctl_tlv tlv;
} __attribute__((packed)); } __attribute__((packed));
/* /*
...@@ -238,6 +249,7 @@ struct snd_soc_tplg_manifest { ...@@ -238,6 +249,7 @@ struct snd_soc_tplg_manifest {
__le32 graph_elems; /* number of graph elements */ __le32 graph_elems; /* number of graph elements */
__le32 dai_elems; /* number of DAI elements */ __le32 dai_elems; /* number of DAI elements */
__le32 dai_link_elems; /* number of DAI link elements */ __le32 dai_link_elems; /* number of DAI link elements */
struct snd_soc_tplg_private priv;
} __attribute__((packed)); } __attribute__((packed));
/* /*
...@@ -259,7 +271,6 @@ struct snd_soc_tplg_mixer_control { ...@@ -259,7 +271,6 @@ struct snd_soc_tplg_mixer_control {
__le32 invert; __le32 invert;
__le32 num_channels; __le32 num_channels;
struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
struct snd_soc_tplg_ctl_tlv tlv;
struct snd_soc_tplg_private priv; struct snd_soc_tplg_private priv;
} __attribute__((packed)); } __attribute__((packed));
...@@ -303,6 +314,7 @@ struct snd_soc_tplg_bytes_control { ...@@ -303,6 +314,7 @@ struct snd_soc_tplg_bytes_control {
__le32 mask; __le32 mask;
__le32 base; __le32 base;
__le32 num_regs; __le32 num_regs;
struct snd_soc_tplg_io_ops ext_ops;
struct snd_soc_tplg_private priv; struct snd_soc_tplg_private priv;
} __attribute__((packed)); } __attribute__((packed));
...@@ -347,6 +359,7 @@ struct snd_soc_tplg_dapm_widget { ...@@ -347,6 +359,7 @@ struct snd_soc_tplg_dapm_widget {
__le32 reg; /* negative reg = no direct dapm */ __le32 reg; /* negative reg = no direct dapm */
__le32 shift; /* bits to shift */ __le32 shift; /* bits to shift */
__le32 mask; /* non-shifted mask */ __le32 mask; /* non-shifted mask */
__le32 subseq; /* sort within widget type */
__u32 invert; /* invert the power bit */ __u32 invert; /* invert the power bit */
__u32 ignore_suspend; /* kept enabled over suspend */ __u32 ignore_suspend; /* kept enabled over suspend */
__u16 event_flags; __u16 event_flags;
......
...@@ -457,14 +457,14 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -457,14 +457,14 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
case SND_SOC_DAIFMT_RIGHT_J: case SND_SOC_DAIFMT_RIGHT_J:
if (params_width(params) == 16) { if (params_width(params) == 16) {
snd_soc_update_bits(codec, CS4265_DAC_CTL, snd_soc_update_bits(codec, CS4265_DAC_CTL,
CS4265_DAC_CTL_DIF, (1 << 5)); CS4265_DAC_CTL_DIF, (2 << 4));
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
CS4265_SPDIF_CTL2_DIF, (1 << 7)); CS4265_SPDIF_CTL2_DIF, (2 << 6));
} else { } else {
snd_soc_update_bits(codec, CS4265_DAC_CTL, snd_soc_update_bits(codec, CS4265_DAC_CTL,
CS4265_DAC_CTL_DIF, (3 << 5)); CS4265_DAC_CTL_DIF, (3 << 4));
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
CS4265_SPDIF_CTL2_DIF, (1 << 7)); CS4265_SPDIF_CTL2_DIF, (3 << 6));
} }
break; break;
case SND_SOC_DAIFMT_LEFT_J: case SND_SOC_DAIFMT_LEFT_J:
...@@ -473,7 +473,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -473,7 +473,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
snd_soc_update_bits(codec, CS4265_ADC_CTL, snd_soc_update_bits(codec, CS4265_ADC_CTL,
CS4265_ADC_DIF, 0); CS4265_ADC_DIF, 0);
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
CS4265_SPDIF_CTL2_DIF, (1 << 6)); CS4265_SPDIF_CTL2_DIF, 0);
break; break;
default: default:
......
...@@ -701,6 +701,8 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) ...@@ -701,6 +701,8 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
if (byt == NULL) if (byt == NULL)
return -ENOMEM; return -ENOMEM;
byt->dev = dev;
ipc = &byt->ipc; ipc = &byt->ipc;
ipc->dev = dev; ipc->dev = dev;
ipc->ops.tx_msg = byt_tx_msg; ipc->ops.tx_msg = byt_tx_msg;
......
...@@ -2119,6 +2119,8 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) ...@@ -2119,6 +2119,8 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata)
if (hsw == NULL) if (hsw == NULL)
return -ENOMEM; return -ENOMEM;
hsw->dev = dev;
ipc = &hsw->ipc; ipc = &hsw->ipc;
ipc->dev = dev; ipc->dev = dev;
ipc->ops.tx_msg = hsw_tx_msg; ipc->ops.tx_msg = hsw_tx_msg;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include <sound/soc-topology.h> #include <sound/soc-topology.h>
#include <sound/tlv.h>
/* /*
* We make several passes over the data (since it wont necessarily be ordered) * We make several passes over the data (since it wont necessarily be ordered)
...@@ -534,7 +535,7 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, ...@@ -534,7 +535,7 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
k->put = bops[i].put; k->put = bops[i].put;
if (k->get == NULL && bops[i].id == hdr->ops.get) if (k->get == NULL && bops[i].id == hdr->ops.get)
k->get = bops[i].get; k->get = bops[i].get;
if (k->info == NULL && ops[i].id == hdr->ops.info) if (k->info == NULL && bops[i].id == hdr->ops.info)
k->info = bops[i].info; k->info = bops[i].info;
} }
...@@ -579,28 +580,51 @@ static int soc_tplg_init_kcontrol(struct soc_tplg *tplg, ...@@ -579,28 +580,51 @@ static int soc_tplg_init_kcontrol(struct soc_tplg *tplg,
return 0; return 0;
} }
static int soc_tplg_create_tlv_db_scale(struct soc_tplg *tplg,
struct snd_kcontrol_new *kc, struct snd_soc_tplg_tlv_dbscale *scale)
{
unsigned int item_len = 2 * sizeof(unsigned int);
unsigned int *p;
p = kzalloc(item_len + 2 * sizeof(unsigned int), GFP_KERNEL);
if (!p)
return -ENOMEM;
p[0] = SNDRV_CTL_TLVT_DB_SCALE;
p[1] = item_len;
p[2] = scale->min;
p[3] = (scale->step & TLV_DB_SCALE_MASK)
| (scale->mute ? TLV_DB_SCALE_MUTE : 0);
kc->tlv.p = (void *)p;
return 0;
}
static int soc_tplg_create_tlv(struct soc_tplg *tplg, static int soc_tplg_create_tlv(struct soc_tplg *tplg,
struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_tlv *tplg_tlv) struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_hdr *tc)
{ {
struct snd_ctl_tlv *tlv; struct snd_soc_tplg_ctl_tlv *tplg_tlv;
int size;
if (tplg_tlv->count == 0) if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE))
return 0; return 0;
size = ((tplg_tlv->count + (sizeof(unsigned int) - 1)) & if (tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
~(sizeof(unsigned int) - 1)); kc->tlv.c = snd_soc_bytes_tlv_callback;
tlv = kzalloc(sizeof(*tlv) + size, GFP_KERNEL); } else {
if (tlv == NULL) tplg_tlv = &tc->tlv;
return -ENOMEM; switch (tplg_tlv->type) {
case SNDRV_CTL_TLVT_DB_SCALE:
dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n", return soc_tplg_create_tlv_db_scale(tplg, kc,
tplg_tlv->numid, size); &tplg_tlv->scale);
tlv->numid = tplg_tlv->numid; /* TODO: add support for other TLV types */
tlv->length = size; default:
memcpy(&tlv->tlv[0], tplg_tlv->data, size); dev_dbg(tplg->dev, "Unsupported TLV type %d\n",
kc->tlv.p = (void *)tlv; tplg_tlv->type);
return -EINVAL;
}
}
return 0; return 0;
} }
...@@ -772,7 +796,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count, ...@@ -772,7 +796,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count,
} }
/* create any TLV data */ /* create any TLV data */
soc_tplg_create_tlv(tplg, &kc, &mc->tlv); soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
/* register control here */ /* register control here */
err = soc_tplg_add_kcontrol(tplg, &kc, err = soc_tplg_add_kcontrol(tplg, &kc,
...@@ -1350,6 +1374,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, ...@@ -1350,6 +1374,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
template.reg = w->reg; template.reg = w->reg;
template.shift = w->shift; template.shift = w->shift;
template.mask = w->mask; template.mask = w->mask;
template.subseq = w->subseq;
template.on_val = w->invert ? 0 : 1; template.on_val = w->invert ? 0 : 1;
template.off_val = w->invert ? 1 : 0; template.off_val = w->invert ? 1 : 0;
template.ignore_suspend = w->ignore_suspend; template.ignore_suspend = w->ignore_suspend;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment