提交 f0943013 编写于 作者: L Linus Torvalds

Merge tag 'sound-4.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "The only bulk changes in this request is ABI updates for ASoC topology
  API.  It's a new API that was introduced in 4.2, and we'd like to
  avoid ABI change after the release, so it's taken now.  As there is no
  real in-tree user for this API, it should be fairly safe.

  Other than that, the usual small fixes are found in various drivers:
  ASoC cs4265, rt5645, intel-sst, firewire, oxygen and HD-audio"

* tag 'sound-4.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ASoC: topology: Add private data type and bump ABI version to 3
  ASoC: topology: Add ops support to byte controls UAPI
  ASoC: topology: Update TLV support so we can support more TLV types
  ASoC: topology: add private data to manifest
  ASoC: topology: Add subsequence in topology
  ALSA: hda - one Dell machine needs the headphone white noise fixup
  ALSA: fireworks/firewire-lib: add support for recent firmware quirk
  Revert "ALSA: fireworks: add support for AudioFire2 quirk"
  ASoC: topology: fix typo in soc_tplg_kcontrol_bind_io()
  ALSA: HDA: Dont check return for snd_hdac_chip_readl
  ALSA: HDA: Fix stream assignment for host in decoupled mode
  ASoC: rt5645: Fix lost pin setting for DMIC1
  ALSA: oxygen: Fix logical-not-parentheses warning
  ASoC: Intel: sst_byt: fix initialize 'NULL device *' issue
  ASoC: Intel: haswell: fix initialize 'NULL device *' issue
  ASoC: cs4265: Fix setting dai format for Left/Right Justified
...@@ -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;
......
...@@ -740,8 +740,9 @@ static int handle_in_packet(struct amdtp_stream *s, ...@@ -740,8 +740,9 @@ static int handle_in_packet(struct amdtp_stream *s,
s->data_block_counter != UINT_MAX) s->data_block_counter != UINT_MAX)
data_block_counter = s->data_block_counter; data_block_counter = s->data_block_counter;
if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && data_block_counter == 0) || if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) &&
(s->data_block_counter == UINT_MAX)) { data_block_counter == s->tx_first_dbc) ||
s->data_block_counter == UINT_MAX) {
lost = false; lost = false;
} else if (!(s->flags & CIP_DBC_IS_END_EVENT)) { } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
lost = data_block_counter != s->data_block_counter; lost = data_block_counter != s->data_block_counter;
......
...@@ -157,6 +157,8 @@ struct amdtp_stream { ...@@ -157,6 +157,8 @@ struct amdtp_stream {
/* quirk: fixed interval of dbc between previos/current packets. */ /* quirk: fixed interval of dbc between previos/current packets. */
unsigned int tx_dbc_interval; unsigned int tx_dbc_interval;
/* quirk: indicate the value of dbc field in a first packet. */
unsigned int tx_first_dbc;
bool callbacked; bool callbacked;
wait_queue_head_t callback_wait; wait_queue_head_t callback_wait;
......
...@@ -248,10 +248,16 @@ efw_probe(struct fw_unit *unit, ...@@ -248,10 +248,16 @@ efw_probe(struct fw_unit *unit,
err = get_hardware_info(efw); err = get_hardware_info(efw);
if (err < 0) if (err < 0)
goto error; goto error;
if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2) /* AudioFire8 (since 2009) and AudioFirePre8 */
efw->is_af2 = true;
if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9) if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9)
efw->is_af9 = true; efw->is_af9 = true;
/* These models uses the same firmware. */
if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2 ||
entry->model_id == MODEL_ECHO_AUDIOFIRE_4 ||
entry->model_id == MODEL_ECHO_AUDIOFIRE_9 ||
entry->model_id == MODEL_GIBSON_RIP ||
entry->model_id == MODEL_GIBSON_GOLDTOP)
efw->is_fireworks3 = true;
snd_efw_proc_init(efw); snd_efw_proc_init(efw);
......
...@@ -70,8 +70,8 @@ struct snd_efw { ...@@ -70,8 +70,8 @@ struct snd_efw {
bool resp_addr_changable; bool resp_addr_changable;
/* for quirks */ /* for quirks */
bool is_af2;
bool is_af9; bool is_af9;
bool is_fireworks3;
u32 firmware_version; u32 firmware_version;
unsigned int midi_in_ports; unsigned int midi_in_ports;
......
...@@ -172,9 +172,15 @@ int snd_efw_stream_init_duplex(struct snd_efw *efw) ...@@ -172,9 +172,15 @@ int snd_efw_stream_init_duplex(struct snd_efw *efw)
efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT; efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT;
/* Fireworks reset dbc at bus reset. */ /* Fireworks reset dbc at bus reset. */
efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK; efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK;
/* AudioFire2 starts packets with non-zero dbc. */ /*
if (efw->is_af2) * But Recent firmwares starts packets with non-zero dbc.
efw->tx_stream.flags |= CIP_SKIP_INIT_DBC_CHECK; * Driver version 5.7.6 installs firmware version 5.7.3.
*/
if (efw->is_fireworks3 &&
(efw->firmware_version == 0x5070000 ||
efw->firmware_version == 0x5070300 ||
efw->firmware_version == 0x5080000))
efw->tx_stream.tx_first_dbc = 0x02;
/* AudioFire9 always reports wrong dbs. */ /* AudioFire9 always reports wrong dbs. */
if (efw->is_af9) if (efw->is_af9)
efw->tx_stream.flags |= CIP_WRONG_DBS; efw->tx_stream.flags |= CIP_WRONG_DBS;
......
...@@ -44,16 +44,10 @@ int snd_hdac_ext_bus_parse_capabilities(struct hdac_ext_bus *ebus) ...@@ -44,16 +44,10 @@ int snd_hdac_ext_bus_parse_capabilities(struct hdac_ext_bus *ebus)
offset = snd_hdac_chip_readl(bus, LLCH); offset = snd_hdac_chip_readl(bus, LLCH);
if (offset < 0)
return -EIO;
/* Lets walk the linked capabilities list */ /* Lets walk the linked capabilities list */
do { do {
cur_cap = _snd_hdac_chip_read(l, bus, offset); cur_cap = _snd_hdac_chip_read(l, bus, offset);
if (cur_cap < 0)
return -EIO;
dev_dbg(bus->dev, "Capability version: 0x%x\n", dev_dbg(bus->dev, "Capability version: 0x%x\n",
((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF)); ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF));
......
...@@ -299,7 +299,7 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus, ...@@ -299,7 +299,7 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
if (stream->direction != substream->stream) if (stream->direction != substream->stream)
continue; continue;
if (stream->opened) { if (!stream->opened) {
if (!hstream->decoupled) if (!hstream->decoupled)
snd_hdac_ext_stream_decouple(ebus, hstream, true); snd_hdac_ext_stream_decouple(ebus, hstream, true);
res = hstream; res = hstream;
......
...@@ -5189,6 +5189,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { ...@@ -5189,6 +5189,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
......
...@@ -88,7 +88,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl, ...@@ -88,7 +88,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl,
int changed; int changed;
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
changed = !value->value.integer.value[0] != chip->dac_mute; changed = (!value->value.integer.value[0]) != chip->dac_mute;
if (changed) { if (changed) {
chip->dac_mute = !value->value.integer.value[0]; chip->dac_mute = !value->value.integer.value[0];
chip->model.update_dac_mute(chip); chip->model.update_dac_mute(chip);
......
...@@ -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:
......
...@@ -3341,6 +3341,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3341,6 +3341,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
break; break;
case RT5645_DMIC_DATA_GPIO5: case RT5645_DMIC_DATA_GPIO5:
regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
RT5645_I2S2_DAC_PIN_MASK, RT5645_I2S2_DAC_PIN_GPIO);
regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1,
RT5645_DMIC_1_DP_MASK, RT5645_DMIC_1_DP_GPIO5); RT5645_DMIC_1_DP_MASK, RT5645_DMIC_1_DP_GPIO5);
regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
......
...@@ -1693,6 +1693,10 @@ ...@@ -1693,6 +1693,10 @@
#define RT5645_GP6_PIN_SFT 6 #define RT5645_GP6_PIN_SFT 6
#define RT5645_GP6_PIN_GPIO6 (0x0 << 6) #define RT5645_GP6_PIN_GPIO6 (0x0 << 6)
#define RT5645_GP6_PIN_DMIC2_SDA (0x1 << 6) #define RT5645_GP6_PIN_DMIC2_SDA (0x1 << 6)
#define RT5645_I2S2_DAC_PIN_MASK (0x1 << 4)
#define RT5645_I2S2_DAC_PIN_SFT 4
#define RT5645_I2S2_DAC_PIN_I2S (0x0 << 4)
#define RT5645_I2S2_DAC_PIN_GPIO (0x1 << 4)
#define RT5645_GP8_PIN_MASK (0x1 << 3) #define RT5645_GP8_PIN_MASK (0x1 << 3)
#define RT5645_GP8_PIN_SFT 3 #define RT5645_GP8_PIN_SFT 3
#define RT5645_GP8_PIN_GPIO8 (0x0 << 3) #define RT5645_GP8_PIN_GPIO8 (0x0 << 3)
......
...@@ -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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册