Sound speed in cosmology: non-adiabatic perturbations The definition of sound speed is given by:
$$c_{s}^{2}\equiv \frac{\partial P}{\partial \rho}.$$
In some books of cosmology to calculate the expresion for the sound speed in a baryon-photon fluid they assume adiabatic perturbations.
After of some manipulation they arrive to
$$c_{s}^{2}= \frac{c^{2}}{3}(1+\rho_{B}/\rho_{\gamma})^{-1}.\tag{1}$$
What happend if you don't have adiabatic peturbations, then the equation  (1) is not true?
What can you do when you don't have adiabatic perturbations?
 A: In cosmology, the perturbations are usually treated as adiabatic or isothermal, and the real case is usually a combination of the two. Note that your definition of $c_s$ isn't precisely correct: as you can see, the speed of sound is defined as $c_s^2=\left(\frac{\partial P}{\partial\rho}\right)_S$, and that little S is important. It means "measured at constant entropy", so you're fine in the adiabatic case but not elsewhere. In the case of isothermal perturbations, you can't work out the speed of sound from that formula, because the radiation and the matter components of the universe aren't "bound": the baryon density evolves on a uniform photon background, and the so-called Meszaros Effect takes place. It says that the density contrast is constant for isothermal perturbations before $t_{eq}$. The idea is fairly simple:
Compare $\tau_{c}$ (timescale of free fall, or collapse) with $\tau_e=1/H$ (timescale of the expansion of the universe). They both depend on $(G\rho)^{-\frac{1}{2}}$, but in
$\tau_{c}$ you need to consider the driving density for collapse, while in $\tau_{e}$ the driving density for expansion. Now, in the adiabatic case, both $\tau_{c}$ and $\tau_{e}$ depended on the same $\rho$, namely $\rho_r$ before the equivalence, and $\rho_m$ after. In the isothermal case, while $\tau_e$ still depends on $\rho_r$/$\rho_m$ depending on the cosmic era, $\tau_c$ always depends on $\rho_m$, in any cosmic era. Therefore for isothermal perturbations pre-equivalence
$\frac{\tau_c}{\tau_e}\sim\sqrt{\frac{\rho_r}{\rho_m}}\ll1$
and the perturbations just don't have the time to collapse.
