Is Callen really being sloppy saying $\text{đ}Q=T\mathrm{d}S$ for *all* quasi-static processes? I am reading Callen's Thermodynamics and introduction to Thermostatics (second edition).
The textbook says in chapter 4-2 that $\text{đ}Q=T\mathrm{d}S$ always holds for quasi-static processes, reversible or irreversible:

The identification of - P dV as the mechanical work and of T dS as the
heat transfer is valid only for quasi-static processes.

This says nothing about irreversible processes, but later Callen applies the $\text{đ}Q=T\mathrm{d}S$ formula to the process of free heat exchange between systems of different temperatures, which is clearly irreversible, in equation (4.9) on page 105.
For the record, quasi-static means a slow succession of equilibrium states,
reversible means that the process can be conducted in a different direction and this is equivalent to the conservation of the total entropy of the closed system in question.
I also stumbled upon this stackexchange answer saying

The condition to write $\text{đ}Q=T\mathrm{d}S$ is that the process be reversible.
In general, we have $\text{đ}Q\le TdS$.
For a concrete example, consider two gases separated by an insulating piston with friction.
One can consider a quasi-static process where the piston slowly moves to the right.
Even an infinitesimal motion is not reversible, because heat is produced by friction.
The equality $\text{đ}Q=T\mathrm{d}S$ is violated, as $\mathrm{d}S>0$, while $\text{đ}Q=0$.

I assume here that there are two subsystems: (the wessel with the piston) and (the two gases).
Both $T\mathrm{d}S$ and $\text{đ}Q=0$ refer to the two gases, their entropy change and heat output.
This example kind of contradicts the Callen's approach.
So, I have the following questions:

*

*Why exactly is $\mathrm{d}S>0$ for the two gases in this example?

*Does Callen's approach really fail for this example?

*It sounds reasonable that processes involving friction are irreversible. Does Callen address this in his book at all?

 A: Understanding entropy change is much simpler than it seems from your description of Callen.  Here are the basics:

*

*Entropy is a physical (state) property of the material(s) comprising a system at thermodynamic equilibrium, and the entropy change between two thermodynamics equilibrium states of a system depends only on the two end states (and not on any specific process path between the two end states).


*For a closed system, there are only two ways that the entropy of the system can change:
(a) by heat flow across the system boundary with its surroundings at the temperature present at the boundary $T_B$; this is equal to the integral from the initial state to the final state of $dQ/T_B$ along whatever path is taken  between the two end states.
(b) by entropy generation within the system as a result of irreversibility; this is equal to the integral from the initial state to the final state of $d\sigma$ along whatever path is taken between the two end states, where $d\sigma$ is the differential amount of entropy generated along the path..


*Contribution (a) is present both for reversible and irreversible paths.  Contribution (b) is positive for irreversible paths and approaches zero for reversible paths.  For any arbitrary path between the two end states, the two contributions add linearly:  $$\Delta S=\int{\frac{dQ}{T_B}}+\sigma$$


*Determining the amount of entropy generation along an irreversible path is very complicated so, to determine the entropy change for a system between any initial and final thermodynamic equilibrium states, we are forced to choose only from the set of possible paths that are reversible in applying our equation. The reversible path we choose does not have to bear any resemblance to the actual path for the process of interest.  All reversible paths with give the same result, and will also provide the entropy change for any of the irreversible paths.
Armed only with these basics, one can determine the change in entropy  for a closed system experiencing any process, provided that application of the 1st law of thermodynamics is sufficient to establish the final thermodynamic equilibrium state.
