Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change for adrv9002 sdk26 #494

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@
"mcsMode": 0,
"mcsInterfaceType": 0,
"adcTypeMonitor": 1,
"pllLockTime_us": 750,
"pllLockTime_us": 380,
"pllPhaseSyncWait_us": 0,
"pllModulus": {
"modulus": [ 8388593, 8388593, 8388593, 8388593, 8388593 ],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@
"mcsMode": 0,
"mcsInterfaceType": 0,
"adcTypeMonitor": 1,
"pllLockTime_us": 750,
"pllLockTime_us": 380,
"pllPhaseSyncWait_us": 0,
"pllModulus": {
"modulus": [ 8388593, 8388593, 8388593, 8388593, 8388593 ],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@
"mcsMode": 0,
"mcsInterfaceType": 0,
"adcTypeMonitor": 1,
"pllLockTime_us": 750,
"pllLockTime_us": 380,
"pllPhaseSyncWait_us": 0,
"pllModulus": {
"modulus": [ 8388593, 8388593, 8388593, 8388593, 8388593 ],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@
"mcsMode": 0,
"mcsInterfaceType": 0,
"adcTypeMonitor": 1,
"pllLockTime_us": 750,
"pllLockTime_us": 380,
"pllPhaseSyncWait_us": 0,
"pllModulus": {
"modulus": [ 8388593, 8388593, 8388593, 8388593, 8388593 ],
Expand Down
Binary file not shown.
12 changes: 12 additions & 0 deletions iio_widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,18 @@ static gboolean iio_widget_signal_unblock(gpointer arg)
return FALSE;
}

void iio_widget_update_value(struct iio_widget *widget, const char *ensm, size_t len)
{
guint sig = 0;

if (widget->sig_handler_data)
sig = g_signal_handlers_block_matched(G_OBJECT(widget->widget), G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, widget->sig_handler_data);
widget->update_value(widget, ensm, len);

if (sig)
g_timeout_add(1, (GSourceFunc)iio_widget_signal_unblock, widget);
}
/*
* The point of these is that when we update a widget, we can receive a different value from the
* iio dev from the one in the GUI (eg: a failed call to widget->save() or an autonomous update).
Expand Down
1 change: 1 addition & 0 deletions iio_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void iio_make_widget_update_signal_based(struct iio_widget *widget, GCallback ha
void iio_update_widgets(struct iio_widget *widgets, unsigned int num_widgets);
void iio_update_widgets_block_signals_by_data(struct iio_widget *widgets, unsigned int num_widgets);
void iio_widget_update(struct iio_widget *widget);
void iio_widget_update_value(struct iio_widget *widget, const char *ensm, size_t len);
void iio_update_widgets_of_device(struct iio_widget *widgets,
unsigned int num_widgets, struct iio_device *dev);
void iio_widget_update_block_signals_by_data(struct iio_widget *widget);
Expand Down
24 changes: 18 additions & 6 deletions plugins/adrv9002.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ static void update_label(const struct adrv9002_gtklabel *label)
gtk_label_set_text(label->labels, attr_val);
}

static void update_special_widgets(struct adrv9002_common *chann)
static void update_special_widgets(struct adrv9002_common *chann, const char *ensm, size_t len)
{
char *gain_ctl = gtk_combo_box_text_get_active_text(
GTK_COMBO_BOX_TEXT(chann->gain_ctrl.widget));
Expand All @@ -653,8 +653,8 @@ static void update_special_widgets(struct adrv9002_common *chann)
if (gain_ctl && strcmp(gain_ctl, "spi"))
iio_widget_update_block_signals_by_data(&chann->gain);

if (port_en && strcmp(port_en, "spi"))
iio_widget_update_block_signals_by_data(&chann->ensm);
if (port_en && strcmp(port_en, "spi") && ensm)
iio_widget_update_value(&chann->ensm, ensm, len);

g_free(gain_ctl);
g_free(port_en);
Expand All @@ -667,13 +667,25 @@ static void update_special_rx_widgets(struct adrv9002_rx *rx, const int n_widget
for (i = 0; i < n_widgets; i++) {
char *digital_gain = gtk_combo_box_text_get_active_text(
GTK_COMBO_BOX_TEXT(rx[i].digital_gain_ctl.widget));
char ensm[32] = {0};

if (!rx[i].rx.enabled)
goto nex_widget;

update_label(&rx[i].rssi);
/*
* There was a change in the driver API where an error is returned if we try to read
* the RSSI level if the channel is not enabled. Hence, make sure we only update it
* if the channel is enabled.
*/
if (iio_channel_attr_read(rx[i].rx.ensm.chn, rx[i].rx.ensm.attr_name, ensm,
sizeof(ensm)) > 0 && !strcmp(ensm, "rf_enabled"))
update_label(&rx[i].rssi);
update_label(&rx[i].decimated_power);
update_special_widgets(&rx[i].rx);
/*
* Pass in ensm as we already got it and so no need for another possible
* remote call into the device.
*/
update_special_widgets(&rx[i].rx, ensm, sizeof(ensm));

if (digital_gain && strstr(digital_gain, "automatic"))
iio_widget_update_block_signals_by_data(&rx[i].intf_gain);
Expand All @@ -690,7 +702,7 @@ static void update_special_tx_widgets(struct adrv9002_common *tx, const int n_wi
if (!tx[i].enabled)
continue;

update_special_widgets(&tx[i]);
update_special_widgets(&tx[i], NULL, 0);
}
}

Expand Down
Loading