Skip to content

Commit

Permalink
plugins: adrv9009: skip multichip_sync() for JESD204-FSM enabled setups
Browse files Browse the repository at this point in the history
In general this HMC7044 direct register write is a bad idea.
Make sure this is only done in case of continous SYSREF and also
inform about it, in case this is undesired.

Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich authored and dNechita committed Jul 27, 2020
1 parent 1afec5c commit e23cefa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion plugins/adrv9009.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,30 @@ static void destroy_dds_sr_attribs_list(void)
static void multichip_sync()
{
struct iio_device *hmc7004_dev;
int ret;

if (plugin_single_device_mode)
return;

/* Check for and skip in case of JESD204-FSM support */
ret = iio_device_attr_write_longlong(subcomponents[0].iio_dev, "multichip_sync", 424242);
if (ret != -EINVAL)
return;

hmc7004_dev = iio_context_find_device(ctx, "hmc7044");

if (hmc7004_dev) {
unsigned int val;
/* Turn off continous SYSREF, and enable GPI SYSREF request */
iio_device_reg_write(hmc7004_dev, 0x5a, 0);
ret = iio_device_reg_read(hmc7004_dev, 0x5a, &val);
/* Is continous mode? */
if (!ret && val == 7) {
iio_device_reg_write(hmc7004_dev, 0x5a, 0);
/* Inform - since this can be undesired */
fprintf(stdout,
"%s:%s: INFO:HMC7044 REG 0x5A set to level sensitive GPI SYSREF request\n",
__FILE__, __func__);
}
}

guint i = 0;
Expand Down

0 comments on commit e23cefa

Please sign in to comment.