@@ -217,6 +217,7 @@ static bool nau8825_volatile_reg(struct device *dev, unsigned int reg)
217
217
case NAU8825_REG_SARDOUT_RAM_STATUS :
218
218
case NAU8825_REG_CHARGE_PUMP_INPUT_READ :
219
219
case NAU8825_REG_GENERAL_STATUS :
220
+ case NAU8825_REG_BIQ_CTRL ... NAU8825_REG_BIQ_COF10 :
220
221
return true;
221
222
default :
222
223
return false;
@@ -293,6 +294,54 @@ static int nau8825_output_dac_event(struct snd_soc_dapm_widget *w,
293
294
return 0 ;
294
295
}
295
296
297
+ static int nau8825_biq_coeff_get (struct snd_kcontrol * kcontrol ,
298
+ struct snd_ctl_elem_value * ucontrol )
299
+ {
300
+ struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
301
+ struct soc_bytes_ext * params = (void * )kcontrol -> private_value ;
302
+
303
+ if (!component -> regmap )
304
+ return - EINVAL ;
305
+
306
+ regmap_raw_read (component -> regmap , NAU8825_REG_BIQ_COF1 ,
307
+ ucontrol -> value .bytes .data , params -> max );
308
+ return 0 ;
309
+ }
310
+
311
+ static int nau8825_biq_coeff_put (struct snd_kcontrol * kcontrol ,
312
+ struct snd_ctl_elem_value * ucontrol )
313
+ {
314
+ struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
315
+ struct soc_bytes_ext * params = (void * )kcontrol -> private_value ;
316
+ void * data ;
317
+
318
+ if (!component -> regmap )
319
+ return - EINVAL ;
320
+
321
+ data = kmemdup (ucontrol -> value .bytes .data ,
322
+ params -> max , GFP_KERNEL | GFP_DMA );
323
+ if (!data )
324
+ return - ENOMEM ;
325
+
326
+ regmap_update_bits (component -> regmap , NAU8825_REG_BIQ_CTRL ,
327
+ NAU8825_BIQ_WRT_EN , 0 );
328
+ regmap_raw_write (component -> regmap , NAU8825_REG_BIQ_COF1 ,
329
+ data , params -> max );
330
+ regmap_update_bits (component -> regmap , NAU8825_REG_BIQ_CTRL ,
331
+ NAU8825_BIQ_WRT_EN , NAU8825_BIQ_WRT_EN );
332
+
333
+ kfree (data );
334
+ return 0 ;
335
+ }
336
+
337
+ static const char * const nau8825_biq_path [] = {
338
+ "ADC" , "DAC"
339
+ };
340
+
341
+ static const struct soc_enum nau8825_biq_path_enum =
342
+ SOC_ENUM_SINGLE (NAU8825_REG_BIQ_CTRL , NAU8825_BIQ_PATH_SFT ,
343
+ ARRAY_SIZE (nau8825_biq_path ), nau8825_biq_path );
344
+
296
345
static const char * const nau8825_adc_decimation [] = {
297
346
"32" , "64" , "128" , "256"
298
347
};
@@ -329,6 +378,10 @@ static const struct snd_kcontrol_new nau8825_controls[] = {
329
378
330
379
SOC_ENUM ("ADC Decimation Rate" , nau8825_adc_decimation_enum ),
331
380
SOC_ENUM ("DAC Oversampling Rate" , nau8825_dac_oversampl_enum ),
381
+ /* programmable biquad filter */
382
+ SOC_ENUM ("BIQ Path Select" , nau8825_biq_path_enum ),
383
+ SND_SOC_BYTES_EXT ("BIQ Coefficeints" , 20 ,
384
+ nau8825_biq_coeff_get , nau8825_biq_coeff_put ),
332
385
};
333
386
334
387
/* DAC Mux 0x33[9] and 0x34[9] */
0 commit comments