[U-Boot] [PATCH 3/7 V2] Sound: Support for MAX98095 codec in driver

Simon Glass sjg at chromium.org
Fri Jan 25 22:07:08 CET 2013


Hi Rajeshwari,

On Thu, Jan 24, 2013 at 10:43 PM, Rajeshwari Shinde
<rajeshwari.s at samsung.com> wrote:
> This patchs adds support for MAX98095 codec in
> sound driver.
>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s at samsung.com>
> ---
> Changes in V2:
>         - None
>  arch/arm/include/asm/arch-exynos/sound.h |   10 +++++++++-
>  drivers/sound/sound.c                    |   13 +++++++++++--
>  include/sound.h                          |    1 +
>  3 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-exynos/sound.h b/arch/arm/include/asm/arch-exynos/sound.h
> index d1bd2f6..a216b00 100644
> --- a/arch/arm/include/asm/arch-exynos/sound.h
> +++ b/arch/arm/include/asm/arch-exynos/sound.h
> @@ -33,6 +33,7 @@
>  #define I2S_RFS                        256
>  #define I2S_BFS                        32
>
> +#ifdef CONFIG_SOUND_WM8994
>  /* I2C values */
>  #define AUDIO_I2C_BUS          1
>  #define AUDIO_I2C_REG          0x1a
> @@ -40,5 +41,12 @@
>  /* Audio Codec */
>  #define AUDIO_CODEC            "wm8994"
>
> -#define AUDIO_COMPAT           1
> +#else /* CONFIG_SOUND_MAX98095 */
> +/* I2C values */
> +#define AUDIO_I2C_BUS          7
> +#define AUDIO_I2C_REG          0x22
> +
> +/* Audio Codec */
> +#define AUDIO_CODEC            "max98095"
> +#endif
>  #endif

I don't think these should go in the arch exynos file, since they are
board settings. Do you really need audio to work when you are not
using CONFIG_OF_CONTROL? Perhaps that can be an exynos_dt-only
feature?

If you do need it, then the normal procedure is to define new CONFIGs
for the bus, address, codec name, etc. Then these need to be set in
the board config header file, like smdk5250.h. For the FDT case we
really need to avoid this though, and just use the FDT for this
information.

Regards,
Simon

> diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
> index fa8432d..a74590b 100644
> --- a/drivers/sound/sound.c
> +++ b/drivers/sound/sound.c
> @@ -31,6 +31,7 @@
>  #include <sound.h>
>  #include <asm/arch/sound.h>
>  #include "wm8994.h"
> +#include "max98095.h"
>
>  /* defines */
>  #define SOUND_400_HZ 400
> @@ -143,17 +144,25 @@ static int codec_init(const void *blob, struct i2stx_info *pi2s_tx)
>  #else
>         codectype =  AUDIO_CODEC;
>  #endif
> +#ifdef CONFIG_SOUND_WM8994
>         if (!strcmp(codectype, "wm8994")) {
>                 /* Check the codec type and initialise the same */
>                 ret = wm8994_init(blob, WM8994_AIF2,
>                         pi2s_tx->samplingrate,
>                         (pi2s_tx->samplingrate * (pi2s_tx->rfs)),
>                         pi2s_tx->bitspersample, pi2s_tx->channels);
> +#endif
> +#ifdef CONFIG_SOUND_MAX98095
> +       if (!strcmp(codectype, "max98095")) {
> +               ret = max98095_init(blob, pi2s_tx->samplingrate,
> +                               (pi2s_tx->samplingrate * (pi2s_tx->rfs)),
> +                               pi2s_tx->bitspersample);
> +#endif
>         } else {
> -               debug("%s: Unknown code type %s\n", __func__,
> -                     codectype);
> +               debug("%s: Unknown codec type %s\n", __func__, codectype);
>                 return -1;
>         }
> +
>         if (ret) {
>                 debug("%s: Codec init failed\n", __func__);
>                 return -1;
> diff --git a/include/sound.h b/include/sound.h
> index d73839d..94922f6 100644
> --- a/include/sound.h
> +++ b/include/sound.h
> @@ -28,6 +28,7 @@
>  enum en_sound_codec {
>         CODEC_WM_8994,
>         CODEC_WM_8995,
> +       CODEC_MAX_98095,
>         CODEC_MAX
>  };
>
> --
> 1.7.4.4
>


More information about the U-Boot mailing list