drivers/audio: fix samp rate conversion issue
Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
This commit is contained in:
parent
618a51fa84
commit
b874d95beb
arch/arm/src/cxd56xx
drivers/audio
@ -2587,6 +2587,8 @@ static int cxd56_getcaps(struct audio_lowerhalf_s *lower, int type,
|
||||
{
|
||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -2631,8 +2633,8 @@ static int cxd56_getcaps(struct audio_lowerhalf_s *lower, int type,
|
||||
|
||||
/* Report supported output sample rates */
|
||||
|
||||
caps->ac_controls.b[0] = CXD56_SUPP_RATES_L;
|
||||
caps->ac_controls.b[1] = CXD56_SUPP_RATES_H;
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr = CXD56_SUPP_RATES_L;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2652,8 +2654,8 @@ static int cxd56_getcaps(struct audio_lowerhalf_s *lower, int type,
|
||||
|
||||
/* Report supported input sample rates */
|
||||
|
||||
caps->ac_controls.b[0] = CXD56_SUPP_RATES_L;
|
||||
caps->ac_controls.b[1] = CXD56_SUPP_RATES_H;
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr = CXD56_SUPP_RATES_L;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -215,6 +215,8 @@ static int null_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
DEBUGASSERT(caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -273,13 +275,14 @@ static int null_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
/* Report the Sample rates we support */
|
||||
|
||||
caps->ac_controls.b[0] = AUDIO_SAMP_RATE_8K |
|
||||
AUDIO_SAMP_RATE_11K |
|
||||
AUDIO_SAMP_RATE_16K |
|
||||
AUDIO_SAMP_RATE_22K |
|
||||
AUDIO_SAMP_RATE_32K |
|
||||
AUDIO_SAMP_RATE_44K |
|
||||
AUDIO_SAMP_RATE_48K;
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr = AUDIO_SAMP_RATE_8K |
|
||||
AUDIO_SAMP_RATE_11K |
|
||||
AUDIO_SAMP_RATE_16K |
|
||||
AUDIO_SAMP_RATE_22K |
|
||||
AUDIO_SAMP_RATE_32K |
|
||||
AUDIO_SAMP_RATE_44K |
|
||||
AUDIO_SAMP_RATE_48K;
|
||||
break;
|
||||
|
||||
case AUDIO_FMT_MP3:
|
||||
|
@ -358,6 +358,8 @@ static int cs4344_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -416,7 +418,8 @@ static int cs4344_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
/* Report the Sample rates we support */
|
||||
|
||||
caps->ac_controls.b[0] =
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr =
|
||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
||||
AUDIO_SAMP_RATE_48K;
|
||||
|
@ -522,6 +522,8 @@ static int cs43l22_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -580,7 +582,8 @@ static int cs43l22_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
/* Report the Sample rates we support */
|
||||
|
||||
caps->ac_controls.b[0] =
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr =
|
||||
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
||||
|
@ -802,6 +802,8 @@ static int es8311_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
audinfo("getcaps: type=%d ac_type=%d\n", type, caps->ac_type);
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -845,11 +847,11 @@ static int es8311_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
/* 8kHz is hardware dependent */
|
||||
|
||||
caps->ac_controls.b[0] =
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr =
|
||||
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
||||
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
||||
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
||||
caps->ac_controls.b[1] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -863,11 +865,11 @@ static int es8311_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
{
|
||||
/* Report supported input sample rates */
|
||||
|
||||
caps->ac_controls.b[0] =
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr =
|
||||
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
||||
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
||||
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
||||
caps->ac_controls.b[1] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -773,6 +773,8 @@ static int es8388_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
audinfo("getcaps: type=%d ac_type=%d\n", type, caps->ac_type);
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -828,11 +830,11 @@ static int es8388_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
/* 8kHz is hardware dependent */
|
||||
|
||||
caps->ac_controls.b[0] =
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr =
|
||||
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
||||
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
||||
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
||||
caps->ac_controls.b[1] = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -851,11 +853,11 @@ static int es8388_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
/* Report supported input sample rates */
|
||||
|
||||
caps->ac_controls.b[0] =
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr =
|
||||
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
||||
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
||||
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
||||
caps->ac_controls.b[1] = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -564,6 +564,8 @@ static int vs1053_getcaps(FAR struct audio_lowerhalf_s *lower, int type,
|
||||
|
||||
DEBUGASSERT(caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -647,13 +649,14 @@ static int vs1053_getcaps(FAR struct audio_lowerhalf_s *lower, int type,
|
||||
|
||||
/* Report the Sample rates we support */
|
||||
|
||||
caps->ac_controls.b[0] = AUDIO_SAMP_RATE_8K |
|
||||
AUDIO_SAMP_RATE_11K |
|
||||
AUDIO_SAMP_RATE_16K |
|
||||
AUDIO_SAMP_RATE_22K |
|
||||
AUDIO_SAMP_RATE_32K |
|
||||
AUDIO_SAMP_RATE_44K |
|
||||
AUDIO_SAMP_RATE_48K;
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr = AUDIO_SAMP_RATE_8K |
|
||||
AUDIO_SAMP_RATE_11K |
|
||||
AUDIO_SAMP_RATE_16K |
|
||||
AUDIO_SAMP_RATE_22K |
|
||||
AUDIO_SAMP_RATE_32K |
|
||||
AUDIO_SAMP_RATE_44K |
|
||||
AUDIO_SAMP_RATE_48K;
|
||||
break;
|
||||
|
||||
case AUDIO_FMT_MP3:
|
||||
|
@ -957,6 +957,8 @@ static int wm8904_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -1016,7 +1018,8 @@ static int wm8904_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
/* Report the Sample rates we support */
|
||||
|
||||
caps->ac_controls.b[0] =
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr =
|
||||
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
||||
|
@ -655,6 +655,8 @@ static int wm8994_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
||||
|
||||
uint16_t *ptr;
|
||||
|
||||
/* Fill in the caller's structure based on requested info */
|
||||
|
||||
caps->ac_format.hw = 0;
|
||||
@ -714,7 +716,8 @@ static int wm8994_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
|
||||
/* Report the Sample rates we support */
|
||||
|
||||
caps->ac_controls.b[0] =
|
||||
ptr = (uint16_t *)caps->ac_controls.b;
|
||||
*ptr =
|
||||
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
||||
|
Loading…
x
Reference in New Issue
Block a user