It sounds like he has an ear infection. This may be due to bacteria, yeast, or ear mites. Have him examined by a veterinarian. An ear cytology will be done to determine the problem and then appropriate treatment can be started.
You need to see a vet as it needs a good clean out and a possible antibiotic and other treatment. Your dog will be very uncomfortable with this condition.
My setter-doodle has red swollen areas with rash & weeping some smell.
It could also be blood where your dog ws scratching his eae. You need to clean it and gently pull the hair out of his ears. Call your dr for meds and appointment