drivers/audio: fix samp rate conversion issue
use ac_controls.hw to get the correct sample rate intead of ac_controls.b Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
This commit is contained in:
parent
ec4d31515a
commit
575c9b12ab
@ -81,18 +81,14 @@
|
|||||||
/* Samplerates field is split into low and high byte */
|
/* Samplerates field is split into low and high byte */
|
||||||
|
|
||||||
#ifdef CONFIG_AUDIO_CXD56_SRC
|
#ifdef CONFIG_AUDIO_CXD56_SRC
|
||||||
#define CXD56_SUPP_RATES_L (AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K | \
|
#define CXD56_SUPP_RATES (AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K | \
|
||||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | \
|
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | \
|
||||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K | \
|
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K | \
|
||||||
AUDIO_SAMP_RATE_48K)
|
AUDIO_SAMP_RATE_48K | AUDIO_SAMP_RATE_96K | \
|
||||||
#define CXD56_SUPP_RATES_H ((AUDIO_SAMP_RATE_96K | AUDIO_SAMP_RATE_128K | \
|
AUDIO_SAMP_RATE_128K | AUDIO_SAMP_RATE_192K)
|
||||||
AUDIO_SAMP_RATE_192K) >> 8)
|
|
||||||
#define CXD56_SUPP_RATES (CXD56_SUPP_RATES_L | CXD56_SUPP_RATES_H)
|
|
||||||
#else
|
#else
|
||||||
/* No sample rate converter, only support system rate of 48kHz */
|
/* No sample rate converter, only support system rate of 48kHz */
|
||||||
#define CXD56_SUPP_RATES_L AUDIO_SAMP_RATE_48K
|
#define CXD56_SUPP_RATES AUDIO_SAMP_RATE_48K
|
||||||
#define CXD56_SUPP_RATES_H 0x0
|
|
||||||
#define CXD56_SUPP_RATES (CXD56_SUPP_RATES_L | CXD56_SUPP_RATES_H)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Mic setting definitions */
|
/* Mic setting definitions */
|
||||||
@ -2587,8 +2583,6 @@ static int cxd56_getcaps(struct audio_lowerhalf_s *lower, int type,
|
|||||||
{
|
{
|
||||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
|
|
||||||
uint16_t *ptr;
|
|
||||||
|
|
||||||
/* Fill in the caller's structure based on requested info */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -2633,8 +2627,7 @@ static int cxd56_getcaps(struct audio_lowerhalf_s *lower, int type,
|
|||||||
|
|
||||||
/* Report supported output sample rates */
|
/* Report supported output sample rates */
|
||||||
|
|
||||||
ptr = (uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] = CXD56_SUPP_RATES;
|
||||||
*ptr = CXD56_SUPP_RATES_L;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2654,8 +2647,7 @@ static int cxd56_getcaps(struct audio_lowerhalf_s *lower, int type,
|
|||||||
|
|
||||||
/* Report supported input sample rates */
|
/* Report supported input sample rates */
|
||||||
|
|
||||||
ptr = (uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] = CXD56_SUPP_RATES;
|
||||||
*ptr = CXD56_SUPP_RATES_L;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -309,7 +309,6 @@ static int sim_audio_getcaps(struct audio_lowerhalf_s *dev, int type,
|
|||||||
struct audio_caps_s *caps)
|
struct audio_caps_s *caps)
|
||||||
{
|
{
|
||||||
struct sim_audio_s *priv = (struct sim_audio_s *)dev;
|
struct sim_audio_s *priv = (struct sim_audio_s *)dev;
|
||||||
uint16_t *ptr;
|
|
||||||
long val;
|
long val;
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -370,16 +369,15 @@ static int sim_audio_getcaps(struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* Report the Sample rates we support */
|
/* Report the Sample rates we support */
|
||||||
|
|
||||||
ptr = (uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] = AUDIO_SAMP_RATE_8K |
|
||||||
*ptr = AUDIO_SAMP_RATE_8K |
|
AUDIO_SAMP_RATE_11K |
|
||||||
AUDIO_SAMP_RATE_11K |
|
AUDIO_SAMP_RATE_12K |
|
||||||
AUDIO_SAMP_RATE_12K |
|
AUDIO_SAMP_RATE_16K |
|
||||||
AUDIO_SAMP_RATE_16K |
|
AUDIO_SAMP_RATE_22K |
|
||||||
AUDIO_SAMP_RATE_22K |
|
AUDIO_SAMP_RATE_24K |
|
||||||
AUDIO_SAMP_RATE_24K |
|
AUDIO_SAMP_RATE_32K |
|
||||||
AUDIO_SAMP_RATE_32K |
|
AUDIO_SAMP_RATE_44K |
|
||||||
AUDIO_SAMP_RATE_44K |
|
AUDIO_SAMP_RATE_48K;
|
||||||
AUDIO_SAMP_RATE_48K;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -215,8 +215,6 @@ static int null_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
DEBUGASSERT(caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
|
|
||||||
uint16_t *ptr;
|
|
||||||
|
|
||||||
/* Fill in the caller's structure based on requested info */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -275,14 +273,13 @@ static int null_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* Report the Sample rates we support */
|
/* Report the Sample rates we support */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] = AUDIO_SAMP_RATE_8K |
|
||||||
*ptr = AUDIO_SAMP_RATE_8K |
|
AUDIO_SAMP_RATE_11K |
|
||||||
AUDIO_SAMP_RATE_11K |
|
AUDIO_SAMP_RATE_16K |
|
||||||
AUDIO_SAMP_RATE_16K |
|
AUDIO_SAMP_RATE_22K |
|
||||||
AUDIO_SAMP_RATE_22K |
|
AUDIO_SAMP_RATE_32K |
|
||||||
AUDIO_SAMP_RATE_32K |
|
AUDIO_SAMP_RATE_44K |
|
||||||
AUDIO_SAMP_RATE_44K |
|
AUDIO_SAMP_RATE_48K;
|
||||||
AUDIO_SAMP_RATE_48K;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIO_FMT_MP3:
|
case AUDIO_FMT_MP3:
|
||||||
|
@ -358,8 +358,6 @@ static int cs4344_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
||||||
|
|
||||||
uint16_t *ptr;
|
|
||||||
|
|
||||||
/* Fill in the caller's structure based on requested info */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -418,8 +416,7 @@ static int cs4344_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* Report the Sample rates we support */
|
/* Report the Sample rates we support */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] =
|
||||||
*ptr =
|
|
||||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
||||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
||||||
AUDIO_SAMP_RATE_48K;
|
AUDIO_SAMP_RATE_48K;
|
||||||
|
@ -522,8 +522,6 @@ static int cs43l22_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
||||||
|
|
||||||
uint16_t *ptr;
|
|
||||||
|
|
||||||
/* Fill in the caller's structure based on requested info */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -582,8 +580,7 @@ static int cs43l22_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* Report the Sample rates we support */
|
/* Report the Sample rates we support */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] =
|
||||||
*ptr =
|
|
||||||
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
||||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
||||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
||||||
|
@ -802,8 +802,6 @@ static int es8311_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
audinfo("getcaps: type=%d ac_type=%d\n", type, caps->ac_type);
|
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 */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -847,8 +845,7 @@ static int es8311_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* 8kHz is hardware dependent */
|
/* 8kHz is hardware dependent */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] =
|
||||||
*ptr =
|
|
||||||
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
||||||
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
||||||
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
||||||
@ -865,8 +862,7 @@ static int es8311_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
{
|
{
|
||||||
/* Report supported input sample rates */
|
/* Report supported input sample rates */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] =
|
||||||
*ptr =
|
|
||||||
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
||||||
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
||||||
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
||||||
|
@ -773,8 +773,6 @@ static int es8388_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
audinfo("getcaps: type=%d ac_type=%d\n", type, caps->ac_type);
|
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 */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -830,8 +828,7 @@ static int es8388_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* 8kHz is hardware dependent */
|
/* 8kHz is hardware dependent */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] =
|
||||||
*ptr =
|
|
||||||
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
||||||
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
||||||
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
||||||
@ -853,8 +850,7 @@ static int es8388_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* Report supported input sample rates */
|
/* Report supported input sample rates */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] =
|
||||||
*ptr =
|
|
||||||
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K |
|
||||||
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K |
|
||||||
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_48K;
|
||||||
|
@ -564,8 +564,6 @@ static int vs1053_getcaps(FAR struct audio_lowerhalf_s *lower, int type,
|
|||||||
|
|
||||||
DEBUGASSERT(caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
|
|
||||||
uint16_t *ptr;
|
|
||||||
|
|
||||||
/* Fill in the caller's structure based on requested info */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -649,14 +647,13 @@ static int vs1053_getcaps(FAR struct audio_lowerhalf_s *lower, int type,
|
|||||||
|
|
||||||
/* Report the Sample rates we support */
|
/* Report the Sample rates we support */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] = AUDIO_SAMP_RATE_8K |
|
||||||
*ptr = AUDIO_SAMP_RATE_8K |
|
AUDIO_SAMP_RATE_11K |
|
||||||
AUDIO_SAMP_RATE_11K |
|
AUDIO_SAMP_RATE_16K |
|
||||||
AUDIO_SAMP_RATE_16K |
|
AUDIO_SAMP_RATE_22K |
|
||||||
AUDIO_SAMP_RATE_22K |
|
AUDIO_SAMP_RATE_32K |
|
||||||
AUDIO_SAMP_RATE_32K |
|
AUDIO_SAMP_RATE_44K |
|
||||||
AUDIO_SAMP_RATE_44K |
|
AUDIO_SAMP_RATE_48K;
|
||||||
AUDIO_SAMP_RATE_48K;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIO_FMT_MP3:
|
case AUDIO_FMT_MP3:
|
||||||
|
@ -957,8 +957,6 @@ static int wm8904_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
||||||
|
|
||||||
uint16_t *ptr;
|
|
||||||
|
|
||||||
/* Fill in the caller's structure based on requested info */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -1018,8 +1016,7 @@ static int wm8904_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* Report the Sample rates we support */
|
/* Report the Sample rates we support */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] =
|
||||||
*ptr =
|
|
||||||
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
||||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
||||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
||||||
|
@ -655,8 +655,6 @@ static int wm8994_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
DEBUGASSERT(caps && caps->ac_len >= sizeof(struct audio_caps_s));
|
||||||
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
audinfo("type=%d ac_type=%d\n", type, caps->ac_type);
|
||||||
|
|
||||||
uint16_t *ptr;
|
|
||||||
|
|
||||||
/* Fill in the caller's structure based on requested info */
|
/* Fill in the caller's structure based on requested info */
|
||||||
|
|
||||||
caps->ac_format.hw = 0;
|
caps->ac_format.hw = 0;
|
||||||
@ -716,8 +714,7 @@ static int wm8994_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
|||||||
|
|
||||||
/* Report the Sample rates we support */
|
/* Report the Sample rates we support */
|
||||||
|
|
||||||
ptr = (FAR uint16_t *)caps->ac_controls.b;
|
caps->ac_controls.hw[0] =
|
||||||
*ptr =
|
|
||||||
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
|
||||||
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
|
||||||
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
|
||||||
|
Loading…
Reference in New Issue
Block a user