Sunspot-cycle control of ionospheric and geomagnetic variations