Unless corrected, where ever there is doubt as to what happened, I will presume innocence on the part of the suspect, unless that detail was not disclosed and meant to be included.
Suspect is pulled over for speeding. He has no outstanding warrant for his arrest in any crime and is not currently serving time for a crime. This is legal.
The suspect's cell phone is in plain view of the officer when he approaches the suspect. As there is no evidence of contraband otherwise, the officer has no need to look at the cellphone.
The police officer performs a warrentless search of the car without the suspect's approval. He has no probable cause to do this. The suspect has not given permission to do this. From here on out, the officer is no performing an illegal search and seizure of evidence against the suspect.
The officer finds the illegal fire arm under the suspects seat, which is not in plane view. The nature of why the fire arm is illegal is not applicable at this point. Possession of this evidence is probable cause to arrest the suspect.
The officer continues the search of the car and siezes it and its contents for evidence processing.
The phone is now evidence and is unlocked against the suspect's will and cataloged for any further evidence of possible crimes.
The case relies on the information in parts 3 and 4 being true. If this is not the case, the an illegal search was performed. First, there was nothing in plain view that would lead the officer to suspect that there was any contraband or criminal evidence within the car (the gun was fully concealed from view of the officer as he was giving the ticket to the suspect). If he did not receive affirmative permission from the suspect, the gun would thus be a product of an illegal search, and thus would be removed from evidence in pre-trial motions.
Now, I know what you're thinking: But I'm asking about the phone, not the gun. Not only is the gun gone, but any evidence that was discovered by the gun is now a product of an illegal search and seizure. The phone is what's called "Fruit of the Poisonous Tree" and is just as dirty evidence against the suspect as the gun was. As is any evidence of a crime found on the phone. So yes, the digital contents search is illegal, but not because of the ruling on it being digital contents but because the reason for it's seizure was because the illegal search took place to get the suspect arrested and find probable cause to seize the phone.
Now, this all assumes that the suspect didn't meet a few criteria... if he was a paroled convict of another crime OR on probation for another crime, the officer may have probable cause to perform the search, even if the weapon wasn't in plain view.
Additionally, for argument's sake, lets say that the suspect was speeding because he had just shot someone with the illegal gun and the police were aware of his connection to the crime in some way, because the last text to the deceased was from this guy and it asked the deceased to meet at the spot the body was found. This means that the cops would at the least be looking for him for questioning, if not already filing a warrant for the contents of his cellphone and possible search of his property for evidence. The cops could argue that they were already looking to for this guy in connection to the crime and they were looking for the phone and evidence on the phone would provide probable cause to search his property and would have found the gun that way. Because they were already looking for these specific items on this specific person, they could established discovery of them would have happened during the course of due process of the law and then the items would be back in play.
Given your story, it's likely that all evidence of the gun charge would be tossed out as valid to your case, and without evidence of a crime, the suspect will go free. The gun will not be returned as he cannot lawfully posses it, but his phone would be returned and all date the police took from it would be destroyed.
If you would like to change the circumstances of the situation, give me a heads up.