22. Given the function $f(x)=\ln (a x+1)+\frac{1-x}{1+x}, x \geqslant 0, a>0$.
(1) If $f(x)$ attains an extremum at $x=1$, find the value of $a$;
(2) If $f(x) \geqslant \ln 2$ always holds, find the range of values for $a$.
(1) $f^{\prime}(x)=\frac{a}{a x+1}-\frac{2}{(x+1)^{2}}$, if $f^{\prime}(1)=\frac{a}{a+1}-\frac{1}{2}=0 \Rightarrow a=1$.

When $a=1$, $f^{\prime}(x)=\frac{1}{x+1}-\frac{2}{(x+1)^{2}}=\frac{x-1}{(x+1)^{2}}$
$\Rightarrow f(x)$ is monotonically decreasing on $(0,1)$ and monotonically increasing on $(1,+\infty)$, so $f(x)$ attains a local minimum at $x=1$. In summary, the value of $a$ is 1.
(2) $f^{\prime}(x)=\frac{a(x+1)^{2}-2(a x+1)}{(a x+1)(x+1)^{2}}=\frac{a x^{2}-(2-a)}{(a x+1)(x+1)^{2}}$.
(1) When $a \geqslant 2$, $f(x)$ is monotonically increasing, then $f(x) \geqslant f(0)=1$, satisfying the condition;
(2) When $0<a<2$, $f(x)$ is monotonically decreasing on $\left(0, \sqrt{\frac{2-a}{a}}\right)$ and monotonically increasing on $\left(\sqrt{\frac{2-a}{a}},+\infty\right)$,

then $f(x)_{\text {min }}=f\left(\sqrt{\frac{2-a}{a}}\right)$. Let $t=\sqrt{\frac{2-a}{a}} \Rightarrow a=\frac{2}{t^{2}+1}$, where $t \in(0,+\infty)$,
thus $f(t)=\ln \left(\frac{2 t}{t^{2}+1}+1\right)+\frac{1-t}{1+t}=\ln \frac{(t+1)^{2}}{t^{2}+1}+\frac{2}{t+1}-1$.
Let $g(t)=\ln \frac{(t+1)^{2}}{t^{2}+1}+\frac{2}{t+1}-1, g^{\prime}(t)=\frac{t^{2}+1}{(t+1)^{2}} \cdot \frac{2-2 t^{2}}{\left(t^{2}+1\right)^{2}}-\frac{2}{(t+1)^{2}}=\frac{-4 t^{2}}{(t+1)^{2}\left(t^{2}+1\right)}<0$ $\Rightarrow g(t)$ is monotonically decreasing, and $g(1)=\ln 2$, thus $g(t) \geqslant \ln 2 \Rightarrow 0<t \leqslant 1 \Rightarrow \frac{2}{a}-1 \leqslant 1 \Rightarrow 1 \leqslant a<2$. In summary, the range of $a$ is $[1,+\infty)$.