diff mbox

[REVIEW,27/86] rtl2832_sdr: calculate bandwidth if not set by user

Message ID 1391935771-18670-28-git-send-email-crope@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Antti Palosaari Feb. 9, 2014, 8:48 a.m. UTC
Calculate bandwidth from sampling rate if it is not set by user.

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index 1cc7bf7..2c9b703 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -881,6 +881,10 @@  static int rtl2832_sdr_set_tuner(struct rtl2832_sdr_state *s)
 	if (fe->ops.tuner_ops.init)
 		fe->ops.tuner_ops.init(fe);
 
+	/* user has not requested bandwidth so calculate automatically */
+	if (bandwidth == 0)
+		bandwidth = s->f_adc;
+
 	c->bandwidth_hz = bandwidth;
 	c->frequency = f_rf;
 
@@ -1254,9 +1258,9 @@  struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe,
 		.id     = RTL2832_SDR_CID_TUNER_BW,
 		.type   = V4L2_CTRL_TYPE_INTEGER,
 		.name   = "Tuner BW",
-		.min    =  200000,
-		.max    = 8000000,
-		.def    =  600000,
+		.min    = 0,
+		.max    = INT_MAX,
+		.def    = 0,
 		.step   = 1,
 	};
 	static const struct v4l2_ctrl_config ctrl_tuner_gain = {