#define WM8785_PWRDNL 0x010
#define WM8785_TDM_MASK 0x1c0
+struct generic_data {
+ u8 ak4396_ctl2;
+};
+
static void ak4396_write(struct oxygen *chip, unsigned int codec,
u8 reg, u8 value)
{
static void ak4396_init(struct oxygen *chip)
{
+ struct generic_data *data = chip->model_data;
unsigned int i;
- chip->ak4396_ctl2 = AK4396_DEM_OFF | AK4396_DFS_NORMAL;
+ data->ak4396_ctl2 = AK4396_DEM_OFF | AK4396_DFS_NORMAL;
for (i = 0; i < 4; ++i) {
ak4396_write(chip, i,
AK4396_CONTROL_1, AK4396_DIF_24_MSB | AK4396_RSTN);
ak4396_write(chip, i,
- AK4396_CONTROL_2, chip->ak4396_ctl2);
+ AK4396_CONTROL_2, data->ak4396_ctl2);
ak4396_write(chip, i,
AK4396_CONTROL_3, AK4396_PCM);
ak4396_write(chip, i, AK4396_LCH_ATT, 0xff);
static void set_ak4396_params(struct oxygen *chip,
struct snd_pcm_hw_params *params)
{
+ struct generic_data *data = chip->model_data;
unsigned int i;
u8 value;
- value = chip->ak4396_ctl2 & ~AK4396_DFS_MASK;
+ value = data->ak4396_ctl2 & ~AK4396_DFS_MASK;
if (params_rate(params) <= 54000)
value |= AK4396_DFS_NORMAL;
else if (params_rate(params) < 120000)
value |= AK4396_DFS_DOUBLE;
else
value |= AK4396_DFS_QUAD;
- chip->ak4396_ctl2 = value;
+ data->ak4396_ctl2 = value;
for (i = 0; i < 4; ++i) {
ak4396_write(chip, i,
AK4396_CONTROL_1, AK4396_DIF_24_MSB);
static void update_ak4396_mute(struct oxygen *chip)
{
+ struct generic_data *data = chip->model_data;
unsigned int i;
u8 value;
- value = chip->ak4396_ctl2 & ~AK4396_SMUTE;
+ value = data->ak4396_ctl2 & ~AK4396_SMUTE;
if (chip->dac_mute)
value |= AK4396_SMUTE;
+ data->ak4396_ctl2 = value;
for (i = 0; i < 4; ++i)
ak4396_write(chip, i, AK4396_CONTROL_2, value);
}
.set_adc_params = set_wm8785_params,
.update_dac_volume = update_ak4396_volume,
.update_dac_mute = update_ak4396_mute,
+ .model_data_size = sizeof(struct generic_data),
.used_channels = OXYGEN_CHANNEL_A |
OXYGEN_CHANNEL_C |
OXYGEN_CHANNEL_SPDIF |
.set_adc_params = set_ak5385_params,
.update_dac_volume = update_ak4396_volume,
.update_dac_mute = update_ak4396_mute,
+ .model_data_size = sizeof(struct generic_data),
.used_channels = OXYGEN_CHANNEL_B |
OXYGEN_CHANNEL_C |
OXYGEN_CHANNEL_SPDIF |