This invention relates to novel sulfinylphenyl or sulfonimidoylphenyl benzazepine compounds of the formula (I) wherein X and R1 to R6 are as defined in the description and in the claims, as well as pharmaceutically acceptable salts thereof. These compounds are TLR agonists and may therefore be useful as medicaments for the treatment of diseases such as cancer, autoimmune diseases, inflammation, sepsis, allergy, asthma, graft rejection, graft-versus-host disease, immunodeficiencies, and infectious diseases.