History

Merge remote-tracking branches 'asoc/fix/cs4265', 'asoc/fix/intel' and 'asoc/fix/topology' into asoc-linus

Mark Brown committed 11 years ago

Commit d00a9e04 parents 78be55a bffc449 45f503d c7bcf875 files · +76 −34Browse files

Unified · Split

5 files
  1. include/uapi/sound/asoc.h +24 −11
  2. sound/soc/codecs/cs4265.c +5 −5
  3. sound/soc/intel/baytrail/sst-baytrail-ipc.c +2 −0
  4. sound/soc/intel/haswell/sst-haswell-ipc.c +2 −0
  5. sound/soc/soc-topology.c +43 −18
include/uapi/sound/asoc.h+24−11
@@ -77,7 +77,7 @@ · 76 unmodified lines
7777 #define SND_SOC_TPLG_NUM_TEXTS 16
7878
7979 /* ABI version */
80−#define SND_SOC_TPLG_ABI_VERSION 0x2
80+#define SND_SOC_TPLG_ABI_VERSION 0x3
8181
8282 /* Max size of TLV data */
8383 #define SND_SOC_TPLG_TLV_SIZE 32
@@ -97,7 +97,8 @@ · 13 unmodified lines
9797 #define SND_SOC_TPLG_TYPE_PCM 7
9898 #define SND_SOC_TPLG_TYPE_MANIFEST 8
9999 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9
100−#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_CODEC_LINK
100+#define SND_SOC_TPLG_TYPE_PDATA 10
101+#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_PDATA
101102
102103 /* vendor block IDs - please add new vendor types to end */
103104 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
@@ -137,11 +138,19 @@ struct snd_soc_tplg_private { · 33 unmodified lines
137138 /*
138139 * Kcontrol TLV data.
139140 */
141+struct snd_soc_tplg_tlv_dbscale {
142+ __le32 min;
143+ __le32 step;
144+ __le32 mute;
145+} __attribute__((packed));
146+
140147 struct snd_soc_tplg_ctl_tlv {
141− __le32 size; /* in bytes aligned to 4 */
142− __le32 numid; /* control element numeric identification */
143− __le32 count; /* number of elem in data array */
144− __le32 data[SND_SOC_TPLG_TLV_SIZE];
148+ __le32 size; /* in bytes of this structure */
149+ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
150+ union {
151+ __le32 data[SND_SOC_TPLG_TLV_SIZE];
152+ struct snd_soc_tplg_tlv_dbscale scale;
153+ };
145154 } __attribute__((packed));
146155
147156 /*
@@ -155,9 +164,11 @@ struct snd_soc_tplg_channel { · 7 unmodified lines
155164 } __attribute__((packed));
156165
157166 /*
158− * Kcontrol Operations IDs
167+ * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
168+ * Kcontrol ops need get/put/info.
169+ * Bytes ext ops need get/put.
159170 */
160−struct snd_soc_tplg_kcontrol_ops_id {
171+struct snd_soc_tplg_io_ops {
161172 __le32 get;
162173 __le32 put;
163174 __le32 info;
@@ -171,8 +182,8 @@ struct snd_soc_tplg_ctl_hdr { · 7 unmodified lines
171182 __le32 type;
172183 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
173184 __le32 access;
174− struct snd_soc_tplg_kcontrol_ops_id ops;
175− __le32 tlv_size; /* non zero means control has TLV data */
185+ struct snd_soc_tplg_io_ops ops;
186+ struct snd_soc_tplg_ctl_tlv tlv;
176187 } __attribute__((packed));
177188
178189 /*
@@ -238,6 +249,7 @@ struct snd_soc_tplg_manifest { · 59 unmodified lines
238249 __le32 graph_elems; /* number of graph elements */
239250 __le32 dai_elems; /* number of DAI elements */
240251 __le32 dai_link_elems; /* number of DAI link elements */
252+ struct snd_soc_tplg_private priv;
241253 } __attribute__((packed));
242254
243255 /*
@@ -259,7 +271,6 @@ struct snd_soc_tplg_mixer_control { · 15 unmodified lines
259271 __le32 invert;
260272 __le32 num_channels;
261273 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
262− struct snd_soc_tplg_ctl_tlv tlv;
263274 struct snd_soc_tplg_private priv;
264275 } __attribute__((packed));
265276
@@ -303,6 +314,7 @@ struct snd_soc_tplg_bytes_control { · 37 unmodified lines
303314 __le32 mask;
304315 __le32 base;
305316 __le32 num_regs;
317+ struct snd_soc_tplg_io_ops ext_ops;
306318 struct snd_soc_tplg_private priv;
307319 } __attribute__((packed));
308320
@@ -347,6 +359,7 @@ struct snd_soc_tplg_dapm_widget { · 38 unmodified lines
347359 __le32 reg; /* negative reg = no direct dapm */
348360 __le32 shift; /* bits to shift */
349361 __le32 mask; /* non-shifted mask */
362+ __le32 subseq; /* sort within widget type */
350363 __u32 invert; /* invert the power bit */
351364 __u32 ignore_suspend; /* kept enabled over suspend */
352365 __u16 event_flags;
sound/soc/codecs/cs4265.c+5−5
@@ -457,14 +457,14 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, · 456 unmodified lines
457457 case SND_SOC_DAIFMT_RIGHT_J:
458458 if (params_width(params) == 16) {
459459 snd_soc_update_bits(codec, CS4265_DAC_CTL,
460− CS4265_DAC_CTL_DIF, (1 << 5));
460+ CS4265_DAC_CTL_DIF, (2 << 4));
461461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
462− CS4265_SPDIF_CTL2_DIF, (1 << 7));
462+ CS4265_SPDIF_CTL2_DIF, (2 << 6));
463463 } else {
464464 snd_soc_update_bits(codec, CS4265_DAC_CTL,
465− CS4265_DAC_CTL_DIF, (3 << 5));
465+ CS4265_DAC_CTL_DIF, (3 << 4));
466466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
467− CS4265_SPDIF_CTL2_DIF, (1 << 7));
467+ CS4265_SPDIF_CTL2_DIF, (3 << 6));
468468 }
469469 break;
470470 case SND_SOC_DAIFMT_LEFT_J:
@@ -473,7 +473,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, · 2 unmodified lines
473473 snd_soc_update_bits(codec, CS4265_ADC_CTL,
474474 CS4265_ADC_DIF, 0);
475475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
476− CS4265_SPDIF_CTL2_DIF, (1 << 6));
476+ CS4265_SPDIF_CTL2_DIF, 0);
477477
478478 break;
479479 default:
sound/soc/intel/baytrail/sst-baytrail-ipc.c+2−0
@@ -701,6 +701,8 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) · 700 unmodified lines
701701 if (byt == NULL)
702702 return -ENOMEM;
703703
704+ byt->dev = dev;
705+
704706 ipc = &byt->ipc;
705707 ipc->dev = dev;
706708 ipc->ops.tx_msg = byt_tx_msg;
sound/soc/intel/haswell/sst-haswell-ipc.c+2−0
@@ -2119,6 +2119,8 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) · 2118 unmodified lines
21192119 if (hsw == NULL)
21202120 return -ENOMEM;
21212121
2122+ hsw->dev = dev;
2123+
21222124 ipc = &hsw->ipc;
21232125 ipc->dev = dev;
21242126 ipc->ops.tx_msg = hsw_tx_msg;
sound/soc/soc-topology.c+43−18
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <sound/soc.h>
3434 #include <sound/soc-dapm.h>
3535 #include <sound/soc-topology.h>
36+#include <sound/tlv.h>
3637
3738 /*
3839 * 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, · 495 unmodified lines
534535 k->put = bops[i].put;
535536 if (k->get == NULL && bops[i].id == hdr->ops.get)
536537 k->get = bops[i].get;
537− if (k->info == NULL && ops[i].id == hdr->ops.info)
538+ if (k->info == NULL && bops[i].id == hdr->ops.info)
538539 k->info = bops[i].info;
539540 }
540541
@@ -579,28 +580,51 @@ static int soc_tplg_init_kcontrol(struct soc_tplg *tplg, · 38 unmodified lines
579580 return 0;
580581 }
581582
583+
584+static int soc_tplg_create_tlv_db_scale(struct soc_tplg *tplg,
585+ struct snd_kcontrol_new *kc, struct snd_soc_tplg_tlv_dbscale *scale)
586+{
587+ unsigned int item_len = 2 * sizeof(unsigned int);
588+ unsigned int *p;
589+
590+ p = kzalloc(item_len + 2 * sizeof(unsigned int), GFP_KERNEL);
591+ if (!p)
592+ return -ENOMEM;
593+
594+ p[0] = SNDRV_CTL_TLVT_DB_SCALE;
595+ p[1] = item_len;
596+ p[2] = scale->min;
597+ p[3] = (scale->step & TLV_DB_SCALE_MASK)
598+ | (scale->mute ? TLV_DB_SCALE_MUTE : 0);
599+
600+ kc->tlv.p = (void *)p;
601+ return 0;
602+}
603+
582604 static int soc_tplg_create_tlv(struct soc_tplg *tplg,
583− struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_tlv *tplg_tlv)
605+ struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_hdr *tc)
584606 {
585− struct snd_ctl_tlv *tlv;
586− int size;
607+ struct snd_soc_tplg_ctl_tlv *tplg_tlv;
587608
588− if (tplg_tlv->count == 0)
609+ if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE))
589610 return 0;
590611
591− size = ((tplg_tlv->count + (sizeof(unsigned int) - 1)) &
592− ~(sizeof(unsigned int) - 1));
593− tlv = kzalloc(sizeof(*tlv) + size, GFP_KERNEL);
594− if (tlv == NULL)
595− return -ENOMEM;
596−
597− dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n",
598− tplg_tlv->numid, size);
612+ if (tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
613+ kc->tlv.c = snd_soc_bytes_tlv_callback;
614+ } else {
615+ tplg_tlv = &tc->tlv;
616+ switch (tplg_tlv->type) {
617+ case SNDRV_CTL_TLVT_DB_SCALE:
618+ return soc_tplg_create_tlv_db_scale(tplg, kc,
619+ &tplg_tlv->scale);
599620
600− tlv->numid = tplg_tlv->numid;
601− tlv->length = size;
602− memcpy(&tlv->tlv[0], tplg_tlv->data, size);
603− kc->tlv.p = (void *)tlv;
621+ /* TODO: add support for other TLV types */
622+ default:
623+ dev_dbg(tplg->dev, "Unsupported TLV type %d\n",
624+ tplg_tlv->type);
625+ return -EINVAL;
626+ }
627+ }
604628
605629 return 0;
606630 }
@@ -772,7 +796,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count, · 165 unmodified lines
772796 }
773797
774798 /* create any TLV data */
775− soc_tplg_create_tlv(tplg, &kc, &mc->tlv);
799+ soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
776800
777801 /* register control here */
778802 err = soc_tplg_add_kcontrol(tplg, &kc,
@@ -1350,6 +1374,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, · 571 unmodified lines
13501374 template.reg = w->reg;
13511375 template.shift = w->shift;
13521376 template.mask = w->mask;
1377+ template.subseq = w->subseq;
13531378 template.on_val = w->invert ? 0 : 1;
13541379 template.off_val = w->invert ? 1 : 0;
13551380 template.ignore_suspend = w->ignore_suspend;