There is no clear cut solution since we can be looking at either a software or hardware issue.
Software? Try a soft reset (if it was present in WP7) and then try erasing all data (after backing up of course)
If the problem persists, its a hardware problem.
Hardware issue? Options are service, replacement (recommended)