In my campaign I have a few different types of firearms. The run of the mill human type which is to impractical and expensive to use, and so no one does. Not once, ever in my campaign. Which is fine by me.
The next version I have is the dwarven masterwork firearm. These firearms are legendary. In fact, only six pistols remain intact in the known world. As it is, I have each one in the hands of a npc that I have fully detailed out statwise, history, etc. The only way to get one is to kill them or steal it, etc. No one has done that yet either.
The last ones are the gnomish ones, minorly magical, they would be great if there wasnt such a high chance of you hurting yourself. However, if you can get them to work, they have great abilities.
I like limited amounts of firearms in a d&d campaign.