[alsa-devel] [PATCH] ASoC: max98090: support 20-bit and 24-bit audio format

Tzung-Bi Shih tzungbi at google.com
Mon Jan 28 11:20:47 CET 2019


Missing a parenthesis for M98090_FORMAT_S20_LE.  Please ignore this patch.

On Mon, Jan 28, 2019 at 5:15 PM Tzung-Bi Shih <tzungbi at google.com> wrote:

> From datasheet of max98090:
> If RJ = 1,
>   WS = 00, 16 bits
>   WS = 01, 20 bits
>   WS = 10, 24 bits
>
> Signed-off-by: Tzung-Bi Shih <tzungbi at google.com>
> ---
>  sound/soc/codecs/max98090.c | 16 +++++++++++++++-
>  sound/soc/codecs/max98090.h |  3 +++
>  2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
> index c97f21836c66..0ecc2f1accb5 100644
> --- a/sound/soc/codecs/max98090.c
> +++ b/sound/soc/codecs/max98090.c
> @@ -1942,7 +1942,21 @@ static int max98090_dai_hw_params(struct
> snd_pcm_substream *substream,
>         switch (params_width(params)) {
>         case 16:
>                 snd_soc_component_update_bits(component,
> M98090_REG_INTERFACE_FORMAT,
> -                       M98090_WS_MASK, 0);
> +                       M98090_RJ_MASK, M98090_RJ_MASK);
> +               snd_soc_component_update_bits(component,
> M98090_REG_INTERFACE_FORMAT,
> +                       M98090_WS_MASK, M98090_FORMAT_S16_LE);
> +               break;
> +       case 20:
> +               snd_soc_component_update_bits(component,
> M98090_REG_INTERFACE_FORMAT,
> +                       M98090_RJ_MASK, M98090_RJ_MASK);
> +               snd_soc_component_update_bits(component,
> M98090_REG_INTERFACE_FORMAT,
> +                       M98090_WS_MASK, M98090_FORMAT_S20_LE;
> +               break;
> +       case 24:
> +               snd_soc_component_update_bits(component,
> M98090_REG_INTERFACE_FORMAT,
> +                       M98090_RJ_MASK, M98090_RJ_MASK);
> +               snd_soc_component_update_bits(component,
> M98090_REG_INTERFACE_FORMAT,
> +                       M98090_WS_MASK, M98090_FORMAT_S24_LE);
>                 break;
>         default:
>                 return -EINVAL;
> diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
> index b1572a2d19da..9088f9d64ff2 100644
> --- a/sound/soc/codecs/max98090.h
> +++ b/sound/soc/codecs/max98090.h
> @@ -706,6 +706,9 @@
>  #define M98090_WS_SHIFT                        0
>  #define M98090_WS_WIDTH                        2
>  #define M98090_WS_NUM                  (1<<M98090_WS_WIDTH)
> +#define M98090_FORMAT_S16_LE           (0<<0)
> +#define M98090_FORMAT_S20_LE           (1<<0)
> +#define M98090_FORMAT_S24_LE           (2<<0)
>
>  /*
>   * M98090_REG_TDM_CONTROL
> --
> 2.20.1.495.gaa96b0ce6b-goog
>
>


More information about the Alsa-devel mailing list