Defect physics of ternary chalcopyrite semiconductors