Calculations of electronic structures and optical properties of Mg (or Si) and Mn co-doped GaN were carried out by means of first-principle plane-wave pesudopotential (PWP) based on density functional theory. The spin polarized impurity bands of deep energy levels were found for both systems. They are half metallic and suitable for spin injectors. Compared with GaN:Mn,GaN:Mn-Mg exhibits a significant increase in TC,while the 1.3eV absorption peak in GaN:Mn disappears due to addition of Mg. In addition,a strong absorption peak due to 4T1(F)→4T2(F) transition of Mn4+ were observed near 1.1eV. Nevertheless,GaN:Mn-Si failed to show increase of TC,and the absorption peak was not observed at the low energy side.