sysclk-lwla: Implement config_commit() callback.

Move pre-acquisition hardware setup to the new config_commit()
callback.  At the moment, the only setting applied at commit
time is switching the clock source, which involves uploading
a new bitstream to the FPGA.
This commit is contained in:
Daniel Elstner 2014-01-23 02:35:51 +01:00
parent 43db343618
commit ee38c8ba3e
1 changed files with 11 additions and 2 deletions

View File

@ -329,8 +329,6 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
sr_info("Disabling external clock."); sr_info("Disabling external clock.");
devc->selected_clock_source = CLOCK_SOURCE_INT; devc->selected_clock_source = CLOCK_SOURCE_INT;
} }
if (sdi->status == SR_ST_ACTIVE)
return lwla_set_clock_source(sdi);
break; break;
default: default:
return SR_ERR_NA; return SR_ERR_NA;
@ -404,6 +402,16 @@ static int config_probe_set(const struct sr_dev_inst *sdi,
return SR_OK; return SR_OK;
} }
static int config_commit(const struct sr_dev_inst *sdi)
{
if (sdi->status != SR_ST_ACTIVE) {
sr_err("Device not ready (status %d).", (int)sdi->status);
return SR_ERR;
}
return lwla_set_clock_source(sdi);
}
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group) const struct sr_probe_group *probe_group)
{ {
@ -521,6 +529,7 @@ SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info = {
.config_get = config_get, .config_get = config_get,
.config_set = config_set, .config_set = config_set,
.config_probe_set = config_probe_set, .config_probe_set = config_probe_set,
.config_commit = config_commit,
.config_list = config_list, .config_list = config_list,
.dev_open = dev_open, .dev_open = dev_open,
.dev_close = dev_close, .dev_close = dev_close,