Originally Posted by
neveron
The effects of cocaine weren't entirely understood in the late 1880s (hence, for instance, Coca Cola using coca leaves and cola nuts in 1886). While Dr. Watson helped him wean off the addiction in later books when Doyle (and the general public) learned that there were some issues with cocaine use, to quote The Adventure of the Missing Three-Quarter "[Watson] was well aware that the fiend was not dead, but sleeping".
But yeah, Holmes took to the violin and tobacco and seven-per-cent solution when he was bored out of his mind between cases. It's been a thing forever, although it's often left out of modern adaptations for obvious reasons. (I think I heard that Sherlock took some inspiration from it, though?)