Commit Graph

13 Commits

Author SHA1 Message Date
Sylvain Munaut 166d49d785 icE1usb fw/gpsdo: Only force HOLD_OVER when no PPS if not DISABLED
Bug introduced in da395cc922
but since we never had anyway to use manual mode before,
didn't get noticed ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6e2b6cf5c7c0c9deaf429be000770316ec88b9d4
2022-11-09 11:02:51 +01:00
Sylvain Munaut da395cc922 icE1usb fw/gpsdo: If no PPS present for >= 3s, go to hold over mode
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ia85a8bb0e146cb117ea6e2704c6a4dedf215c75a
2022-10-04 14:58:18 +02:00
Sylvain Munaut b8fc8a6a64 icE1usb fw/gpsdo: Use PID loop instead of ad-hoc algo
The original algo is just somehting I originally came up with
on the spot and worked and I never got the time to revisit.

Now after some testing, I implemented a PID loop that seems to
present faster lock time and at least as good stability.

Parameters were not thorougly optimized just some 'hand' tuning
trying to simulate the behavior.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie3ea7243aa4234585f1ace222632bb5580caca75
2022-10-04 14:54:36 +02:00
Sylvain Munaut ad0fc21d61 icE1usb fw/gpsdo: Use a struct for VCTXO dependent params
Not that useful for now, but prep for PID loop

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iffea8992130eccd98a2952b08277e3d0d2568a1f
2022-10-04 14:43:56 +02:00
Sylvain Munaut cfb8b0b7a0 icE1usb fw/gpsdo: Export accumulated error
This is a pretty usefu stat as this is what actually matters

Note that structure is just extended so any call with a wLength
shorter will just get the beginning of the struct (usb stack
limits response to wLength) and thus is fully backward compatible.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I0aa919d4870ca7e1b653b82ac4f76ed26b5e3b08
2022-10-04 13:54:49 +02:00
Sylvain Munaut b72aba9586 icE1usb fw/gpsdo: Limit the fine tuning range
Fine tuning has a limited tuning range. If at some point we
hit the limits, we need to bit the bullet and try to 'transfer'
some of that to the coarse range as best as we can. Hopefully
we get it close enough to limit disruption.

Note that this should really never happen because although it's
limited, the tuning range should be good enough to absorb any
reasonable temperature / aging variation once we have coarse tuned.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I2d9d348f5466f581b3d6d36c98847c47e2452f98
2022-04-22 10:37:58 +02:00
Sylvain Munaut 8598d48675 icE1usb fw/gpsdo: Attempt to recover from bad tuning
If we're in hold over mode and getting a bunch of invalid
frequency measurement despite a good fix, then we most likely
ended up on a bad tuning value and we need to recover by starting
from scratch.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: If8503a3eaf695e02a0ef0a3b6536de985d247c20
2022-04-22 10:35:53 +02:00
Sylvain Munaut 103a83cbdc icE1usb fw/gpsdo: Add debug prints for coarse/fine tune entry
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ife69f9ce4c6f3eb6d40b05ce8f862ff68180357f
2022-04-21 23:28:35 +02:00
Sylvain Munaut 8014c3cd09 icE1usb fw/gpsdo: Never use invalid measurements to feed loop
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I9c7b81c6e2e600ed49ac766fa33df23747dd339e
2022-04-21 23:27:57 +02:00
Sylvain Munaut 28eb5d1b96 icE1usb fw/gpsdo: Fix typo in the condition to exit TUNE_FINE
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6106f07f7bff1c298ac3f86164e155d4bfb1b7ac
2022-04-21 23:26:59 +02:00
Harald Welte cac342af6b icE1usb: Move GPS-DO USB control to separate USB interface
doing so significantly simplifies the development of a Linux kernel
driver, as the GPS-DO only exists once (not twice, like the per-E1-line
interface), and Linux kernel USB drivers typically are for an interface.

There is an option to write a usb_device_driver, but doing so will
exclude the per-interface drivers from still being probed in their usual
fashion.

While we introduce this new USB Interface for the GPS-DO, we also
move the related control endpoint requests from the device level to the
interface level.

Finally, some naming inconsistency between "enum
ice1usb_gpsdo_antenna_state" vs. the member name antenna_status is
resolved.

Change-Id: Icd6555a14896c38626fb147b78af44ff719f2254
2022-02-01 17:57:12 +01:00
Sylvain Munaut c308334de7 icE1usb fw: Add USB control for the GPSDO function
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: If92aa68d8a49349fa0d6d556eec81bbb80be989c
2022-01-13 13:21:29 +01:00
Sylvain Munaut e76b643298 icE1usb fw: Add GPSDO VCXO trimming loop
Rather basic and not super well tested, use with caution

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I5f9ce6621492be967d6a44d31f270e107f3ef686
2022-01-13 13:21:29 +01:00