I'd put this as a comment, but don't have enough rep...anyway, as this answer and the comments within state, the equation of state isn't necessarily linear. One thing I'd add is that one can define $w$ to be the ratio $\frac{P}{\rho}$ (as it's dimensionless), and since in general both pressure and density depend on time (no $\vec x$ dependence is allowed in a perfect FRW universe), then $w$ will be time dependent as well, hence the equation of state would be non-linear. An example of this would be a scalar field $\phi(t)$ with $w=\frac{\frac{1}{2}\dot\phi^2-V(\phi)}{\frac{1}{2}\dot\phi^2+V(\phi)}$, which is derivable from the energy-momentum tensor, and you can see that the ratio is time dependant as the scalar field evolves with the equations of motion. I suppose you could imagine some other kind of field (spinor, vector etc.), but I'm not sure if it would be compatible with the symmetries of the FRW metric.