Sorkin, 39, was arrested by airport police on April 15 after security officers at Burbank Airport found a small bag suspected of containing drugs in his carry-on luggage.
Prosecutors charged him with two felony counts of possession for the mushrooms and cocaine. He was also charged with one misdemeanor count for marijuana.
District attorney's spokeswoman Sandi Gibbons said a conviction on either of the felony drug counts could mean a three-year prison term for Sorkin.
Officers initially found just mushrooms and marijuana in Sorkin's luggage, but testing revealed there was cocaine as well, Gibbons said.
Scheduled for arraignment on Wednesday, he is currently free on $10,000 bail.
Sorkin, who has acknowledged seeking treatment for cocaine addiction, wrote the Broadway and film versions of the military drama "A Few Good Men." He also wrote the screenplay for "The American President."
"The West Wing," starring Martin Sheen as the president, won a record nine Emmys last year. Sorkin received one for best writing.
Shortly after his arrest Sorkin released a statement saying he was "prepared to proceed as directed by my attorney and in the best interests of my family."
© MMI Viacom Internet Services Inc. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press and Reuters Limited and contributed to this report