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

[media] cx24117: Fix LNB set_voltage function

This patch should fix/enhance the set_voltage function for
the cx24117 demodulator.

Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Luis Alves and committed by
Mauro Carvalho Chehab
71b6aaaf 9fa7c419

+18 -15
+18 -15
drivers/media/dvb-frontends/cx24117.c
··· 917 917 voltage == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" : 918 918 "SEC_VOLTAGE_OFF"); 919 919 920 - /* Set GPIO direction */ 921 - cmd.args[0] = CMD_SET_GPIODIR; 922 - cmd.args[1] = reg; 923 - cmd.args[2] = reg; 920 + /* Prepare a set GPIO logic level CMD */ 921 + cmd.args[0] = CMD_SET_GPIOOUT; 922 + cmd.args[2] = reg; /* mask */ 924 923 cmd.len = 3; 925 - ret = cx24117_cmd_execute(fe, &cmd); 926 - if (ret) 927 - return ret; 928 924 929 925 if ((voltage == SEC_VOLTAGE_13) || 930 926 (voltage == SEC_VOLTAGE_18)) { 931 - /* Set GPIO logic level */ 932 - cmd.args[0] = CMD_SET_GPIOOUT; 927 + /* power on LNB */ 933 928 cmd.args[1] = reg; 934 - cmd.args[2] = reg; 935 - cmd.len = 3; 936 929 ret = cx24117_cmd_execute(fe, &cmd); 937 930 if (ret != 0) 938 931 return ret; ··· 942 949 cmd.args[1] = state->demod ? 0 : 1; 943 950 cmd.args[2] = (voltage == SEC_VOLTAGE_18 ? 0x01 : 0x00); 944 951 cmd.len = 3; 952 + ret = cx24117_cmd_execute(fe, &cmd); 945 953 946 954 /* Min delay time before DiSEqC send */ 947 955 msleep(20); 948 956 } else { 949 - cmd.args[0] = CMD_SET_GPIOOUT; 957 + /* power off LNB */ 950 958 cmd.args[1] = 0x00; 951 - cmd.args[2] = reg; 952 - cmd.len = 3; 959 + ret = cx24117_cmd_execute(fe, &cmd); 953 960 } 954 961 955 - return cx24117_cmd_execute(fe, &cmd); 962 + return ret; 956 963 } 957 964 958 965 static int cx24117_set_tone(struct dvb_frontend *fe, ··· 1268 1275 cmd.args[0] = CMD_ENABLERSCORR; 1269 1276 cmd.args[1] = (state->demod ? 1 : 0); 1270 1277 cmd.args[2] = CX24117_OCC; 1278 + cmd.len = 3; 1279 + ret = cx24117_cmd_execute_nolock(fe, &cmd); 1280 + if (ret != 0) 1281 + goto exit; 1282 + 1283 + /* Set GPIO direction */ 1284 + /* Set as output - controls LNB power on/off */ 1285 + cmd.args[0] = CMD_SET_GPIODIR; 1286 + cmd.args[1] = 0x30; 1287 + cmd.args[2] = 0x30; 1271 1288 cmd.len = 3; 1272 1289 ret = cx24117_cmd_execute_nolock(fe, &cmd); 1273 1290