mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 12:56:31 +01:00
topology: nhlt: Intel: Improve all error prints
Many error prints had obsolete function name written in them, use __func__ everywhere and add problematic value to the print if its available. Closes: https://github.com/alsa-project/alsa-utils/pull/254 Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
19a75d0ebc
commit
906a56f9ff
1 changed files with 30 additions and 23 deletions
|
@ -159,28 +159,33 @@ static void find_modes(struct intel_dmic_params *dmic, struct dmic_calc_decim_mo
|
||||||
/* Check for sane pdm clock, min 100 kHz, max ioclk/2 */
|
/* Check for sane pdm clock, min 100 kHz, max ioclk/2 */
|
||||||
if (dmic->dmic_prm[di].pdmclk_max < DMIC_HW_PDM_CLK_MIN ||
|
if (dmic->dmic_prm[di].pdmclk_max < DMIC_HW_PDM_CLK_MIN ||
|
||||||
dmic->dmic_prm[di].pdmclk_max > dmic->dmic_prm[di].io_clk / 2) {
|
dmic->dmic_prm[di].pdmclk_max > dmic->dmic_prm[di].io_clk / 2) {
|
||||||
fprintf(stderr, "find_modes(): pdm clock max not in range\n");
|
fprintf(stderr, "%s: pdm clock max %d not in range\n", __func__,
|
||||||
|
dmic->dmic_prm[di].pdmclk_max);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dmic->dmic_prm[di].pdmclk_min < DMIC_HW_PDM_CLK_MIN ||
|
if (dmic->dmic_prm[di].pdmclk_min < DMIC_HW_PDM_CLK_MIN ||
|
||||||
dmic->dmic_prm[di].pdmclk_min > dmic->dmic_prm[di].pdmclk_max) {
|
dmic->dmic_prm[di].pdmclk_min > dmic->dmic_prm[di].pdmclk_max) {
|
||||||
fprintf(stderr, "find_modes(): pdm clock min not in range\n");
|
fprintf(stderr, "%s: pdm clock min %d not in range\n", __func__,
|
||||||
|
dmic->dmic_prm[di].pdmclk_min);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for sane duty cycle */
|
/* Check for sane duty cycle */
|
||||||
if (dmic->dmic_prm[di].duty_min > dmic->dmic_prm[di].duty_max) {
|
if (dmic->dmic_prm[di].duty_min > dmic->dmic_prm[di].duty_max) {
|
||||||
fprintf(stderr, "find_modes(): duty cycle min > max\n");
|
fprintf(stderr, "%s: duty cycle min > max: %d > %d\n", __func__,
|
||||||
|
dmic->dmic_prm[di].duty_min, dmic->dmic_prm[di].duty_max);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dmic->dmic_prm[di].duty_min < DMIC_HW_DUTY_MIN ||
|
if (dmic->dmic_prm[di].duty_min < DMIC_HW_DUTY_MIN ||
|
||||||
dmic->dmic_prm[di].duty_min > DMIC_HW_DUTY_MAX) {
|
dmic->dmic_prm[di].duty_min > DMIC_HW_DUTY_MAX) {
|
||||||
fprintf(stderr, "find_modes(): pdm clock min not in range\n");
|
fprintf(stderr, "%s: pdm clock min %d not in range\n", __func__,
|
||||||
|
dmic->dmic_prm[di].duty_min);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dmic->dmic_prm[di].duty_max < DMIC_HW_DUTY_MIN ||
|
if (dmic->dmic_prm[di].duty_max < DMIC_HW_DUTY_MIN ||
|
||||||
dmic->dmic_prm[di].duty_max > DMIC_HW_DUTY_MAX) {
|
dmic->dmic_prm[di].duty_max > DMIC_HW_DUTY_MAX) {
|
||||||
fprintf(stderr, "find_modes(): pdm clock max not in range\n");
|
fprintf(stderr, "%s: pdm clock max %d not in range\n", __func__,
|
||||||
|
dmic->dmic_prm[di].duty_max);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +433,7 @@ static int select_mode(struct intel_dmic_params *dmic, struct dmic_calc_configur
|
||||||
* candidates should be sufficient.
|
* candidates should be sufficient.
|
||||||
*/
|
*/
|
||||||
if (modes->num_of_modes == 0) {
|
if (modes->num_of_modes == 0) {
|
||||||
fprintf(stderr, "select_mode(): no modes available\n");
|
fprintf(stderr, "%s: no modes available\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +456,7 @@ static int select_mode(struct intel_dmic_params *dmic, struct dmic_calc_configur
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
fprintf(stderr, "select_mode(): No filter for decimation found\n");
|
fprintf(stderr, "%s: No filter for decimation found\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
n = idx[found - 1]; /* Option with highest clock divisor and lowest mic clock rate */
|
n = idx[found - 1]; /* Option with highest clock divisor and lowest mic clock rate */
|
||||||
|
@ -468,8 +473,8 @@ static int select_mode(struct intel_dmic_params *dmic, struct dmic_calc_configur
|
||||||
if (cfg->mfir_a > 0) {
|
if (cfg->mfir_a > 0) {
|
||||||
cfg->fir_a = get_fir(dmic, cfg, cfg->mfir_a);
|
cfg->fir_a = get_fir(dmic, cfg, cfg->mfir_a);
|
||||||
if (!cfg->fir_a) {
|
if (!cfg->fir_a) {
|
||||||
fprintf(stderr, "select_mode(): can't find FIR coefficients, mfir_a = %d\n",
|
fprintf(stderr, "%s: can't find FIR coefficients, mfir_a = %d\n",
|
||||||
cfg->mfir_a);
|
__func__, cfg->mfir_a);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,8 +482,8 @@ static int select_mode(struct intel_dmic_params *dmic, struct dmic_calc_configur
|
||||||
if (cfg->mfir_b > 0) {
|
if (cfg->mfir_b > 0) {
|
||||||
cfg->fir_b = get_fir(dmic, cfg, cfg->mfir_b);
|
cfg->fir_b = get_fir(dmic, cfg, cfg->mfir_b);
|
||||||
if (!cfg->fir_b) {
|
if (!cfg->fir_b) {
|
||||||
fprintf(stderr, "select_mode(): can't find FIR coefficients, mfir_b = %d\n",
|
fprintf(stderr, "%s: can't find FIR coefficients, mfir_b = %d\n",
|
||||||
cfg->mfir_b);
|
__func__, cfg->mfir_b);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -490,7 +495,7 @@ static int select_mode(struct intel_dmic_params *dmic, struct dmic_calc_configur
|
||||||
g_cic = mcic * mcic * mcic * mcic * mcic;
|
g_cic = mcic * mcic * mcic * mcic * mcic;
|
||||||
if (g_cic < 0) {
|
if (g_cic < 0) {
|
||||||
/* Erroneous decimation factor and CIC gain */
|
/* Erroneous decimation factor and CIC gain */
|
||||||
fprintf(stderr, "select_mode(): erroneous decimation factor and CIC gain\n");
|
fprintf(stderr, "%s: erroneous decimation factor and CIC gain\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +520,7 @@ static int select_mode(struct intel_dmic_params *dmic, struct dmic_calc_configur
|
||||||
cfg->fir_a->length, gain_to_fir);
|
cfg->fir_a->length, gain_to_fir);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* Invalid coefficient set found, should not happen. */
|
/* Invalid coefficient set found, should not happen. */
|
||||||
fprintf(stderr, "select_mode(): invalid coefficient set found\n");
|
fprintf(stderr, "%s: invalid coefficient set found\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -531,7 +536,7 @@ static int select_mode(struct intel_dmic_params *dmic, struct dmic_calc_configur
|
||||||
cfg->fir_b->length, gain_to_fir);
|
cfg->fir_b->length, gain_to_fir);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* Invalid coefficient set found, should not happen. */
|
/* Invalid coefficient set found, should not happen. */
|
||||||
fprintf(stderr, "select_mode(): invalid coefficient set found\n");
|
fprintf(stderr, "%s: invalid coefficient set found\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -822,7 +827,7 @@ static int configure_registers(struct intel_dmic_params *dmic, struct dmic_calc_
|
||||||
|
|
||||||
ret = stereo_helper(dmic, stereo, swap);
|
ret = stereo_helper(dmic, stereo, swap);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "configure_registers(): enable conflict\n");
|
fprintf(stderr, "%s: enable conflict\n", __func__);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,13 +983,14 @@ int dmic_calculate(struct intel_nhlt_params *nhlt)
|
||||||
di = dmic->dmic_dai_index;
|
di = dmic->dmic_dai_index;
|
||||||
|
|
||||||
if (di >= DMIC_HW_FIFOS) {
|
if (di >= DMIC_HW_FIFOS) {
|
||||||
fprintf(stderr, "dmic_set_config(): dai->index exceeds number of FIFOs\n");
|
fprintf(stderr, "%s: dai->index %d exceeds number of FIFOs\n", __func__, di);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dmic->dmic_prm[di].num_pdm_active > DMIC_HW_CONTROLLERS) {
|
if (dmic->dmic_prm[di].num_pdm_active > DMIC_HW_CONTROLLERS) {
|
||||||
fprintf(stderr, "dmic_set_config():controller count exceeds platform capability\n");
|
fprintf(stderr, "%s: controller count %d exceeds platform capability\n",
|
||||||
|
__func__, dmic->dmic_prm[di].num_pdm_active);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -996,7 +1002,8 @@ int dmic_calculate(struct intel_nhlt_params *nhlt)
|
||||||
case 32:
|
case 32:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "dmic_set_config(): fifo_bits EINVAL\n");
|
fprintf(stderr, "%s: Bad fifo_bits %d\n", __func__,
|
||||||
|
dmic->dmic_prm[di].fifo_bits);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1008,14 +1015,14 @@ int dmic_calculate(struct intel_nhlt_params *nhlt)
|
||||||
*/
|
*/
|
||||||
find_modes(dmic, &modes_a, dmic->dmic_prm[0].fifo_fs);
|
find_modes(dmic, &modes_a, dmic->dmic_prm[0].fifo_fs);
|
||||||
if (modes_a.num_of_modes == 0 && dmic->dmic_prm[0].fifo_fs > 0) {
|
if (modes_a.num_of_modes == 0 && dmic->dmic_prm[0].fifo_fs > 0) {
|
||||||
fprintf(stderr, "dmic_set_config(): No modes found for FIFO A\n");
|
fprintf(stderr, "%s: No modes found for FIFO A\n", __func__);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
find_modes(dmic, &modes_b, dmic->dmic_prm[1].fifo_fs);
|
find_modes(dmic, &modes_b, dmic->dmic_prm[1].fifo_fs);
|
||||||
if (modes_b.num_of_modes == 0 && dmic->dmic_prm[1].fifo_fs > 0) {
|
if (modes_b.num_of_modes == 0 && dmic->dmic_prm[1].fifo_fs > 0) {
|
||||||
fprintf(stderr, "dmic_set_config(): No modes found for FIFO B\n");
|
fprintf(stderr, "%s: No modes found for FIFO B\n", __func__);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1030,7 @@ int dmic_calculate(struct intel_nhlt_params *nhlt)
|
||||||
match_modes(&modes_ab, &modes_a, &modes_b);
|
match_modes(&modes_ab, &modes_a, &modes_b);
|
||||||
ret = select_mode(dmic, &cfg, &modes_ab);
|
ret = select_mode(dmic, &cfg, &modes_ab);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "dmic_set_config(): select_mode() failed\n");
|
fprintf(stderr, "%s: select_mode() failed %d\n", __func__, ret);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1033,7 +1040,7 @@ int dmic_calculate(struct intel_nhlt_params *nhlt)
|
||||||
*/
|
*/
|
||||||
ret = configure_registers(dmic, &cfg);
|
ret = configure_registers(dmic, &cfg);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "dmic_set_config(): cannot configure registers\n");
|
fprintf(stderr, "%s: cannot configure registers %d\n", __func__, ret);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1269,7 +1276,7 @@ int dmic_set_pdm_params(struct intel_nhlt_params *nhlt, int pdm_index, int enabl
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (pdm_index >= DMIC_HW_CONTROLLERS) {
|
if (pdm_index >= DMIC_HW_CONTROLLERS) {
|
||||||
fprintf(stderr, "set_pdm_data illegal pdm_index\n");
|
fprintf(stderr, "%s: illegal pdm_index %d\n", __func__, pdm_index);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue