I had scalp inflammation for several years. Nothing really helped. Then I got an ear infection from swimming. My doctor prescribed 875 mg amoxicillin twice per day to kill the ear infection. It also completely resolved my scalp problem. So for me it was bacterial. This is a safe and easy fix to try. It will either work or not.
About 40 days later I noticed it coming back. Now I use Jason's tea tree shampoo (Walgreens) and occasionally mix tea tree oil (Walmart) in some regular shampoo and it is keeping it under control.