dac33 163 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 164 sound/soc/codecs/tlv320dac33.c u8 *cache = dac33->reg_cache; dac33 174 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 175 sound/soc/codecs/tlv320dac33.c u8 *cache = dac33->reg_cache; dac33 185 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 191 sound/soc/codecs/tlv320dac33.c if (dac33->chip_power) { dac33 192 sound/soc/codecs/tlv320dac33.c val = i2c_smbus_read_byte_data(dac33->i2c, value[0]); dac33 211 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 224 sound/soc/codecs/tlv320dac33.c if (dac33->chip_power) { dac33 225 sound/soc/codecs/tlv320dac33.c ret = i2c_master_send(dac33->i2c, data, 2); dac33 238 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 241 sound/soc/codecs/tlv320dac33.c mutex_lock(&dac33->mutex); dac33 243 sound/soc/codecs/tlv320dac33.c mutex_unlock(&dac33->mutex); dac33 252 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 269 sound/soc/codecs/tlv320dac33.c if (dac33->chip_power) { dac33 272 sound/soc/codecs/tlv320dac33.c ret = i2c_master_send(dac33->i2c, data, 3); dac33 284 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 286 sound/soc/codecs/tlv320dac33.c if (unlikely(!dac33->chip_power)) dac33 365 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 368 sound/soc/codecs/tlv320dac33.c mutex_lock(&dac33->mutex); dac33 371 sound/soc/codecs/tlv320dac33.c if (unlikely(power == dac33->chip_power)) { dac33 378 sound/soc/codecs/tlv320dac33.c ret = regulator_bulk_enable(ARRAY_SIZE(dac33->supplies), dac33 379 sound/soc/codecs/tlv320dac33.c dac33->supplies); dac33 386 sound/soc/codecs/tlv320dac33.c if (dac33->power_gpio >= 0) dac33 387 sound/soc/codecs/tlv320dac33.c gpio_set_value(dac33->power_gpio, 1); dac33 389 sound/soc/codecs/tlv320dac33.c dac33->chip_power = 1; dac33 392 sound/soc/codecs/tlv320dac33.c if (dac33->power_gpio >= 0) dac33 393 sound/soc/codecs/tlv320dac33.c gpio_set_value(dac33->power_gpio, 0); dac33 395 sound/soc/codecs/tlv320dac33.c ret = regulator_bulk_disable(ARRAY_SIZE(dac33->supplies), dac33 396 sound/soc/codecs/tlv320dac33.c dac33->supplies); dac33 403 sound/soc/codecs/tlv320dac33.c dac33->chip_power = 0; dac33 407 sound/soc/codecs/tlv320dac33.c mutex_unlock(&dac33->mutex); dac33 415 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 419 sound/soc/codecs/tlv320dac33.c if (likely(dac33->substream)) { dac33 420 sound/soc/codecs/tlv320dac33.c dac33_calculate_times(dac33->substream, component); dac33 421 sound/soc/codecs/tlv320dac33.c dac33_prepare_chip(dac33->substream, component); dac33 435 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 437 sound/soc/codecs/tlv320dac33.c ucontrol->value.enumerated.item[0] = dac33->fifo_mode; dac33 446 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 449 sound/soc/codecs/tlv320dac33.c if (dac33->fifo_mode == ucontrol->value.enumerated.item[0]) dac33 458 sound/soc/codecs/tlv320dac33.c dac33->fifo_mode = ucontrol->value.enumerated.item[0]; dac33 645 sound/soc/codecs/tlv320dac33.c static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) dac33 647 sound/soc/codecs/tlv320dac33.c struct snd_soc_component *component = dac33->component; dac33 651 sound/soc/codecs/tlv320dac33.c switch (dac33->fifo_mode) { dac33 654 sound/soc/codecs/tlv320dac33.c DAC33_THRREG(dac33->nsample)); dac33 657 sound/soc/codecs/tlv320dac33.c spin_lock_irqsave(&dac33->lock, flags); dac33 658 sound/soc/codecs/tlv320dac33.c dac33->t_stamp2 = ktime_to_us(ktime_get()); dac33 659 sound/soc/codecs/tlv320dac33.c dac33->t_stamp1 = dac33->t_stamp2; dac33 660 sound/soc/codecs/tlv320dac33.c spin_unlock_irqrestore(&dac33->lock, flags); dac33 663 sound/soc/codecs/tlv320dac33.c DAC33_THRREG(dac33->alarm_threshold)); dac33 665 sound/soc/codecs/tlv320dac33.c delay = SAMPLES_TO_US(dac33->burst_rate, dac33 666 sound/soc/codecs/tlv320dac33.c dac33->alarm_threshold) + 1000; dac33 672 sound/soc/codecs/tlv320dac33.c spin_lock_irqsave(&dac33->lock, flags); dac33 673 sound/soc/codecs/tlv320dac33.c dac33->t_stamp1 = ktime_to_us(ktime_get()); dac33 675 sound/soc/codecs/tlv320dac33.c dac33->t_stamp1 -= dac33->mode7_us_to_lthr; dac33 676 sound/soc/codecs/tlv320dac33.c spin_unlock_irqrestore(&dac33->lock, flags); dac33 686 sound/soc/codecs/tlv320dac33.c dac33->fifo_mode); dac33 691 sound/soc/codecs/tlv320dac33.c static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33) dac33 693 sound/soc/codecs/tlv320dac33.c struct snd_soc_component *component = dac33->component; dac33 696 sound/soc/codecs/tlv320dac33.c switch (dac33->fifo_mode) { dac33 699 sound/soc/codecs/tlv320dac33.c spin_lock_irqsave(&dac33->lock, flags); dac33 700 sound/soc/codecs/tlv320dac33.c dac33->t_stamp2 = ktime_to_us(ktime_get()); dac33 701 sound/soc/codecs/tlv320dac33.c spin_unlock_irqrestore(&dac33->lock, flags); dac33 704 sound/soc/codecs/tlv320dac33.c DAC33_THRREG(dac33->nsample)); dac33 711 sound/soc/codecs/tlv320dac33.c dac33->fifo_mode); dac33 719 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33; dac33 722 sound/soc/codecs/tlv320dac33.c dac33 = container_of(work, struct tlv320dac33_priv, work); dac33 723 sound/soc/codecs/tlv320dac33.c component = dac33->component; dac33 725 sound/soc/codecs/tlv320dac33.c mutex_lock(&dac33->mutex); dac33 726 sound/soc/codecs/tlv320dac33.c switch (dac33->state) { dac33 728 sound/soc/codecs/tlv320dac33.c dac33->state = DAC33_PLAYBACK; dac33 729 sound/soc/codecs/tlv320dac33.c dac33_prefill_handler(dac33); dac33 732 sound/soc/codecs/tlv320dac33.c dac33_playback_handler(dac33); dac33 737 sound/soc/codecs/tlv320dac33.c dac33->state = DAC33_IDLE; dac33 747 sound/soc/codecs/tlv320dac33.c mutex_unlock(&dac33->mutex); dac33 753 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 756 sound/soc/codecs/tlv320dac33.c spin_lock_irqsave(&dac33->lock, flags); dac33 757 sound/soc/codecs/tlv320dac33.c dac33->t_stamp1 = ktime_to_us(ktime_get()); dac33 758 sound/soc/codecs/tlv320dac33.c spin_unlock_irqrestore(&dac33->lock, flags); dac33 761 sound/soc/codecs/tlv320dac33.c if (dac33->fifo_mode != DAC33_FIFO_MODE7) dac33 762 sound/soc/codecs/tlv320dac33.c schedule_work(&dac33->work); dac33 785 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 788 sound/soc/codecs/tlv320dac33.c dac33->substream = substream; dac33 797 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 799 sound/soc/codecs/tlv320dac33.c dac33->substream = NULL; dac33 809 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 824 sound/soc/codecs/tlv320dac33.c dac33->fifo_size = DAC33_FIFO_SIZE_16BIT; dac33 825 sound/soc/codecs/tlv320dac33.c dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 32); dac33 828 sound/soc/codecs/tlv320dac33.c dac33->fifo_size = DAC33_FIFO_SIZE_24BIT; dac33 829 sound/soc/codecs/tlv320dac33.c dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 64); dac33 853 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 860 sound/soc/codecs/tlv320dac33.c oscset = CALC_OSCSET(substream->runtime->rate, dac33->refclk); dac33 862 sound/soc/codecs/tlv320dac33.c dac33->refclk); dac33 892 sound/soc/codecs/tlv320dac33.c mutex_lock(&dac33->mutex); dac33 894 sound/soc/codecs/tlv320dac33.c if (!dac33->chip_power) { dac33 899 sound/soc/codecs/tlv320dac33.c mutex_unlock(&dac33->mutex); dac33 928 sound/soc/codecs/tlv320dac33.c if (dac33->fifo_mode) { dac33 947 sound/soc/codecs/tlv320dac33.c switch (dac33->fifo_mode) { dac33 963 sound/soc/codecs/tlv320dac33.c switch (dac33->fifo_mode) { dac33 973 sound/soc/codecs/tlv320dac33.c if (dac33->keep_bclk) dac33 987 sound/soc/codecs/tlv320dac33.c if (dac33->keep_bclk) dac33 1016 sound/soc/codecs/tlv320dac33.c if (dac33->fifo_mode) dac33 1018 sound/soc/codecs/tlv320dac33.c dac33->burst_bclkdiv); dac33 1025 sound/soc/codecs/tlv320dac33.c switch (dac33->fifo_mode) { dac33 1028 sound/soc/codecs/tlv320dac33.c DAC33_THRREG(dac33->alarm_threshold)); dac33 1035 sound/soc/codecs/tlv320dac33.c dac33_write16(component, DAC33_UTHR_MSB, DAC33_THRREG(dac33->uthr)); dac33 1043 sound/soc/codecs/tlv320dac33.c mutex_unlock(&dac33->mutex); dac33 1051 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 1057 sound/soc/codecs/tlv320dac33.c if (!dac33->fifo_mode) dac33 1060 sound/soc/codecs/tlv320dac33.c switch (dac33->fifo_mode) { dac33 1063 sound/soc/codecs/tlv320dac33.c dac33->alarm_threshold = US_TO_SAMPLES(rate, dac33 1064 sound/soc/codecs/tlv320dac33.c dac33->mode1_latency); dac33 1065 sound/soc/codecs/tlv320dac33.c nsample_limit = dac33->fifo_size - dac33->alarm_threshold; dac33 1067 sound/soc/codecs/tlv320dac33.c if (period_size <= dac33->alarm_threshold) dac33 1072 sound/soc/codecs/tlv320dac33.c dac33->nsample = period_size * dac33 1073 sound/soc/codecs/tlv320dac33.c ((dac33->alarm_threshold / period_size) + dac33 1074 sound/soc/codecs/tlv320dac33.c (dac33->alarm_threshold % period_size ? dac33 1077 sound/soc/codecs/tlv320dac33.c dac33->nsample = nsample_limit; dac33 1079 sound/soc/codecs/tlv320dac33.c dac33->nsample = period_size; dac33 1081 sound/soc/codecs/tlv320dac33.c dac33->mode1_us_burst = SAMPLES_TO_US(dac33->burst_rate, dac33 1082 sound/soc/codecs/tlv320dac33.c dac33->nsample); dac33 1083 sound/soc/codecs/tlv320dac33.c dac33->t_stamp1 = 0; dac33 1084 sound/soc/codecs/tlv320dac33.c dac33->t_stamp2 = 0; dac33 1087 sound/soc/codecs/tlv320dac33.c dac33->uthr = UTHR_FROM_PERIOD_SIZE(period_size, rate, dac33 1088 sound/soc/codecs/tlv320dac33.c dac33->burst_rate) + 9; dac33 1089 sound/soc/codecs/tlv320dac33.c if (dac33->uthr > (dac33->fifo_size - DAC33_MODE7_MARGIN)) dac33 1090 sound/soc/codecs/tlv320dac33.c dac33->uthr = dac33->fifo_size - DAC33_MODE7_MARGIN; dac33 1091 sound/soc/codecs/tlv320dac33.c if (dac33->uthr < (DAC33_MODE7_MARGIN + 10)) dac33 1092 sound/soc/codecs/tlv320dac33.c dac33->uthr = (DAC33_MODE7_MARGIN + 10); dac33 1094 sound/soc/codecs/tlv320dac33.c dac33->mode7_us_to_lthr = dac33 1096 sound/soc/codecs/tlv320dac33.c dac33->uthr - DAC33_MODE7_MARGIN + 1); dac33 1097 sound/soc/codecs/tlv320dac33.c dac33->t_stamp1 = 0; dac33 1109 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 1116 sound/soc/codecs/tlv320dac33.c if (dac33->fifo_mode) { dac33 1117 sound/soc/codecs/tlv320dac33.c dac33->state = DAC33_PREFILL; dac33 1118 sound/soc/codecs/tlv320dac33.c schedule_work(&dac33->work); dac33 1124 sound/soc/codecs/tlv320dac33.c if (dac33->fifo_mode) { dac33 1125 sound/soc/codecs/tlv320dac33.c dac33->state = DAC33_FLUSH; dac33 1126 sound/soc/codecs/tlv320dac33.c schedule_work(&dac33->work); dac33 1141 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 1148 sound/soc/codecs/tlv320dac33.c switch (dac33->fifo_mode) { dac33 1152 sound/soc/codecs/tlv320dac33.c spin_lock_irqsave(&dac33->lock, flags); dac33 1153 sound/soc/codecs/tlv320dac33.c t0 = dac33->t_stamp1; dac33 1154 sound/soc/codecs/tlv320dac33.c t1 = dac33->t_stamp2; dac33 1155 sound/soc/codecs/tlv320dac33.c spin_unlock_irqrestore(&dac33->lock, flags); dac33 1172 sound/soc/codecs/tlv320dac33.c if (likely(dac33->alarm_threshold > samples_out)) dac33 1173 sound/soc/codecs/tlv320dac33.c delay = dac33->alarm_threshold - samples_out; dac33 1176 sound/soc/codecs/tlv320dac33.c } else if ((t_now - t1) <= dac33->mode1_us_burst) { dac33 1188 sound/soc/codecs/tlv320dac33.c dac33->burst_rate, dac33 1191 sound/soc/codecs/tlv320dac33.c samples = dac33->alarm_threshold; dac33 1208 sound/soc/codecs/tlv320dac33.c samples_in = dac33->nsample; dac33 1209 sound/soc/codecs/tlv320dac33.c samples = dac33->alarm_threshold; dac33 1213 sound/soc/codecs/tlv320dac33.c delay = samples > dac33->fifo_size ? dac33 1214 sound/soc/codecs/tlv320dac33.c dac33->fifo_size : samples; dac33 1220 sound/soc/codecs/tlv320dac33.c spin_lock_irqsave(&dac33->lock, flags); dac33 1221 sound/soc/codecs/tlv320dac33.c t0 = dac33->t_stamp1; dac33 1222 sound/soc/codecs/tlv320dac33.c uthr = dac33->uthr; dac33 1223 sound/soc/codecs/tlv320dac33.c spin_unlock_irqrestore(&dac33->lock, flags); dac33 1240 sound/soc/codecs/tlv320dac33.c if (time_delta <= dac33->mode7_us_to_lthr) { dac33 1258 sound/soc/codecs/tlv320dac33.c time_delta = time_delta - dac33->mode7_us_to_lthr; dac33 1264 sound/soc/codecs/tlv320dac33.c dac33->burst_rate, dac33 1274 sound/soc/codecs/tlv320dac33.c dac33->fifo_mode); dac33 1285 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 1303 sound/soc/codecs/tlv320dac33.c dac33->refclk = freq; dac33 1315 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 1328 sound/soc/codecs/tlv320dac33.c if (dac33->fifo_mode) { dac33 1368 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 1371 sound/soc/codecs/tlv320dac33.c dac33->component = component; dac33 1389 sound/soc/codecs/tlv320dac33.c if (dac33->irq >= 0) { dac33 1390 sound/soc/codecs/tlv320dac33.c ret = request_irq(dac33->irq, dac33_interrupt_handler, dac33 1395 sound/soc/codecs/tlv320dac33.c dac33->irq, ret); dac33 1396 sound/soc/codecs/tlv320dac33.c dac33->irq = -1; dac33 1398 sound/soc/codecs/tlv320dac33.c if (dac33->irq != -1) { dac33 1399 sound/soc/codecs/tlv320dac33.c INIT_WORK(&dac33->work, dac33_work); dac33 1404 sound/soc/codecs/tlv320dac33.c if (dac33->irq >= 0) dac33 1414 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = snd_soc_component_get_drvdata(component); dac33 1416 sound/soc/codecs/tlv320dac33.c if (dac33->irq >= 0) { dac33 1417 sound/soc/codecs/tlv320dac33.c free_irq(dac33->irq, dac33->component); dac33 1418 sound/soc/codecs/tlv320dac33.c flush_work(&dac33->work); dac33 1470 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33; dac33 1479 sound/soc/codecs/tlv320dac33.c dac33 = devm_kzalloc(&client->dev, sizeof(struct tlv320dac33_priv), dac33 1481 sound/soc/codecs/tlv320dac33.c if (dac33 == NULL) dac33 1484 sound/soc/codecs/tlv320dac33.c dac33->reg_cache = devm_kmemdup(&client->dev, dac33 1488 sound/soc/codecs/tlv320dac33.c if (!dac33->reg_cache) dac33 1491 sound/soc/codecs/tlv320dac33.c dac33->i2c = client; dac33 1492 sound/soc/codecs/tlv320dac33.c mutex_init(&dac33->mutex); dac33 1493 sound/soc/codecs/tlv320dac33.c spin_lock_init(&dac33->lock); dac33 1495 sound/soc/codecs/tlv320dac33.c i2c_set_clientdata(client, dac33); dac33 1497 sound/soc/codecs/tlv320dac33.c dac33->power_gpio = pdata->power_gpio; dac33 1498 sound/soc/codecs/tlv320dac33.c dac33->burst_bclkdiv = pdata->burst_bclkdiv; dac33 1499 sound/soc/codecs/tlv320dac33.c dac33->keep_bclk = pdata->keep_bclk; dac33 1500 sound/soc/codecs/tlv320dac33.c dac33->mode1_latency = pdata->mode1_latency; dac33 1501 sound/soc/codecs/tlv320dac33.c if (!dac33->mode1_latency) dac33 1502 sound/soc/codecs/tlv320dac33.c dac33->mode1_latency = 10000; /* 10ms */ dac33 1503 sound/soc/codecs/tlv320dac33.c dac33->irq = client->irq; dac33 1505 sound/soc/codecs/tlv320dac33.c dac33->fifo_mode = DAC33_FIFO_BYPASS; dac33 1508 sound/soc/codecs/tlv320dac33.c if (dac33->power_gpio >= 0) { dac33 1509 sound/soc/codecs/tlv320dac33.c ret = gpio_request(dac33->power_gpio, "tlv320dac33 reset"); dac33 1513 sound/soc/codecs/tlv320dac33.c dac33->power_gpio); dac33 1516 sound/soc/codecs/tlv320dac33.c gpio_direction_output(dac33->power_gpio, 0); dac33 1519 sound/soc/codecs/tlv320dac33.c for (i = 0; i < ARRAY_SIZE(dac33->supplies); i++) dac33 1520 sound/soc/codecs/tlv320dac33.c dac33->supplies[i].supply = dac33_supply_names[i]; dac33 1522 sound/soc/codecs/tlv320dac33.c ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(dac33->supplies), dac33 1523 sound/soc/codecs/tlv320dac33.c dac33->supplies); dac33 1537 sound/soc/codecs/tlv320dac33.c if (dac33->power_gpio >= 0) dac33 1538 sound/soc/codecs/tlv320dac33.c gpio_free(dac33->power_gpio); dac33 1545 sound/soc/codecs/tlv320dac33.c struct tlv320dac33_priv *dac33 = i2c_get_clientdata(client); dac33 1547 sound/soc/codecs/tlv320dac33.c if (unlikely(dac33->chip_power)) dac33 1548 sound/soc/codecs/tlv320dac33.c dac33_hard_power(dac33->component, 0); dac33 1550 sound/soc/codecs/tlv320dac33.c if (dac33->power_gpio >= 0) dac33 1551 sound/soc/codecs/tlv320dac33.c gpio_free(dac33->power_gpio);