If your PS4 controller is legit, and you can be sure it is somewhat charged, try:
"If your PS4 controller won't connect, try a different USB cable, in case the original one has failed. You can also reset the PS4 controller by pressing the button on the back of the controller. If your controller still won't connect to your PS4, you might need to get support from Sony."
If not given that the symbols employed to enter the passcode, that you know, are only found on the controller, I think the only other plausible solution could be trying/buying another PS4 controller. Or if you are a gifted techie finding some way of hacking the input interface to allow the symbols to be entered using a wireless (or wired) keyboard that the PS4 recognises.
As an addendum to the above, if trying it in another USB port also fails then your console may have damaged or dirty USB connectors? Try cleaning them in that latter case. Don't give up! :)