It is possible that the ear speaker was damaged. It could also be misaligned with the contacts on the proximity flex. This has happened to me a handful of times and sometimes replacing the ear speaker fixes it. Assuming that it has no water damage.
Try these first:
-Take screen off and look at the top where the contacts meet the gold springs of the ear speaker. Sometimes if your eyes are good enough you can see if they are making good connection and have no corrosion present.
-You can try to loosen the screws of the metal ear speaker plate just a little bit and try the ear speaker (this happened all the time on the iPhone 5) without actually putting the screen back in the housing. Of course be very careful not to over extend the screen flexes.
-If none of that works source a new ear speaker and install.
-If that doesn't work then it could be a prox flex-but i feel it is one of the above answers.