Sec. 2. (a) In all criminal cases the judge of the court in which the defendant is convicted shall give the defendant credit on the defendant's sentence for the time that the defendant has spent:
(1) in jail for the case, including confinement served as described by Article 46B.009 and excluding confinement served as a condition of community supervision, from the time of his arrest and confinement until his sentence by the trial court;
(2) in a substance abuse treatment facility operated by the Texas Department of Criminal Justice under Section 493.009, Government Code, or another court-ordered residential program or facility as a condition of deferred adjudication community supervision granted in the case if the defendant successfully completes the treatment program at that facility; or
(3) confined in a mental health facility or residential care facility as described by Article 46B.009.
(b) In all revocations of a suspension of the imposition of a sentence the judge shall enter the restitution due and owing on the date of the revocation.