提交 ccac68f9 编写于 作者: R Reinhard Nißl 提交者: Mauro Carvalho Chehab

[media] stb0899: sign extend raw CRL_FREQ value

Contrary to the chip's specs, the register's value is signed, so we
need to sign extend the value before using it in calculations like
when determining the offset frequency.
Signed-off-by: NReinhard Nißl <rnissl@gmx.de>
Signed-off-by: NMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 703e6065
...@@ -1487,6 +1487,10 @@ enum stb0899_status stb0899_dvbs2_algo(struct stb0899_state *state) ...@@ -1487,6 +1487,10 @@ enum stb0899_status stb0899_dvbs2_algo(struct stb0899_state *state)
/* Store signal parameters */ /* Store signal parameters */
offsetfreq = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_FREQ); offsetfreq = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_FREQ);
/* sign extend 30 bit value before using it in calculations */
if (offsetfreq & (1 << 29))
offsetfreq |= -1 << 30;
offsetfreq = offsetfreq / ((1 << 30) / 1000); offsetfreq = offsetfreq / ((1 << 30) / 1000);
offsetfreq *= (internal->master_clk / 1000000); offsetfreq *= (internal->master_clk / 1000000);
reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2); reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册