All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: linux-media@vger.kernel.org
Cc: Antti Palosaari <crope@iki.fi>
Subject: [PATCH 12/18] af9015: use af9013 demod pid filters
Date: Wed, 14 Mar 2018 01:39:38 +0200	[thread overview]
Message-ID: <20180313233944.7234-12-crope@iki.fi> (raw)
In-Reply-To: <20180313233944.7234-1-crope@iki.fi>

PID filters are moved to af9013 demod driver as those are property of
demod. As pid filters are now implemented correctly by demod driver,
we could enable pid filter support for possible slave demod too on
dual tuner configuration.

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/af9015.c | 49 +++++++++++++----------------------
 1 file changed, 18 insertions(+), 31 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/af9015.c b/drivers/media/usb/dvb-usb-v2/af9015.c
index f07aa42535e5..8e2f704c6ca5 100644
--- a/drivers/media/usb/dvb-usb-v2/af9015.c
+++ b/drivers/media/usb/dvb-usb-v2/af9015.c
@@ -474,10 +474,6 @@ static int af9015_read_config(struct dvb_usb_device *d)
 	state->dual_mode = val;
 	dev_dbg(&intf->dev, "ts mode %02x\n", state->dual_mode);
 
-	/* disable 2nd adapter because we don't have PID-filters */
-	if (d->udev->speed == USB_SPEED_FULL)
-		state->dual_mode = 0;
-
 	state->af9013_i2c_addr[0] = AF9015_I2C_DEMOD;
 
 	if (state->dual_mode) {
@@ -1045,43 +1041,28 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap)
 
 static int af9015_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
 {
-	struct dvb_usb_device *d = adap_to_d(adap);
-	struct usb_interface *intf = d->intf;
+	struct af9015_state *state = adap_to_priv(adap);
+	struct af9013_platform_data *pdata = &state->af9013_pdata[adap->id];
 	int ret;
 
-	dev_dbg(&intf->dev, "onoff %d\n", onoff);
-
-	if (onoff)
-		ret = af9015_set_reg_bit(d, 0xd503, 0);
-	else
-		ret = af9015_clear_reg_bit(d, 0xd503, 0);
+	mutex_lock(&state->fe_mutex);
+	ret = pdata->pid_filter_ctrl(adap->fe[0], onoff);
+	mutex_unlock(&state->fe_mutex);
 
 	return ret;
 }
 
-static int af9015_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
-	int onoff)
+static int af9015_pid_filter(struct dvb_usb_adapter *adap, int index,
+			     u16 pid, int onoff)
 {
-	struct dvb_usb_device *d = adap_to_d(adap);
-	struct usb_interface *intf = d->intf;
+	struct af9015_state *state = adap_to_priv(adap);
+	struct af9013_platform_data *pdata = &state->af9013_pdata[adap->id];
 	int ret;
-	u8 idx;
-
-	dev_dbg(&intf->dev, "index %d, pid %04x, onoff %d\n",
-		index, pid, onoff);
 
-	ret = af9015_write_reg(d, 0xd505, (pid & 0xff));
-	if (ret)
-		goto error;
-
-	ret = af9015_write_reg(d, 0xd506, (pid >> 8));
-	if (ret)
-		goto error;
-
-	idx = ((index & 0x1f) | (1 << 5));
-	ret = af9015_write_reg(d, 0xd504, idx);
+	mutex_lock(&state->fe_mutex);
+	ret = pdata->pid_filter(adap->fe[0], index, pid, onoff);
+	mutex_unlock(&state->fe_mutex);
 
-error:
 	return ret;
 }
 
@@ -1448,6 +1429,12 @@ static struct dvb_usb_device_properties af9015_props = {
 
 			.stream = DVB_USB_STREAM_BULK(0x84, 8, TS_USB20_FRAME_SIZE),
 		}, {
+			.caps = DVB_USB_ADAP_HAS_PID_FILTER |
+				DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
+			.pid_filter_count = 32,
+			.pid_filter = af9015_pid_filter,
+			.pid_filter_ctrl = af9015_pid_filter_ctrl,
+
 			.stream = DVB_USB_STREAM_BULK(0x85, 8, TS_USB20_FRAME_SIZE),
 		},
 	},
-- 
2.14.3

  parent reply	other threads:[~2018-03-13 23:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 23:39 [PATCH 01/18] af9013: change lock detection slightly Antti Palosaari
2018-03-13 23:39 ` [PATCH 02/18] af9013: dvbv5 signal strength Antti Palosaari
2018-03-13 23:39 ` [PATCH 03/18] af9013: dvbv5 cnr Antti Palosaari
2018-03-13 23:39 ` [PATCH 04/18] af9013: dvbv5 ber and per Antti Palosaari
2018-03-13 23:39 ` [PATCH 05/18] af9013: wrap dvbv3 statistics via dvbv5 Antti Palosaari
2018-03-13 23:39 ` [PATCH 06/18] af9015: fix logging Antti Palosaari
2018-03-13 23:39 ` [PATCH 07/18] af9013: convert inittabs suitable for regmap_update_bits Antti Palosaari
2018-03-13 23:39 ` [PATCH 08/18] af9013: add i2c mux adapter for tuner bus Antti Palosaari
2018-03-13 23:39 ` [PATCH 09/18] af9015: attach demod using i2c binding Antti Palosaari
2018-03-13 23:39 ` [PATCH 10/18] af9013: remove all legacy media attach releated stuff Antti Palosaari
2018-03-13 23:39 ` [PATCH 11/18] af9013: add pid filter support Antti Palosaari
2018-03-13 23:39 ` Antti Palosaari [this message]
2018-03-13 23:39 ` [PATCH 13/18] af9015: refactor firmware download Antti Palosaari
2018-03-13 23:39 ` [PATCH 14/18] af9015: refactor copy firmware to slave demod Antti Palosaari
2018-03-13 23:39 ` [PATCH 15/18] af9015: enhance streaming config Antti Palosaari
2018-03-13 23:39 ` [PATCH 16/18] dvb-usb-v2: add probe/disconnect callbacks Antti Palosaari
2018-03-13 23:39 ` [PATCH 17/18] af9015: convert to regmap api Antti Palosaari
2018-03-13 23:39 ` [PATCH 18/18] af9015: correct some coding style issues Antti Palosaari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180313233944.7234-12-crope@iki.fi \
    --to=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.