Commit 784e50ef authored by Michel Arruat's avatar Michel Arruat Committed by Federico Vaga

adc_driver trig config is checked globally

Checking trigger parameter at each single change may lead
to detect error on intermediate configuration which is not the final
one. The check is done when the user starts an acquisition
parent d313407c
......@@ -87,7 +87,6 @@ static int zfat_conf_set(struct device *dev, struct zio_attribute *zattr,
struct fa_dev *fa = get_zfadc(dev);
struct zio_ti *ti = to_zio_ti(dev);
uint32_t tmp_val = usr_val;
int err = 0;
switch (zattr->id) {
case ZFAT_SHOTS_NB:
......@@ -95,11 +94,6 @@ static int zfat_conf_set(struct device *dev, struct zio_attribute *zattr,
dev_err(dev, "nshots cannot be 0\n");
return -EINVAL;
}
if (tmp_val > 1) { /* multishot restricts samples count */
err = zfat_overflow_detection(ti, zattr->id, tmp_val);
if (err)
return err;
}
break;
case ZFAT_POST:
/*
......@@ -117,10 +111,6 @@ static int zfat_conf_set(struct device *dev, struct zio_attribute *zattr,
return -EINVAL;
}
tmp_val -= 1;
case ZFAT_PRE:
err = zfat_overflow_detection(ti, zattr->id, tmp_val);
if (err)
return err;
break;
case ZFAT_SW:
/* Fire if software trigger is enabled (index 5) */
......@@ -295,12 +285,20 @@ static int zfat_arm_trigger(struct zio_ti *ti)
unsigned int size;
uint32_t dev_mem_off;
int i, err = 0;
struct zio_attribute *ti_zattr = ti->zattr_set.std_zattr;
gfp_t gfp;
/* if fsm-auto-start is active, we re-allocate at interrupt time */
gfp = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
dev_dbg(msgdev, "Arming trigger\n");
/* Check if device memory allows this trigger configuration */
err = zfat_overflow_detection(ti, ZFAT_POST,
ti_zattr[ZIO_ATTR_TRIG_POST_SAMP].value);
if (err)
return err;
/* Update the current control: sequence, nsamples and tstamp */
interleave->current_ctrl->nsamples = ti->nsamples;
......
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