Shaykh Salih al-Fawzan states that charging a phone in the masjid is allowed only if the mosque authorities permit it. If they prohibit it, then it is not allowed. It is a minor matter but must follow the rules set by the masjid.
The majority of the questions ask, is it permissible to charge the mobile in the masjid, specifically in Masjid al-Haram?
If those responsible over the masjid prohibit charging the mobile, then it is not allowed. However, if they do not prohibit it, then there is no problem in doing so and it is something little which doesn’t cost anything. However if the people responsible do not allow it, then do not charge the mobile in the masjid.