Let $p$ and $q$ be integers. Let $S$ be a subset of $\mathbb{Z}$, and $f:S\to S$. Consider the functional equation of the form $$f\big(f(n)\big)=-(q-p)\,f(n)+pq\,n\text{ for each }n\in S\,.\tag{*}$$ If $p$ and $q$ satisfy $0<p<q$, and $S=\mathbb{Z}_{\geq 0}$ or $S=\mathbb{Z}_{>0}$, then the only solution is known to be $$f(n)=pn\text{ for all }n\in S\,.$$ See here and here for references.
The case of my particular interest is when $S=\mathbb{Z}$. We know that there are at least two solutions: $$f(n)=pn\text{ for all }n\in\mathbb{Z}$$ and $$f(n)=-qn\text{ for all }n\in\mathbb{Z}\,.$$
Are there other solutions when $S=\mathbb{Z}$?
What happens if $p<q$ does not hold (but they are still positive integers)? What can happen if we simply allow $p$ and $q$ to be any integer? How would these changes affect the cases $S=\mathbb{Z}_{\geq 0}$, $S=\mathbb{Z}_{>0}$, and $S=\mathbb{Z}$? (For example, when $p=1$ and $q=-1$, then there can be other solutions such as $f(n)=n+1$ for all $n\in S$.)
If you feel particularly enthusiastic today, then you can also consider the case where $p$ and $q$ are nonintegral, not necessarily real, algebraic integers such that $q-p$ and $pq$ are both integers. In this version of the problem (except for a few pairs $(p,q)$), I do not expect a solution in any of the cases $S=\mathbb{Z}_{\geq 0}$, $S=\mathbb{Z}_{>0}$, and $S=\mathbb{Z}$.
The trivial case $p=q=0$ is completely solved. Other known trivial cases are $p=q=1$ and $p=q=\sqrt{-1}$. However, I do not know other results even when $p=q$.
Here is a nontrivial example for a nonintegral pair $(p,q)$. When $S=\mathbb{Z}_{\geq0}$ or $S=\mathbb{Z}_{>0}$, there exists a strictly increasing function $f:S\to S$ such that $$f\big(f(n)\big)=3n\text{ for all }n\in S\,.$$ (This is an example when $p=q=\sqrt{3}$.)
This may be (or may not be) helpful. Here, $f^0:=\text{id}_S$ and $$f^k:=f\circ f^{k-1}$$ for $k\in\mathbb{Z}_{\geq 1}$. If $p+q\neq 0$, then $$f^k(n)=p^k\,\left(\frac{qn+f(n)}{p+q}\right)+(-q)^k\,\left(\frac{pn-f(n)}{p+q}\right)$$ for all $n\in S$ and $k\in\mathbb{Z}_{\geq 0}$. On the other hand, if $q=-p$ and $p\neq 0$, $$f^{k}(n)=p^k\,n+k\,p^{k-1}\,\big(f(n)-pn\big)$$ for all $n\in S$ and $k\in\mathbb{Z}_{\geq 0}$.
Here is another solution: $p=2,q=3,f(n)=\begin{cases} 2n \text{ if } n \text{ is even}\\ -3n\text{ if } n \text{ is odd}\end{cases}$
Use the technique from your first link, it can be shown that all solutions to the functional equation are of the form $f(n)=\begin{cases} pn \text{ if } n\in T\\ -qn\text{ if } n\in \mathbb{Z}\setminus T \end{cases}$
Write $f(f(…(n)..)$ as $f^k(n)$. Then $f^k(n)=-(q-p)f^{k-1}(n)+pqf^{k-2}n$. This is a linear recurrence equation and standard techniques yield a solution of the form $f^k(n)=A(n)p^kn+B(n)(-q)^kn$. Substituting back into the original functional equation tells us that $A+B=1+2AB$. The only integer solutions are $A=1,B=0$ and $A=0,B=1$.