sound fixes for 4.20-rc1

A few device-specific fixes: a fix for SPDIF on old Creative PCI
 board, and two additional fixes for the recent changes in FireWire
 audio stack.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAlvcJncOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE88qg/9HvBZ5CZPdfxjMTEZ30GobzDGtJ3y8FIJXFg2
 YL/XRyMysyBt6+Ld9ZmqdrvbjU8zsuBw+YZrid/kDDdBITqetNdc/hvRs0Jh6/qy
 S4J6LEJJxQEUefdJiOYvPAqpXZWp/vzDVBE9BejpanxCQnyrklX9KawFDuifP93P
 +EBt0OyiqpmrU8btoaFJEnOaGEIsBFc60ZHK9ubjzfuH/3FooYiWl+fUAuyddAvZ
 TpBNSMaCmiadUc/InbXesnrUgzuoiPxTBQs9ba1PwH/lnoB4pv2B9IMc5wPzuIrT
 PI9JyoVRIRTaNWGqJsr514njEXd+B6laWhcxFgYrM/DdZqq7J2zFzpvKbnMKXadB
 IW8mtffI1ANYc/WyBRqf6tlRa58lQDejwce/xv605fktmok1XNS+9nDIeU+lfU46
 Ed/NONXGXujOTT00l36/cYrC7MPg0XpQuTtM9ngaEoeKMqKVPFxRFH2h75AXxKxN
 mG5n0aRvkufia7vxEE7S+O+fu8pOAswzBd1EGdfWrzgJDs0K5ifjAjYlXKqbhcMU
 ZjpTpIJPm2LlmFK532DcZoTdXp2Z4J5qMza62uykzYzgeTeBC3bBPbBi5Jm/bsPi
 Lqp0VAmdgRWGdPCqoh89SOPlKZ25UxlFzyddA95UVnKDUAl/ECiltUDVmDdtO8r7
 GXzNKBE=
 =lrUL
 -----END PGP SIGNATURE-----

Merge tag 'sound-fix-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A few device-specific fixes: a fix for SPDIF on old Creative PCI
  board, and two additional fixes for the recent changes in FireWire
  audio stack"

* tag 'sound-fix-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: firewire-lib: fix insufficient PCM rule for period/buffer size
  ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops
  ALSA: dice: fix to wait for releases of all ALSA character devices
This commit is contained in:
Linus Torvalds 2018-11-02 11:02:52 -07:00
commit 54480aa7fa
3 changed files with 12 additions and 51 deletions

View File

@ -146,53 +146,22 @@ static int apply_constraint_to_size(struct snd_pcm_hw_params *params,
struct snd_interval *s = hw_param_interval(params, rule->var); struct snd_interval *s = hw_param_interval(params, rule->var);
const struct snd_interval *r = const struct snd_interval *r =
hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_RATE); hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval t = { struct snd_interval t = {0};
.min = s->min, .max = s->max, .integer = 1, unsigned int step = 0;
};
int i; int i;
for (i = 0; i < CIP_SFC_COUNT; ++i) { for (i = 0; i < CIP_SFC_COUNT; ++i) {
unsigned int rate = amdtp_rate_table[i]; if (snd_interval_test(r, amdtp_rate_table[i]))
unsigned int step = amdtp_syt_intervals[i]; step = max(step, amdtp_syt_intervals[i]);
if (!snd_interval_test(r, rate))
continue;
t.min = roundup(t.min, step);
t.max = rounddown(t.max, step);
} }
if (snd_interval_checkempty(&t)) t.min = roundup(s->min, step);
return -EINVAL; t.max = rounddown(s->max, step);
t.integer = 1;
return snd_interval_refine(s, &t); return snd_interval_refine(s, &t);
} }
static int apply_constraint_to_rate(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{
struct snd_interval *r =
hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
const struct snd_interval *s = hw_param_interval_c(params, rule->deps[0]);
struct snd_interval t = {
.min = UINT_MAX, .max = 0, .integer = 1,
};
int i;
for (i = 0; i < CIP_SFC_COUNT; ++i) {
unsigned int step = amdtp_syt_intervals[i];
unsigned int rate = amdtp_rate_table[i];
if (s->min % step || s->max % step)
continue;
t.min = min(t.min, rate);
t.max = max(t.max, rate);
}
return snd_interval_refine(r, &t);
}
/** /**
* amdtp_stream_add_pcm_hw_constraints - add hw constraints for PCM substream * amdtp_stream_add_pcm_hw_constraints - add hw constraints for PCM substream
* @s: the AMDTP stream, which must be initialized. * @s: the AMDTP stream, which must be initialized.
@ -250,24 +219,16 @@ int amdtp_stream_add_pcm_hw_constraints(struct amdtp_stream *s,
*/ */
err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
apply_constraint_to_size, NULL, apply_constraint_to_size, NULL,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
SNDRV_PCM_HW_PARAM_RATE, -1); SNDRV_PCM_HW_PARAM_RATE, -1);
if (err < 0) if (err < 0)
goto end; goto end;
err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
apply_constraint_to_rate, NULL,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
if (err < 0)
goto end;
err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
apply_constraint_to_size, NULL, apply_constraint_to_size, NULL,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
SNDRV_PCM_HW_PARAM_RATE, -1); SNDRV_PCM_HW_PARAM_RATE, -1);
if (err < 0) if (err < 0)
goto end; goto end;
err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
apply_constraint_to_rate, NULL,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1);
if (err < 0)
goto end;
end: end:
return err; return err;
} }

View File

@ -240,8 +240,8 @@ static void dice_remove(struct fw_unit *unit)
cancel_delayed_work_sync(&dice->dwork); cancel_delayed_work_sync(&dice->dwork);
if (dice->registered) { if (dice->registered) {
/* No need to wait for releasing card object in this context. */ // Block till all of ALSA character devices are released.
snd_card_free_when_closed(dice->card); snd_card_free(dice->card);
} }
mutex_destroy(&dice->mutex); mutex_destroy(&dice->mutex);

View File

@ -582,7 +582,7 @@
#define SPI_PL_BIT_R_R (2<<7) /* right channel = right */ #define SPI_PL_BIT_R_R (2<<7) /* right channel = right */
#define SPI_PL_BIT_R_C (3<<7) /* right channel = (L+R)/2 */ #define SPI_PL_BIT_R_C (3<<7) /* right channel = (L+R)/2 */
#define SPI_IZD_REG 2 #define SPI_IZD_REG 2
#define SPI_IZD_BIT (1<<4) /* infinite zero detect */ #define SPI_IZD_BIT (0<<4) /* infinite zero detect */
#define SPI_FMT_REG 3 #define SPI_FMT_REG 3
#define SPI_FMT_BIT_RJ (0<<0) /* right justified mode */ #define SPI_FMT_BIT_RJ (0<<0) /* right justified mode */