From: Mark Brown Date: Sun, 30 Aug 2015 14:57:34 +0000 (+0100) Subject: Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5086', 'asoc... X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=428157c1e8c9eaf0029430ae82ec0df8578de46b;p=linux-beck.git Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5086', 'asoc/topic/tegra', 'asoc/topic/tlv' and 'asoc/topic/topology' into asoc-next --- 428157c1e8c9eaf0029430ae82ec0df8578de46b diff --cc include/sound/soc-topology.h index 427bc41df3ae,865a141b118b,865a141b118b,865a141b118b,865a141b118b,ea387ed8f98b..086cd7ff6ddc --- a/include/sound/soc-topology.h +++ b/include/sound/soc-topology.h @@@@@@@ -136,13 -136,11 -136,11 -136,11 -136,11 -143,15 +143,17 @@@@@@@ struct snd_soc_tplg_ops int (*manifest)(struct snd_soc_component *, struct snd_soc_tplg_manifest *); ----- /* bespoke kcontrol handlers available for binding */ +++++ /* vendor specific kcontrol handlers available for binding */ const struct snd_soc_tplg_kcontrol_ops *io_ops; int io_ops_count; +++++ +++++ /* vendor specific bytes ext handlers available for binding */ +++++ const struct snd_soc_tplg_bytes_ext_ops *bytes_ext_ops; +++++ int bytes_ext_ops_count; }; +++++#ifdef CONFIG_SND_SOC_TOPOLOGY +++++ /* gets a pointer to data from the firmware block header */ static inline const void *snd_soc_tplg_get_data(struct snd_soc_tplg_hdr *hdr) { diff --cc sound/soc/codecs/max9768.c index bd41128c6f0b,e1c196a41930,e1c196a41930,e1c196a41930,ceae776f42b2,e1c196a41930..5b82e26cd5d1 --- a/sound/soc/codecs/max9768.c +++ b/sound/soc/codecs/max9768.c @@@@@@@ -202,11 -199,38 -199,38 -199,38 -198,38 -199,38 +201,11 @@@@@@@ static int max9768_i2c_probe(struct i2c i2c_set_clientdata(client, max9768); max9768->regmap = devm_regmap_init_i2c(client, &max9768_i2c_regmap_config); ----- if (IS_ERR(max9768->regmap)) { ----- err = PTR_ERR(max9768->regmap); ----- goto err_gpio_free; ----- } - - err = snd_soc_register_codec(&client->dev, &max9768_codec_driver, NULL, 0); - if (err) - goto err_gpio_free; - - return 0; - - err_gpio_free: - if (gpio_is_valid(max9768->shdn_gpio)) - gpio_free(max9768->shdn_gpio); - if (gpio_is_valid(max9768->mute_gpio)) - gpio_free(max9768->mute_gpio); - - return err; - } - - static int max9768_i2c_remove(struct i2c_client *client) - { - struct max9768 *max9768 = i2c_get_clientdata(client); +++++ if (IS_ERR(max9768->regmap)) +++++ return PTR_ERR(max9768->regmap); --- - err = snd_soc_register_codec(&client->dev, &max9768_codec_driver, NULL, 0); --- - if (err) --- - goto err_gpio_free; --- - --- - return 0; --- - --- - err_gpio_free: --- - if (gpio_is_valid(max9768->shdn_gpio)) --- - gpio_free(max9768->shdn_gpio); --- - if (gpio_is_valid(max9768->mute_gpio)) --- - gpio_free(max9768->mute_gpio); --- - --- - return err; --- -} --- - --- -static int max9768_i2c_remove(struct i2c_client *client) --- -{ --- - struct max9768 *max9768 = i2c_get_clientdata(client); --- - ----- snd_soc_unregister_codec(&client->dev); ----- ----- if (gpio_is_valid(max9768->shdn_gpio)) ----- gpio_free(max9768->shdn_gpio); ----- if (gpio_is_valid(max9768->mute_gpio)) ----- gpio_free(max9768->mute_gpio); ----- ----- return 0; +++++ return devm_snd_soc_register_component(&client->dev, +++++ &max9768_component_driver, NULL, 0); } static const struct i2c_device_id max9768_i2c_id[] = { diff --cc sound/soc/codecs/rt5645.c index 1e70736cc970,9ce311e088fc,9ce311e088fc,9ce311e088fc,df27ec12fce6,961bd7e5877e..4972bf3efa91 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@@@@@@ -2896,11 -2913,36 -2913,36 -2913,36 -2912,36 -2913,39 +2895,11 @@@@@@@ static void rt5645_jack_detect_work(str { struct rt5645_priv *rt5645 = container_of(work, struct rt5645_priv, jack_detect_work.work); ----- ----- rt5645_irq_detection(rt5645); -----} ----- -----static irqreturn_t rt5645_irq(int irq, void *data) -----{ ----- struct rt5645_priv *rt5645 = data; ----- ----- queue_delayed_work(system_power_efficient_wq, ----- &rt5645->jack_detect_work, msecs_to_jiffies(250)); ----- ----- return IRQ_HANDLED; -----} ----- -----static int rt5645_button_detect(struct snd_soc_codec *codec) -----{ ----- int btn_type, val; ----- ----- val = snd_soc_read(codec, RT5650_4BTN_IL_CMD1); ----- pr_debug("val=0x%x\n", val); ----- btn_type = val & 0xfff0; ----- snd_soc_write(codec, RT5650_4BTN_IL_CMD1, val); ----- ----- return btn_type; -----} ----- -----static int rt5645_irq_detection(struct rt5645_priv *rt5645) -----{ int val, btn_type, gpio_state = 0, report = 0; ++++ if (!rt5645->codec) - return -EINVAL; +++++ return; ++++ switch (rt5645->pdata.jd_mode) { case 0: /* Not using rt5645 JD */ if (rt5645->gpiod_hp_det) { diff --cc sound/soc/soc-topology.c index f4e92d35316e,d0960683c409,d0960683c409,d0960683c409,d0960683c409,5690b7e7172e..69d01cd925ce --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@@@@@@ -528,18 -527,18 -527,18 -527,18 -527,18 -566,20 +566,20 @@@@@@@ static int soc_tplg_kcontrol_bind_io(st if (k->put && k->get && k->info) return 0; ----- /* none found so try bespoke handlers */ ----- for (i = 0; i < num_bops; i++) { +++++ /* none found so try standard kcontrol handlers */ +++++ ops = io_ops; +++++ num_ops = ARRAY_SIZE(io_ops); +++++ for (i = 0; i < num_ops; i++) { ----- if (k->put == NULL && bops[i].id == hdr->ops.put) ----- k->put = bops[i].put; ----- if (k->get == NULL && bops[i].id == hdr->ops.get) ----- k->get = bops[i].get; - if (k->info == NULL && bops[i].id == hdr->ops.info) - k->info = bops[i].info; +++++ if (k->put == NULL && ops[i].id == hdr->ops.put) +++++ k->put = ops[i].put; +++++ if (k->get == NULL && ops[i].id == hdr->ops.get) +++++ k->get = ops[i].get; + if (k->info == NULL && ops[i].id == hdr->ops.info) ---- k->info = bops[i].info; +++++ k->info = ops[i].info; } ----- /* bespoke handlers found ? */ +++++ /* standard handlers found ? */ if (k->put && k->get && k->info) return 0; @@@@@@@ -580,51 -579,29 -579,29 -579,29 -579,29 -620,49 +620,49 @@@@@@@ static int soc_tplg_init_kcontrol(struc 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, ---- struct snd_kcontrol_new *kc, u32 tlv_size) ++++ struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_hdr *tc) { struct snd_soc_tplg_ctl_tlv *tplg_tlv; ---- struct snd_ctl_tlv *tlv; ---- if (tlv_size == 0) ++++ if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)) return 0; - if (tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { - kc->tlv.c = snd_soc_bytes_tlv_callback; - } else { ---- tplg_tlv = (struct snd_soc_tplg_ctl_tlv *) tplg->pos; ---- tplg->pos += tlv_size; ---- ---- tlv = kzalloc(sizeof(*tlv) + tlv_size, GFP_KERNEL); ---- if (tlv == NULL) ---- return -ENOMEM; ---- ---- dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n", ---- tplg_tlv->numid, tplg_tlv->size); +++++ if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK)) { ++++ tplg_tlv = &tc->tlv; ++++ switch (tplg_tlv->type) { ++++ case SNDRV_CTL_TLVT_DB_SCALE: ++++ return soc_tplg_create_tlv_db_scale(tplg, kc, ++++ &tplg_tlv->scale); ---- tlv->numid = tplg_tlv->numid; ---- tlv->length = tplg_tlv->size; ---- memcpy(tlv->tlv, tplg_tlv + 1, tplg_tlv->size); ---- kc->tlv.p = (void *)tlv; ++++ /* TODO: add support for other TLV types */ ++++ default: ++++ dev_dbg(tplg->dev, "Unsupported TLV type %d\n", ++++ tplg_tlv->type); ++++ return -EINVAL; ++++ } ++++ } return 0; }