Reconcile SDRPlay gains with SoapySDR abstractions #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Good morning and a happy new year to all!
This PR is an attempt to reconcile the unusual SDRPlay gains with the standard SoapySDR abstractions as cleanly as possible. It solves pothosware/SoapySDRPlay2#44. This is a port of pothosware/SoapySDRPlay2#61 to the new version 3 driver.
(The first commit is a solution to pothosware/SoapySDRPlay2#60; I also opened a separate PR #25 with just that commit.)
A brief summary of the changes:
SoapySDR and various SoapySDR clients expect that a larger gain results in more amplification. However, SDRPlay exposes a gain reduction, resulting in backwards controls and/or unstable AGC loops in generic SoapySDR clients. The solution is to define the gain to be equal to the negative of the gain reduction. For example, if a radio has an IF gain reduction range of 20 to 59 dB, this will now be exposed as an IF gain with a range of -20 to -59 dB.
A slightly thornier issue is that the "RF gain reduction" setting is not actually a gain setting in dB, but rather a mode selection for the front-end LNA. Semantically, it belongs in the settings and not in the gains. However, for the convenience of users who prefer to have the LNA setting available as a gain, a build option is provided. As with the IF gain, RF gain reduction values are negated so that larger values result in greater amplification.
I have built and tested this PR with the SDRPlay driver version 3.07 and an RSP1A on Debian Linux.
References: