Trust me, the camera unit is damaged. It needs to be replaced. It's module 54H00624-00M. You can get replacements from eBay or other camera repairers.
How did this happen? It could have been due to heat (do you use your phone as a dash-cam camera?) or a knock. The problem is the senso-motor inside the camera module cannot focus because the internal magnets that control and "fix" the camera focus lens in place have become too weak. As you may now, from basic school science, heat destroys magnets!
So guess what? The only solution (temporary as it will annoy you, as it did to me), is to use ANOTHER magnet to counter-act the effects of the internal camera magnets. And yes, it does work.
You need to find a small silver (not black magnets as I've tested them and they are too weak) button-like magnet and very carefully file it down to about 2mm wide and 3mm length-wise. It's a pain but it can be done. The thickness of the magnet is "ok" but you may want to file this down by half as well. You will end up with a very small grain of sand effectively. Use a friend's magnifier and holders under light, and a fine file (not emory paper, as you will loose the magnet), and file that little sucker down to about half or better, a quarter it's original size.
Now the test!
Pick up the magnet using tweezers and some sticky substance, like BlueTak or even glue and hold it about 7 to 8 o'clock along the outer edge of the rear camera. Open your camera app and test the focus.
You will hear buzzing sounds, and the camera motor trying to focus automatically.
Move the magnet gently around the outside perimeter of the camera lens (there is like a raised groove to help you not scratch the lens cover itself!) and you will suddenly see the camera auto focuses correctly, without any buzzing sounds.
Take a photo!
Test and try again and again until you are confident of where the best location of the magnet is meant to go.
Once you have it, drop a TINY drop of super-glue on the magnet's rear and carefully hold it where you had the camera focus correctly.
Patience, trial and error, you will get it and boom - your phone and camera are all working again!
Enjoy