All companions begin at an affinity value of 0. If the affinity value reaches 500, they will "admire" the Sole Survivor and often reveal new dialogue. Raising their affinity to 1000+ (max is 1100) will result in them "idolizing" the Sole Survivor, at which point the Sole Survivor is granted their companion perk.