Cal. Penal Code § 2670.5
(a) No person confined or detained under Title 1 (commencing with Section 2000) and Title 2 (commencing with Section 3200) shall be administered or subjected to any organic therapy as defined in subdivision (c) without his or her informed consent, provided that:
(c) The term organic therapy refers to:
(d) A person does not waive his or her right to refuse any organic therapy by having previously given his or her informed consent to the therapy, and the person may withdraw his or her consent at any time.
If required by sound medical-psychiatric practice, the attending physician shall, after the person withdraws his or her previously given informed consent, gradually phase the person out of the therapy if sudden cessation would create a serious risk of mental or physical harm to the person.