US CBP definitely can ask for your passcode/passwords. There was a post on HN last week about a guy who refused to turn over his passcode: https://vc.gg/blog/so-its-been-a-while.html
Yes, the US can ask for you password, but they can't require you to give up your password. If you don't give your password, they confiscate your device. In Canada, if you don't give your password they can charge you with a crime and you can spend up to a year in jail.