diff options
author | Antti Palosaari <crope@iki.fi> | 2014-02-13 13:40:59 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-14 19:26:25 -0400 |
commit | 040cf86c8a121905bf201f334a4848f35de29729 (patch) | |
tree | 83a07696c05d0290708bc9ceaf93f73f4760e7d4 /drivers/media | |
parent | 02b7220017cf29507aa789720a3576e7dd59fbe2 (diff) |
[media] af9033: implement PID filter
Implement PID filter and export it via symbol.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb-frontends/af9033.c | 53 | ||||
-rw-r--r-- | drivers/media/dvb-frontends/af9033.h | 19 |
2 files changed, 72 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index 65728c25ea05..5a1c508c7417 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c | |||
@@ -989,6 +989,59 @@ err: | |||
989 | return ret; | 989 | return ret; |
990 | } | 990 | } |
991 | 991 | ||
992 | int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff) | ||
993 | { | ||
994 | struct af9033_state *state = fe->demodulator_priv; | ||
995 | int ret; | ||
996 | |||
997 | dev_dbg(&state->i2c->dev, "%s: onoff=%d\n", __func__, onoff); | ||
998 | |||
999 | ret = af9033_wr_reg_mask(state, 0x80f993, onoff, 0x01); | ||
1000 | if (ret < 0) | ||
1001 | goto err; | ||
1002 | |||
1003 | return 0; | ||
1004 | |||
1005 | err: | ||
1006 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); | ||
1007 | |||
1008 | return ret; | ||
1009 | } | ||
1010 | EXPORT_SYMBOL(af9033_pid_filter_ctrl); | ||
1011 | |||
1012 | int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, int onoff) | ||
1013 | { | ||
1014 | struct af9033_state *state = fe->demodulator_priv; | ||
1015 | int ret; | ||
1016 | u8 wbuf[2] = {(pid >> 0) & 0xff, (pid >> 8) & 0xff}; | ||
1017 | |||
1018 | dev_dbg(&state->i2c->dev, "%s: index=%d pid=%04x onoff=%d\n", | ||
1019 | __func__, index, pid, onoff); | ||
1020 | |||
1021 | if (pid > 0x1fff) | ||
1022 | return 0; | ||
1023 | |||
1024 | ret = af9033_wr_regs(state, 0x80f996, wbuf, 2); | ||
1025 | if (ret < 0) | ||
1026 | goto err; | ||
1027 | |||
1028 | ret = af9033_wr_reg(state, 0x80f994, onoff); | ||
1029 | if (ret < 0) | ||
1030 | goto err; | ||
1031 | |||
1032 | ret = af9033_wr_reg(state, 0x80f995, index); | ||
1033 | if (ret < 0) | ||
1034 | goto err; | ||
1035 | |||
1036 | return 0; | ||
1037 | |||
1038 | err: | ||
1039 | dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); | ||
1040 | |||
1041 | return ret; | ||
1042 | } | ||
1043 | EXPORT_SYMBOL(af9033_pid_filter); | ||
1044 | |||
992 | static struct dvb_frontend_ops af9033_ops; | 1045 | static struct dvb_frontend_ops af9033_ops; |
993 | 1046 | ||
994 | struct dvb_frontend *af9033_attach(const struct af9033_config *config, | 1047 | struct dvb_frontend *af9033_attach(const struct af9033_config *config, |
diff --git a/drivers/media/dvb-frontends/af9033.h b/drivers/media/dvb-frontends/af9033.h index c286e8f1ec02..de245f9adb65 100644 --- a/drivers/media/dvb-frontends/af9033.h +++ b/drivers/media/dvb-frontends/af9033.h | |||
@@ -81,6 +81,11 @@ struct af9033_config { | |||
81 | #if IS_ENABLED(CONFIG_DVB_AF9033) | 81 | #if IS_ENABLED(CONFIG_DVB_AF9033) |
82 | extern struct dvb_frontend *af9033_attach(const struct af9033_config *config, | 82 | extern struct dvb_frontend *af9033_attach(const struct af9033_config *config, |
83 | struct i2c_adapter *i2c); | 83 | struct i2c_adapter *i2c); |
84 | |||
85 | extern int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff); | ||
86 | |||
87 | extern int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, | ||
88 | int onoff); | ||
84 | #else | 89 | #else |
85 | static inline struct dvb_frontend *af9033_attach( | 90 | static inline struct dvb_frontend *af9033_attach( |
86 | const struct af9033_config *config, struct i2c_adapter *i2c) | 91 | const struct af9033_config *config, struct i2c_adapter *i2c) |
@@ -88,6 +93,20 @@ static inline struct dvb_frontend *af9033_attach( | |||
88 | pr_warn("%s: driver disabled by Kconfig\n", __func__); | 93 | pr_warn("%s: driver disabled by Kconfig\n", __func__); |
89 | return NULL; | 94 | return NULL; |
90 | } | 95 | } |
96 | |||
97 | static inline int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff) | ||
98 | { | ||
99 | pr_warn("%s: driver disabled by Kconfig\n", __func__); | ||
100 | return -ENODEV; | ||
101 | } | ||
102 | |||
103 | static inline int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, | ||
104 | int onoff) | ||
105 | { | ||
106 | pr_warn("%s: driver disabled by Kconfig\n", __func__); | ||
107 | return -ENODEV; | ||
108 | } | ||
109 | |||
91 | #endif | 110 | #endif |
92 | 111 | ||
93 | #endif /* AF9033_H */ | 112 | #endif /* AF9033_H */ |