If you give the ship your passport then immigration at each port can clear the ship as a whole (not the US). If not, you may be awakened at 5:00 am to produce your passport. When we got to San Diego we were each required to collect our passports and appear before immigration. Not sure about non US citizens as they were in another room. Since we disembarked the next day, we just all kept our passports until LA.
I hope to post one last report on our trip and I'll tell you a little about immigration and customs in the US. IT is tight these days.