aboutsummaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2017-06-13 20:32:15 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-06-20 10:24:54 -0300
commiteaa455f023c3ac62f99dcb0aed1bd3986b61f71e (patch)
tree7c37fa86cc25af61460626574f9a49106b35d59f /drivers/media
parente94db976b736d3cac6dc23021e2508de65190f54 (diff)
[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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb-frontends/af9013.c27
-rw-r--r--drivers/media/dvb-frontends/af9013.h2
2 files changed, 16 insertions, 13 deletions
diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c
index 2acd9fdd8b39..2b86688d73e0 100644
--- a/drivers/media/dvb-frontends/af9013.c
+++ b/drivers/media/dvb-frontends/af9013.c
@@ -28,6 +28,7 @@ struct af9013_state {
u8 tuner;
u32 if_frequency;
u8 ts_mode;
+ u8 ts_output_pin;
bool spec_inv;
u8 api_version[4];
u8 gpio[4];
@@ -956,17 +957,12 @@ static int af9013_init(struct dvb_frontend *fe)
goto err;
/* settings for mp2if */
- if (state->ts_mode == AF9013_TS_USB) {
+ if (state->ts_mode == AF9013_TS_MODE_USB) {
/* AF9015 split PSB to 1.5k + 0.5k */
ret = regmap_update_bits(state->regmap, 0xd50b, 0x04, 0x04);
if (ret)
goto err;
} else {
- /* AF9013 change the output bit to data7 */
- ret = regmap_update_bits(state->regmap, 0xd500, 0x08, 0x08);
- if (ret)
- goto err;
-
/* AF9013 set mpeg to full speed */
ret = regmap_update_bits(state->regmap, 0xd502, 0x10, 0x10);
if (ret)
@@ -1047,9 +1043,12 @@ static int af9013_init(struct dvb_frontend *fe)
goto err;
}
- /* TS mode */
- ret = regmap_update_bits(state->regmap, 0xd500, 0x06,
- state->ts_mode << 1);
+ /* TS interface */
+ if (state->ts_output_pin == 7)
+ utmp = 1 << 3 | state->ts_mode << 1;
+ else
+ utmp = 0 << 3 | state->ts_mode << 1;
+ ret = regmap_update_bits(state->regmap, 0xd500, 0x0e, utmp);
if (ret)
goto err;
@@ -1148,7 +1147,7 @@ static int af9013_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
if (state->i2c_gate_state == enable)
return 0;
- if (state->ts_mode == AF9013_TS_USB)
+ if (state->ts_mode == AF9013_TS_MODE_USB)
ret = regmap_update_bits(state->regmap, 0xd417, 0x08,
enable << 3);
else
@@ -1298,6 +1297,7 @@ struct dvb_frontend *af9013_attach(const struct af9013_config *config,
pdata.tuner = config->tuner;
pdata.if_frequency = config->if_frequency;
pdata.ts_mode = config->ts_mode;
+ pdata.ts_output_pin = 7;
pdata.spec_inv = config->spec_inv;
memcpy(&pdata.api_version, config->api_version, sizeof(pdata.api_version));
memcpy(&pdata.gpio, config->gpio, sizeof(pdata.gpio));
@@ -1451,7 +1451,7 @@ static int af9013_regmap_write(void *context, const void *data, size_t count)
u8 *val = &((u8 *)data)[2];
const unsigned int len = count - 2;
- if (state->ts_mode == AF9013_TS_USB && (reg & 0xff00) != 0xae00) {
+ if (state->ts_mode == AF9013_TS_MODE_USB && (reg & 0xff00) != 0xae00) {
cmd = 0 << 7|0 << 6|(len - 1) << 2|1 << 1|1 << 0;
ret = af9013_wregs(client, cmd, reg, val, len);
if (ret)
@@ -1488,7 +1488,7 @@ static int af9013_regmap_read(void *context, const void *reg_buf,
u8 *val = &((u8 *)val_buf)[0];
const unsigned int len = val_size;
- if (state->ts_mode == AF9013_TS_USB && (reg & 0xff00) != 0xae00) {
+ if (state->ts_mode == AF9013_TS_MODE_USB && (reg & 0xff00) != 0xae00) {
cmd = 0 << 7|0 << 6|(len - 1) << 2|1 << 1|0 << 0;
ret = af9013_rregs(client, cmd, reg, val_buf, len);
if (ret)
@@ -1538,6 +1538,7 @@ static int af9013_probe(struct i2c_client *client,
state->tuner = pdata->tuner;
state->if_frequency = pdata->if_frequency;
state->ts_mode = pdata->ts_mode;
+ state->ts_output_pin = pdata->ts_output_pin;
state->spec_inv = pdata->spec_inv;
memcpy(&state->api_version, pdata->api_version, sizeof(state->api_version));
memcpy(&state->gpio, pdata->gpio, sizeof(state->gpio));
@@ -1550,7 +1551,7 @@ static int af9013_probe(struct i2c_client *client,
}
/* Download firmware */
- if (state->ts_mode != AF9013_TS_USB) {
+ if (state->ts_mode != AF9013_TS_MODE_USB) {
ret = af9013_download_firmware(state);
if (ret)
goto err_regmap_exit;
diff --git a/drivers/media/dvb-frontends/af9013.h b/drivers/media/dvb-frontends/af9013.h
index 3f18258b64d4..353274524f1b 100644
--- a/drivers/media/dvb-frontends/af9013.h
+++ b/drivers/media/dvb-frontends/af9013.h
@@ -33,6 +33,7 @@
* @tuner: Used tuner model.
* @if_frequency: IF frequency.
* @ts_mode: TS mode.
+ * @ts_output_pin: TS output pin.
* @spec_inv: Input spectrum inverted.
* @api_version: Firmware API version.
* @gpio: GPIOs.
@@ -62,6 +63,7 @@ struct af9013_platform_data {
#define AF9013_TS_MODE_PARALLEL 1
#define AF9013_TS_MODE_SERIAL 2
u8 ts_mode;
+ u8 ts_output_pin;
bool spec_inv;
u8 api_version[4];
#define AF9013_GPIO_ON (1 << 0)