Plants use sunlight to supply energy to produce complex organic molecules from carbon dioxide. Some plants are buried and decomposed to make fossil fuels which are sources of this stored solar energy. Animals use these organic molecules for food to produced the energy needed for living and working. see about the carbon cycle.
Ecologists approach this topic to predict effects of burning fossil fuels. The balance of carbon dioxide in the atmosphere is critical.
Thermodynamics of photosynthesis and animal repiration are discussed in relation to the energy of the planet. An interesting view of using fuel cells to produce oxygen to balance the loss of plant life is made. Since burning fossil fuels is a major source of energy in our society, this cycle has been shifted. A proposal has been made to sequester some of the carbon dioxide produced by fossil fuels as carbonates to reduce the level of carbon dioxide in the atmosphere. The thermodynamics are favorable, but kinetics are slow.