I'll muse on these if you'll remember my musings are just personal ramblings:
Locked away in a mental institution. Locked away from society, but not necessarily in a prison situation, although I can also see Locked away in a tower, so I get the sense of physical remoteness.
Locked up in a prison. They locked you up and threw away the key. You're likely in prison under the guard of some level of government. Although, you've also got He kept his coin collection locked up in a drawer. Meaning safe and secure, like Locked up tight.
Locked in a closet. Physically inside something, so you could also use it above, He kept his coin collection locked in a drawer, although locked up does give you that safety and security feeling I mentioned.
Sometimes I think there's no hope for learning prepositions except to grow up with them and absorb them osmotically. And I have no doubt there are not only other opinions on this but also other words to be used with locked...
Locked inside (liked locked in) Locked down (prison, in your cell 24 hours a day, no workouts in the yard) Locked out (of the house or car) Locked on (a terrier's teeth on my ankle) Locked off (sealed off from access)
I feel that "locked away" may be your best choice. If the reference is to his mental instability, you are referring to a person who is locked in his mind with an emotional distance from others around him.
He is "locked in" to some degree as well, but there is an actual "locked in syndrome" which puts people into a totally unresponsive state (they appear near brain-dead) and so it implies a different kind of imprisonment than the artist who painted through his illness.
"Locked up" is usually done to a person or object by an outside force. "They locked up the criminals," and "A gun that is not locked up is dangerous in a home" are two examples.