The electrones which are generated from splitting water are later used to split CO2.
The general formula is:
The Photosystem II does the first part of the reaction by splitting up water and transferring electrons to plastoquinone and also by generating H+ ions. Water gets oxidized (spends electrons) in this reaction, CO2 in the end is reduced (receives electrons). 4 photons are needed for splitting 1 water molecule and 8 photons to liberate one molecule of oxygen. For green plants the energy for this reaction comes completely from light. In the process the energy of the electrons is also used to generate ATP, not to use it.
A more detailed view can be found in the schematic diagram "Z-scheme" in the Wikipedia page on photosynthesis:
The figure shows the flow of the electrons and the points when they are brought to higher energy levels by light. The energy of the light is then converted in a proton gradient which is then used to generate ATP.
Its also possible to exchange the role of the oxygen with sulphur, the energy source is then usually heat. This is done by sulphur reducing bacteria in the deep sea in the vicinity of black smokers.