Skip to content

Commit

Permalink
[BACKPORT]: backport ckkim's Max98090 drivers from 3.8 to 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrjr committed Nov 26, 2013
1 parent 34c51bb commit e6fa29e
Show file tree
Hide file tree
Showing 8 changed files with 3,828 additions and 1,278 deletions.
11 changes: 11 additions & 0 deletions arch/arm/mach-exynos/board-odroidxu-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@

#include "board-odroidxu.h"

#include <sound/max98090.h>
static struct max98090_pdata max98090 = {
.digmic_left_mode = 0,
.digmic_right_mode = 0,
.digmic_3_mode = 0,
.digmic_4_mode = 0,
};


static struct i2c_board_info i2c_devs1[] __initdata = {
{
I2C_BOARD_INFO("max98090", (0x20>>1)),
.platform_data = &max98090,
.irq = IRQ_EINT(0),
},
};

Expand Down
39 changes: 7 additions & 32 deletions include/sound/max98090.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Platform data for MAX98095
* Platform data for MAX98090
*
* Copyright 2011 Maxim Integrated Products
* Copyright 2011-2012 Maxim Integrated Products
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand All @@ -10,45 +10,20 @@
*
*/

#ifndef __SOUND_MAX98095_PDATA_H__
#define __SOUND_MAX98095_PDATA_H__

/* Equalizer filter response configuration */
struct max98095_eq_cfg {
const char *name;
unsigned int rate;
u16 band1[5];
u16 band2[5];
u16 band3[5];
u16 band4[5];
u16 band5[5];
};

/* Biquad filter response configuration */
struct max98095_biquad_cfg {
const char *name;
unsigned int rate;
u16 band1[5];
u16 band2[5];
};
#ifndef __SOUND_MAX98090_PDATA_H__
#define __SOUND_MAX98090_PDATA_H__

/* codec platform data */
struct max98095_pdata {

/* Equalizers for DAI1 and DAI2 */
struct max98095_eq_cfg *eq_cfg;
unsigned int eq_cfgcnt;

/* Biquad filter for DAI1 and DAI2 */
struct max98095_biquad_cfg *bq_cfg;
unsigned int bq_cfgcnt;
struct max98090_pdata {

/* Analog/digital microphone configuration:
* 0 = analog microphone input (normal setting)
* 1 = digital microphone input
*/
unsigned int digmic_left_mode:1;
unsigned int digmic_right_mode:1;
unsigned int digmic_3_mode:1;
unsigned int digmic_4_mode:1;
};

#endif
37 changes: 37 additions & 0 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,36 @@

/*
* Convenience kcontrol builders
*
*/
#define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
((unsigned long)&(struct soc_mixer_control) \
{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
.min = xmin, .max = xmax, .platform_max = xmax, .invert = xinvert})

#define SOC_DOUBLE_R_RANGE_TLV(xname, reg_left, reg_right, xshift, xmin, \
xmax, xinvert, tlv_array) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
.tlv.p = (tlv_array), \
.info = snd_soc_info_volsw_range, \
.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
.private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \
xshift, xmin, xmax, xinvert) }

#define SOC_SINGLE_RANGE_TLV(xname, xreg, xshift, xmin, xmax, xinvert, tlv_array) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
.tlv.p = (tlv_array), \
.info = snd_soc_info_volsw_range, \
.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
.private_value = (unsigned long)&(struct soc_mixer_control) \
{.reg = xreg, .rreg = xreg, .shift = xshift, \
.rshift = xshift, .min = xmin, .max = xmax, \
.platform_max = xmax, .invert = xinvert} }

#define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert) \
((unsigned long)&(struct soc_mixer_control) \
{.reg = xreg, .rreg = xreg, .shift = shift_left, \
Expand Down Expand Up @@ -439,6 +468,14 @@ int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);

int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo);
int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);



/**
* struct snd_soc_reg_access - Describes whether a given register is
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ snd-soc-l3-objs := l3.o
snd-soc-lm4857-objs := lm4857.o
snd-soc-max9768-objs := max9768.o
snd-soc-max98088-objs := max98088.o
snd-soc-max98090-objs := max98090.o max98090_mixer.o
snd-soc-max98090-objs := max98090.o
snd-soc-max98095-objs := max98095.o
snd-soc-max9850-objs := max9850.o
snd-soc-pcm3008-objs := pcm3008.o
Expand Down
Loading

0 comments on commit e6fa29e

Please sign in to comment.