Commit 5ca00acd authored by Federico Vaga's avatar Federico Vaga

drv: reset trigger sources when acquisition over

The aim here is to clean up this register for the next acquisition.
The user needs to configure the trigger it wants and then enable it.

By clearing the register we avoid that future acquisitions are trigger
by old configurations.
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent d693d912
......@@ -418,10 +418,7 @@ static int __fa_init(struct fa_dev *fa)
/* Set to single shot mode by default */
fa_writel(fa, fa->fa_adc_csr_base, &zfad_regs[ZFAT_SHOTS_NB], 1);
/* Enable the software trigger by default: there is no arm in this */
/* Enable the alternative time source: later it will be done by HDL */
fa_writel(fa, fa->fa_adc_csr_base, &zfad_regs[ZFAT_CFG_SRC],
FA100M14B4C_TRG_SRC_SW | FA100M14B4C_TRG_SRC_ALT);
zfat_trigger_source_reset(fa);
/* Zero offsets and release the DAC clear */
zfad_reset_offset(fa);
......
......@@ -114,6 +114,15 @@ static struct zio_attribute zfat_ext_zattr[] = {
ZFA_UTC_TRIG_COARSE, 0),
};
/*
* Reset to default value
*/
void zfat_trigger_source_reset(struct fa_dev *fa)
{
fa_writel(fa, fa->fa_adc_csr_base,
&zfad_regs[ZFAT_CFG_SRC],
FA100M14B4C_TRG_SRC_SW | FA100M14B4C_TRG_SRC_ALT);
}
/*
* zfat_conf_set
......@@ -322,6 +331,12 @@ static int zfat_data_done(struct zio_cset *cset)
kfree(zfad_block);
cset->interleave->priv_d = NULL;
/*
* Reset trigger source to avoid clean up the register for the next
* acquisition
*/
zfat_trigger_source_reset(fa);
return 0;
}
......
......@@ -598,6 +598,7 @@ extern int fa_zio_init(struct fa_dev *fa);
extern void fa_zio_exit(struct fa_dev *fa);
/* Functions exported by fa-zio-trg.c */
extern void zfat_trigger_source_reset(struct fa_dev *fa);
extern int fa_trig_init(void);
extern void fa_trig_exit(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment