dont worry, i too had the same problem in my nexus, i send it to service center. they have no idea. but i found a solution bellow,
shave a pencil lead and pour that into the headphone jack. after that plug in and plug out headphone 2-3 times slowly. phone will be get out from headphone mode...