Skip to content

Commit db15078

Browse files
committed
iio: axi_aion_trig Preserve and restore per-channel trigger phase settings
This patch adds support for storing trigger phase values per channel in the `axi_aion_state` structure. The values are saved during IIO write operations and later restored during JESD204 setup stage 1. This ensures that user-configured phase offsets are retained across initialization sequences. Signed-off-by: Michael Hennerich <[email protected]>
1 parent 8203b3d commit db15078

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/iio/logic/axi_aion_trig.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ struct axi_aion_state {
7777
struct clk *dev_clk;
7878
struct jesd204_dev *jdev;
7979
struct iio_channel *iio_adf4030;
80+
u32 trigX_phase[8];
8081
};
8182

8283
struct axi_aion_state *st_global;
@@ -300,6 +301,7 @@ static int axi_aion_iio_write_raw(struct iio_dev *indio_dev, struct iio_chan_spe
300301
case IIO_CHAN_INFO_PHASE:
301302
if (val > 0xFFFF || val < 0)
302303
return -EINVAL;
304+
st->trigX_phase[chan->channel] = val;
303305
return regmap_write(st->regmap, chan->address, val);
304306
case IIO_CHAN_INFO_ENABLE:
305307
return regmap_update_bits(st->regmap, AION_CONTROL_REG, BIT(chan->channel + 2),
@@ -507,7 +509,7 @@ static int axi_aion_jesd204_opt_setup_stage1(struct jesd204_dev *jdev,
507509
struct device *dev = jesd204_dev_to_device(jdev);
508510
struct iio_dev *indio_dev = dev_get_drvdata(dev);
509511
struct axi_aion_state *st = iio_priv(indio_dev);
510-
int ret;
512+
int ret, i;
511513
u32 regval;
512514
s64 adf4030_phase;
513515
int val, val2;
@@ -651,6 +653,9 @@ static int axi_aion_jesd204_opt_setup_stage1(struct jesd204_dev *jdev,
651653
return ret;
652654
}
653655

656+
for (i = 0; i < ARRAY_SIZE(st->trigX_phase); i++)
657+
regmap_write(st->regmap, AION_TRIG_CH0_PHASE_REG + (i * 4), st->trigX_phase[i]);
658+
654659
return JESD204_STATE_CHANGE_DONE;
655660
out:
656661
regmap_set_bits(st->regmap, AION_CONTROL_REG,

0 commit comments

Comments
 (0)