Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dvb-frontend/mxl5xx: add support for physical layer scrambling

The MaxLinear MxL5xx has support for physical layer scrambling, which was
recently added to the DVB core via the new scrambling_sequence_index
property. Add required bits to the mxl5xx driver.

Picked up from dddvb master, commit 5c032058b9ba ("add support for PLS")
by Ralph Metzler <rjkm@metzlerbros.de>, adapted to the different naming
of the pls property (pls vs. scrambling_sequence_index).

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Daniel Scheller and committed by
Mauro Carvalho Chehab
62474660 76bf7087

+33 -1
+33 -1
drivers/media/dvb-frontends/mxl5xx.c
··· 380 380 return DVBFE_ALGO_HW; 381 381 } 382 382 383 + static u32 gold2root(u32 gold) 384 + { 385 + u32 x, g, tmp = gold; 386 + 387 + if (tmp >= 0x3ffff) 388 + tmp = 0; 389 + for (g = 0, x = 1; g < tmp; g++) 390 + x = (((x ^ (x >> 7)) & 1) << 17) | (x >> 1); 391 + return x; 392 + } 393 + 394 + static int cfg_scrambler(struct mxl *state, u32 gold) 395 + { 396 + u32 root; 397 + u8 buf[26] = { 398 + MXL_HYDRA_PLID_CMD_WRITE, 24, 399 + 0, MXL_HYDRA_DEMOD_SCRAMBLE_CODE_CMD, 0, 0, 400 + state->demod, 0, 0, 0, 401 + 0, 0, 0, 0, 0, 0, 0, 0, 402 + 0, 0, 0, 0, 1, 0, 0, 0, 403 + }; 404 + 405 + root = gold2root(gold); 406 + 407 + buf[25] = (root >> 24) & 0xff; 408 + buf[24] = (root >> 16) & 0xff; 409 + buf[23] = (root >> 8) & 0xff; 410 + buf[22] = root & 0xff; 411 + 412 + return send_command(state, sizeof(buf), buf); 413 + } 414 + 383 415 static int cfg_demod_abort_tune(struct mxl *state) 384 416 { 385 417 struct MXL_HYDRA_DEMOD_ABORT_TUNE_T abort_tune_cmd; ··· 469 437 demod_chan_cfg.roll_off = MXL_HYDRA_ROLLOFF_AUTO; 470 438 demod_chan_cfg.modulation_scheme = MXL_HYDRA_MOD_AUTO; 471 439 demod_chan_cfg.pilots = MXL_HYDRA_PILOTS_AUTO; 472 - /* cfg_scrambler(state); */ 440 + cfg_scrambler(state, p->scrambling_sequence_index); 473 441 break; 474 442 default: 475 443 return -EINVAL;