Could be anything from software, to OS, to hardware.
Have you tried starting you phone in Safe mode? You might do that to see if a 3rd party app is causing the issue. If the camera works in safe mode, then you'll have to isolate the problem app. If the camera still doesn't work in safe mode, then you might want to back up all your data and then do a factory reset (kind of drastic). If a factory reset doesn't fix it, then it could be a corrupted OS, which means you might have to get the OS reflashed (be sure to back up your data here too as reflashing may wipe the phone). If all of that doesn't work, then it might be the camera module itself isn't working, in which case you'll need to take it to a repair shop.