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

[media] af9013: add configurable TS output pin

On serial TS mode output pin could be selected from D0 or D7.
Add configuration option to for it.

Rename TS mode config option prefix from AF9013_TS_ to AF9013_TS_MODE_.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Antti Palosaari and committed by
Mauro Carvalho Chehab
eaa455f0 e94db976

+16 -13
+14 -13
drivers/media/dvb-frontends/af9013.c
··· 28 28 u8 tuner; 29 29 u32 if_frequency; 30 30 u8 ts_mode; 31 + u8 ts_output_pin; 31 32 bool spec_inv; 32 33 u8 api_version[4]; 33 34 u8 gpio[4]; ··· 957 956 goto err; 958 957 959 958 /* settings for mp2if */ 960 - if (state->ts_mode == AF9013_TS_USB) { 959 + if (state->ts_mode == AF9013_TS_MODE_USB) { 961 960 /* AF9015 split PSB to 1.5k + 0.5k */ 962 961 ret = regmap_update_bits(state->regmap, 0xd50b, 0x04, 0x04); 963 962 if (ret) 964 963 goto err; 965 964 } else { 966 - /* AF9013 change the output bit to data7 */ 967 - ret = regmap_update_bits(state->regmap, 0xd500, 0x08, 0x08); 968 - if (ret) 969 - goto err; 970 - 971 965 /* AF9013 set mpeg to full speed */ 972 966 ret = regmap_update_bits(state->regmap, 0xd502, 0x10, 0x10); 973 967 if (ret) ··· 1043 1047 goto err; 1044 1048 } 1045 1049 1046 - /* TS mode */ 1047 - ret = regmap_update_bits(state->regmap, 0xd500, 0x06, 1048 - state->ts_mode << 1); 1050 + /* TS interface */ 1051 + if (state->ts_output_pin == 7) 1052 + utmp = 1 << 3 | state->ts_mode << 1; 1053 + else 1054 + utmp = 0 << 3 | state->ts_mode << 1; 1055 + ret = regmap_update_bits(state->regmap, 0xd500, 0x0e, utmp); 1049 1056 if (ret) 1050 1057 goto err; 1051 1058 ··· 1147 1148 if (state->i2c_gate_state == enable) 1148 1149 return 0; 1149 1150 1150 - if (state->ts_mode == AF9013_TS_USB) 1151 + if (state->ts_mode == AF9013_TS_MODE_USB) 1151 1152 ret = regmap_update_bits(state->regmap, 0xd417, 0x08, 1152 1153 enable << 3); 1153 1154 else ··· 1297 1298 pdata.tuner = config->tuner; 1298 1299 pdata.if_frequency = config->if_frequency; 1299 1300 pdata.ts_mode = config->ts_mode; 1301 + pdata.ts_output_pin = 7; 1300 1302 pdata.spec_inv = config->spec_inv; 1301 1303 memcpy(&pdata.api_version, config->api_version, sizeof(pdata.api_version)); 1302 1304 memcpy(&pdata.gpio, config->gpio, sizeof(pdata.gpio)); ··· 1451 1451 u8 *val = &((u8 *)data)[2]; 1452 1452 const unsigned int len = count - 2; 1453 1453 1454 - if (state->ts_mode == AF9013_TS_USB && (reg & 0xff00) != 0xae00) { 1454 + if (state->ts_mode == AF9013_TS_MODE_USB && (reg & 0xff00) != 0xae00) { 1455 1455 cmd = 0 << 7|0 << 6|(len - 1) << 2|1 << 1|1 << 0; 1456 1456 ret = af9013_wregs(client, cmd, reg, val, len); 1457 1457 if (ret) ··· 1488 1488 u8 *val = &((u8 *)val_buf)[0]; 1489 1489 const unsigned int len = val_size; 1490 1490 1491 - if (state->ts_mode == AF9013_TS_USB && (reg & 0xff00) != 0xae00) { 1491 + if (state->ts_mode == AF9013_TS_MODE_USB && (reg & 0xff00) != 0xae00) { 1492 1492 cmd = 0 << 7|0 << 6|(len - 1) << 2|1 << 1|0 << 0; 1493 1493 ret = af9013_rregs(client, cmd, reg, val_buf, len); 1494 1494 if (ret) ··· 1538 1538 state->tuner = pdata->tuner; 1539 1539 state->if_frequency = pdata->if_frequency; 1540 1540 state->ts_mode = pdata->ts_mode; 1541 + state->ts_output_pin = pdata->ts_output_pin; 1541 1542 state->spec_inv = pdata->spec_inv; 1542 1543 memcpy(&state->api_version, pdata->api_version, sizeof(state->api_version)); 1543 1544 memcpy(&state->gpio, pdata->gpio, sizeof(state->gpio)); ··· 1551 1550 } 1552 1551 1553 1552 /* Download firmware */ 1554 - if (state->ts_mode != AF9013_TS_USB) { 1553 + if (state->ts_mode != AF9013_TS_MODE_USB) { 1555 1554 ret = af9013_download_firmware(state); 1556 1555 if (ret) 1557 1556 goto err_regmap_exit;
+2
drivers/media/dvb-frontends/af9013.h
··· 33 33 * @tuner: Used tuner model. 34 34 * @if_frequency: IF frequency. 35 35 * @ts_mode: TS mode. 36 + * @ts_output_pin: TS output pin. 36 37 * @spec_inv: Input spectrum inverted. 37 38 * @api_version: Firmware API version. 38 39 * @gpio: GPIOs. ··· 63 62 #define AF9013_TS_MODE_PARALLEL 1 64 63 #define AF9013_TS_MODE_SERIAL 2 65 64 u8 ts_mode; 65 + u8 ts_output_pin; 66 66 bool spec_inv; 67 67 u8 api_version[4]; 68 68 #define AF9013_GPIO_ON (1 << 0)