Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+77 -35
+24 -11
include/uapi/sound/asoc.h
··· 77 77 #define SND_SOC_TPLG_NUM_TEXTS 16 78 78 79 79 /* ABI version */ 80 - #define SND_SOC_TPLG_ABI_VERSION 0x2 80 + #define SND_SOC_TPLG_ABI_VERSION 0x3 81 81 82 82 /* Max size of TLV data */ 83 83 #define SND_SOC_TPLG_TLV_SIZE 32 ··· 97 97 #define SND_SOC_TPLG_TYPE_PCM 7 98 98 #define SND_SOC_TPLG_TYPE_MANIFEST 8 99 99 #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 101 102 102 103 /* vendor block IDs - please add new vendor types to end */ 103 104 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 ··· 138 137 /* 139 138 * Kcontrol TLV data. 140 139 */ 140 + struct snd_soc_tplg_tlv_dbscale { 141 + __le32 min; 142 + __le32 step; 143 + __le32 mute; 144 + } __attribute__((packed)); 145 + 141 146 struct snd_soc_tplg_ctl_tlv { 142 - __le32 size; /* in bytes aligned to 4 */ 143 - __le32 numid; /* control element numeric identification */ 144 - __le32 count; /* number of elem in data array */ 145 - __le32 data[SND_SOC_TPLG_TLV_SIZE]; 147 + __le32 size; /* in bytes of this structure */ 148 + __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ 149 + union { 150 + __le32 data[SND_SOC_TPLG_TLV_SIZE]; 151 + struct snd_soc_tplg_tlv_dbscale scale; 152 + }; 146 153 } __attribute__((packed)); 147 154 148 155 /* ··· 164 155 } __attribute__((packed)); 165 156 166 157 /* 167 - * Kcontrol Operations IDs 158 + * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops 159 + * Kcontrol ops need get/put/info. 160 + * Bytes ext ops need get/put. 168 161 */ 169 - struct snd_soc_tplg_kcontrol_ops_id { 162 + struct snd_soc_tplg_io_ops { 170 163 __le32 get; 171 164 __le32 put; 172 165 __le32 info; ··· 182 171 __le32 type; 183 172 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 184 173 __le32 access; 185 - struct snd_soc_tplg_kcontrol_ops_id ops; 186 - __le32 tlv_size; /* non zero means control has TLV data */ 174 + struct snd_soc_tplg_io_ops ops; 175 + struct snd_soc_tplg_ctl_tlv tlv; 187 176 } __attribute__((packed)); 188 177 189 178 /* ··· 249 238 __le32 graph_elems; /* number of graph elements */ 250 239 __le32 dai_elems; /* number of DAI elements */ 251 240 __le32 dai_link_elems; /* number of DAI link elements */ 241 + struct snd_soc_tplg_private priv; 252 242 } __attribute__((packed)); 253 243 254 244 /* ··· 271 259 __le32 invert; 272 260 __le32 num_channels; 273 261 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; 274 - struct snd_soc_tplg_ctl_tlv tlv; 275 262 struct snd_soc_tplg_private priv; 276 263 } __attribute__((packed)); 277 264 ··· 314 303 __le32 mask; 315 304 __le32 base; 316 305 __le32 num_regs; 306 + struct snd_soc_tplg_io_ops ext_ops; 317 307 struct snd_soc_tplg_private priv; 318 308 } __attribute__((packed)); 319 309 ··· 359 347 __le32 reg; /* negative reg = no direct dapm */ 360 348 __le32 shift; /* bits to shift */ 361 349 __le32 mask; /* non-shifted mask */ 350 + __le32 subseq; /* sort within widget type */ 362 351 __u32 invert; /* invert the power bit */ 363 352 __u32 ignore_suspend; /* kept enabled over suspend */ 364 353 __u16 event_flags;
+5 -5
sound/soc/codecs/cs4265.c
··· 457 457 case SND_SOC_DAIFMT_RIGHT_J: 458 458 if (params_width(params) == 16) { 459 459 snd_soc_update_bits(codec, CS4265_DAC_CTL, 460 - CS4265_DAC_CTL_DIF, (1 << 5)); 460 + CS4265_DAC_CTL_DIF, (2 << 4)); 461 461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 462 - CS4265_SPDIF_CTL2_DIF, (1 << 7)); 462 + CS4265_SPDIF_CTL2_DIF, (2 << 6)); 463 463 } else { 464 464 snd_soc_update_bits(codec, CS4265_DAC_CTL, 465 - CS4265_DAC_CTL_DIF, (3 << 5)); 465 + CS4265_DAC_CTL_DIF, (3 << 4)); 466 466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 467 - CS4265_SPDIF_CTL2_DIF, (1 << 7)); 467 + CS4265_SPDIF_CTL2_DIF, (3 << 6)); 468 468 } 469 469 break; 470 470 case SND_SOC_DAIFMT_LEFT_J: ··· 473 473 snd_soc_update_bits(codec, CS4265_ADC_CTL, 474 474 CS4265_ADC_DIF, 0); 475 475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 476 - CS4265_SPDIF_CTL2_DIF, (1 << 6)); 476 + CS4265_SPDIF_CTL2_DIF, 0); 477 477 478 478 break; 479 479 default:
+2
sound/soc/intel/baytrail/sst-baytrail-ipc.c
··· 701 701 if (byt == NULL) 702 702 return -ENOMEM; 703 703 704 + byt->dev = dev; 705 + 704 706 ipc = &byt->ipc; 705 707 ipc->dev = dev; 706 708 ipc->ops.tx_msg = byt_tx_msg;
+2
sound/soc/intel/haswell/sst-haswell-ipc.c
··· 2119 2119 if (hsw == NULL) 2120 2120 return -ENOMEM; 2121 2121 2122 + hsw->dev = dev; 2123 + 2122 2124 ipc = &hsw->ipc; 2123 2125 ipc->dev = dev; 2124 2126 ipc->ops.tx_msg = hsw_tx_msg;
+44 -19
sound/soc/soc-topology.c
··· 33 33 #include <sound/soc.h> 34 34 #include <sound/soc-dapm.h> 35 35 #include <sound/soc-topology.h> 36 + #include <sound/tlv.h> 36 37 37 38 /* 38 39 * We make several passes over the data (since it wont necessarily be ordered) ··· 535 534 k->put = bops[i].put; 536 535 if (k->get == NULL && bops[i].id == hdr->ops.get) 537 536 k->get = bops[i].get; 538 - if (k->info == NULL && ops[i].id == hdr->ops.info) 537 + if (k->info == NULL && bops[i].id == hdr->ops.info) 539 538 k->info = bops[i].info; 540 539 } 541 540 ··· 580 579 return 0; 581 580 } 582 581 583 - static int soc_tplg_create_tlv(struct soc_tplg *tplg, 584 - struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_tlv *tplg_tlv) 582 + 583 + static int soc_tplg_create_tlv_db_scale(struct soc_tplg *tplg, 584 + struct snd_kcontrol_new *kc, struct snd_soc_tplg_tlv_dbscale *scale) 585 585 { 586 - struct snd_ctl_tlv *tlv; 587 - int size; 586 + unsigned int item_len = 2 * sizeof(unsigned int); 587 + unsigned int *p; 588 588 589 - if (tplg_tlv->count == 0) 590 - return 0; 591 - 592 - size = ((tplg_tlv->count + (sizeof(unsigned int) - 1)) & 593 - ~(sizeof(unsigned int) - 1)); 594 - tlv = kzalloc(sizeof(*tlv) + size, GFP_KERNEL); 595 - if (tlv == NULL) 589 + p = kzalloc(item_len + 2 * sizeof(unsigned int), GFP_KERNEL); 590 + if (!p) 596 591 return -ENOMEM; 597 592 598 - dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n", 599 - tplg_tlv->numid, size); 593 + p[0] = SNDRV_CTL_TLVT_DB_SCALE; 594 + p[1] = item_len; 595 + p[2] = scale->min; 596 + p[3] = (scale->step & TLV_DB_SCALE_MASK) 597 + | (scale->mute ? TLV_DB_SCALE_MUTE : 0); 600 598 601 - tlv->numid = tplg_tlv->numid; 602 - tlv->length = size; 603 - memcpy(&tlv->tlv[0], tplg_tlv->data, size); 604 - kc->tlv.p = (void *)tlv; 599 + kc->tlv.p = (void *)p; 600 + return 0; 601 + } 602 + 603 + static int soc_tplg_create_tlv(struct soc_tplg *tplg, 604 + struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_hdr *tc) 605 + { 606 + struct snd_soc_tplg_ctl_tlv *tplg_tlv; 607 + 608 + if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)) 609 + return 0; 610 + 611 + if (tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { 612 + kc->tlv.c = snd_soc_bytes_tlv_callback; 613 + } else { 614 + tplg_tlv = &tc->tlv; 615 + switch (tplg_tlv->type) { 616 + case SNDRV_CTL_TLVT_DB_SCALE: 617 + return soc_tplg_create_tlv_db_scale(tplg, kc, 618 + &tplg_tlv->scale); 619 + 620 + /* TODO: add support for other TLV types */ 621 + default: 622 + dev_dbg(tplg->dev, "Unsupported TLV type %d\n", 623 + tplg_tlv->type); 624 + return -EINVAL; 625 + } 626 + } 605 627 606 628 return 0; 607 629 } ··· 796 772 } 797 773 798 774 /* create any TLV data */ 799 - soc_tplg_create_tlv(tplg, &kc, &mc->tlv); 775 + soc_tplg_create_tlv(tplg, &kc, &mc->hdr); 800 776 801 777 /* register control here */ 802 778 err = soc_tplg_add_kcontrol(tplg, &kc, ··· 1374 1350 template.reg = w->reg; 1375 1351 template.shift = w->shift; 1376 1352 template.mask = w->mask; 1353 + template.subseq = w->subseq; 1377 1354 template.on_val = w->invert ? 0 : 1; 1378 1355 template.off_val = w->invert ? 1 : 0; 1379 1356 template.ignore_suspend = w->ignore_suspend;