Didn't it used to be that Grammar schools offered O-levels and the Secondary Modern schools didn't really do qualifications
It was never as clear cut as that.
I went to a grammar, and we sat mainly O levels, but in maths and French (setted subjects) the top 2 sets were O level and the lower 2 were CSE. Everyone did O levels for English and for some options such as history and geography, but there were CSEs for some in sciences (everyone had to do at least one).
This was before coursework was part of the assessment - so the maximum number anyone took was 9, up from the 8 when my older siblings did theirs on the old 1-9 scale.
The local secondary mods varied - one had levels of O levels not too different to the grammars but pupils might sit fewer (6-8) the more typical ones had O levels for top sets in some subjects , one was nearly all CSE.
Before CSEs many secondary mod pupils left with no qualifications at all.
Some exam syllabuses were aligned, so it was possible to teach a similar course and decide only later on which exam. Others not so - the O level maths I did included calculus, and was streets away from the CSE.