static int hp_dac_lim = 9;
module_param(hp_dac_lim, int, 0);
-/* Data for reading/writing to the IIR Filter hwdep */
-struct aic3x_iir_coeffs {
- short N0, N1, N2, D1, D2;
- short N3, N4, N5, D4, D5;
-};
-
struct aic3x_dacfilter_t {
struct aic3x_iir_coeffs coeffs;
int state;
reg -= 128;
page = 1;
}
- printk("MNZ: aic3x_write(reg = %i, val = 0x%x, page = %i)\n",
- reg, value, page);
+ //printk("MNZ: aic3x_write(reg = %i, val = 0x%x, page = %i)\n",
+ //reg, value, page);
if(reg && curpage != page){
data[0] = 0;
data[1] = page;
return 0;
}
-/* DAC Filter Functions */
+/* DAC and De-emphasis Filter Functions */
+int aic3x_deemph_set_coeffs(struct snd_soc_codec *codec,
+ int N0, int N1, int D1){
+ printk("MNZ: setting deemph coeffs\n");
+ snd_soc_update_bits(codec, AIC3X_CODEC_DFILT_CTRL, DEEMPH_ON, 0);
+
+ aic3x_write_coeff(codec, DEEMPH_LEFT_N0, N0);
+ aic3x_write_coeff(codec, DEEMPH_LEFT_N1, N1);
+ aic3x_write_coeff(codec, DEEMPH_LEFT_D1, D1);
+ aic3x_write_coeff(codec, DEEMPH_RIGHT_N0, N0);
+ aic3x_write_coeff(codec, DEEMPH_RIGHT_N1, N1);
+ aic3x_write_coeff(codec, DEEMPH_RIGHT_D1, D1);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(aic3x_deemph_set_coeffs);
+
+int aic3x_deemph_set_state(struct snd_soc_codec *codec, int state){
+ printk("MNZ: Setting De-Emph filter: %i\n", state);
+ if(state) state = DEEMPH_ON;
+ else state = 0;
+ return snd_soc_update_bits(codec, AIC3X_CODEC_DFILT_CTRL,
+ DEEMPH_ON, state);
+}
+EXPORT_SYMBOL_GPL(aic3x_deemph_set_state);
static int aic3x_dacfilter_write_coeffs
(struct snd_soc_codec *codec, struct aic3x_iir_coeffs *coeffs)
{
- struct aic3x_priv *aic3x = codec->private_data;
printk("MNZ: dacfilter_write_coeffs\n");
snd_soc_update_bits(codec, AIC3X_CODEC_DFILT_CTRL, EFFECTS_ON, 0);
aic3x_write_coeff(codec, EFFECTS_LEFT_N0, coeffs->N0);
aic3x_write_coeff(codec, EFFECTS_RIGHT_D4, coeffs->D4);
aic3x_write_coeff(codec, EFFECTS_RIGHT_D5, coeffs->D5);
- snd_soc_update_bits(codec, AIC3X_CODEC_DFILT_CTRL, EFFECTS_ON, EFFECTS_ON);
+ return 0;
+}
+int aic3x_dacfilter_set_coeffs
+ (struct snd_soc_codec *codec, struct aic3x_iir_coeffs *coeffs)
+{
+ struct aic3x_priv *aic3x = codec->private_data;
memcpy((void*)&aic3x->dacfilter.coeffs, (void*)coeffs,
- sizeof(struct aic3x_iir_coeffs));
+ sizeof(struct aic3x_iir_coeffs));
return 0;
}
+EXPORT_SYMBOL_GPL(aic3x_dacfilter_set_coeffs);
-static int aic3x_dacfilter_set_state(struct snd_soc_codec *codec,
- int state)
+int aic3x_dacfilter_set_state(struct snd_soc_codec *codec, int state)
{
struct aic3x_priv *aic3x = codec->private_data;
EFFECTS_ON, 0);
else if(state == 1) {}
/* FIXME MNZ. Set preset from current chosen preset */
- else if (state == 2)
- return aic3x_dacfilter_write_coeffs(codec,
- &aic3x->dacfilter.coeffs);
+ else if (state == 2){
+ aic3x_dacfilter_write_coeffs(codec, &aic3x->dacfilter.coeffs);
+ snd_soc_update_bits(codec, AIC3X_CODEC_DFILT_CTRL,
+ EFFECTS_ON, EFFECTS_ON);
+ }
+
return 0;
}
+EXPORT_SYMBOL_GPL(aic3x_dacfilter_set_state);
/* DAC Filter hwdep device callbacks */
((struct aic3x_priv*)codec->private_data)->dacfilter.state = 2;
- return aic3x_dacfilter_write_coeffs(codec,
+ return aic3x_dacfilter_set_coeffs(codec,
(struct aic3x_iir_coeffs*)buf);
}
-/* DAC filter and 3D depth alsa controls callbacks */
+/* DAC filter and 3D depth ALSA controls callbacks */
static int snd_soc_get_dacfilter_aic3x(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
char hwdepid[] = "IIR Filter";
int reg, ret = 0;
+ printk("MNZ: BEGIN aic3x_init\n");
codec->name = "tlv320aic3x";
codec->owner = THIS_MODULE;
codec->read = aic3x_read_reg_cache;
/* Set some defaults for coefficients */
aic3x_write_coeff(codec, EFFECTS_3DATTEN, -32768);
+ printk("MNZ: END aic3x_init\n");
return ret;