diff options
author | Antti Palosaari <crope@iki.fi> | 2014-07-18 15:22:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-21 20:39:03 -0400 |
commit | d57fe404019b3c720e188156080c614290e1b78c (patch) | |
tree | 158b759d9493799b0ae8a86e22b9068aea8da253 /drivers | |
parent | aaa968b636550042023bffa075adcdb01e6d257c (diff) |
[media] rtl2832_sdr: fill FMT buffer size
Fill FMT buffer size field in order to inform app which will be
used streaming buffer size. Currently driver doesn't allow buffer
size value proposed by application.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb-frontends/rtl2832_sdr.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c index 8665ea37b1b3..f58bd746d823 100644 --- a/drivers/media/dvb-frontends/rtl2832_sdr.c +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c | |||
@@ -84,15 +84,18 @@ static const struct v4l2_frequency_band bands_fm[] = { | |||
84 | struct rtl2832_sdr_format { | 84 | struct rtl2832_sdr_format { |
85 | char *name; | 85 | char *name; |
86 | u32 pixelformat; | 86 | u32 pixelformat; |
87 | u32 buffersize; | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | static struct rtl2832_sdr_format formats[] = { | 90 | static struct rtl2832_sdr_format formats[] = { |
90 | { | 91 | { |
91 | .name = "Complex U8", | 92 | .name = "Complex U8", |
92 | .pixelformat = V4L2_SDR_FMT_CU8, | 93 | .pixelformat = V4L2_SDR_FMT_CU8, |
94 | .buffersize = BULK_BUFFER_SIZE, | ||
93 | }, { | 95 | }, { |
94 | .name = "Complex U16LE (emulated)", | 96 | .name = "Complex U16LE (emulated)", |
95 | .pixelformat = V4L2_SDR_FMT_CU16LE, | 97 | .pixelformat = V4L2_SDR_FMT_CU16LE, |
98 | .buffersize = BULK_BUFFER_SIZE * 2, | ||
96 | }, | 99 | }, |
97 | }; | 100 | }; |
98 | 101 | ||
@@ -143,6 +146,7 @@ struct rtl2832_sdr_state { | |||
143 | 146 | ||
144 | unsigned int f_adc, f_tuner; | 147 | unsigned int f_adc, f_tuner; |
145 | u32 pixelformat; | 148 | u32 pixelformat; |
149 | u32 buffersize; | ||
146 | unsigned int num_formats; | 150 | unsigned int num_formats; |
147 | 151 | ||
148 | /* Controls */ | 152 | /* Controls */ |
@@ -633,8 +637,7 @@ static int rtl2832_sdr_queue_setup(struct vb2_queue *vq, | |||
633 | if (vq->num_buffers + *nbuffers < 8) | 637 | if (vq->num_buffers + *nbuffers < 8) |
634 | *nbuffers = 8 - vq->num_buffers; | 638 | *nbuffers = 8 - vq->num_buffers; |
635 | *nplanes = 1; | 639 | *nplanes = 1; |
636 | /* 2 = max 16-bit sample returned */ | 640 | sizes[0] = PAGE_ALIGN(s->buffersize); |
637 | sizes[0] = PAGE_ALIGN(BULK_BUFFER_SIZE * 2); | ||
638 | dev_dbg(&s->udev->dev, "%s: nbuffers=%d sizes[0]=%d\n", | 641 | dev_dbg(&s->udev->dev, "%s: nbuffers=%d sizes[0]=%d\n", |
639 | __func__, *nbuffers, sizes[0]); | 642 | __func__, *nbuffers, sizes[0]); |
640 | return 0; | 643 | return 0; |
@@ -1233,6 +1236,8 @@ static int rtl2832_sdr_g_fmt_sdr_cap(struct file *file, void *priv, | |||
1233 | dev_dbg(&s->udev->dev, "%s:\n", __func__); | 1236 | dev_dbg(&s->udev->dev, "%s:\n", __func__); |
1234 | 1237 | ||
1235 | f->fmt.sdr.pixelformat = s->pixelformat; | 1238 | f->fmt.sdr.pixelformat = s->pixelformat; |
1239 | f->fmt.sdr.buffersize = s->buffersize; | ||
1240 | |||
1236 | memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); | 1241 | memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); |
1237 | 1242 | ||
1238 | return 0; | 1243 | return 0; |
@@ -1254,13 +1259,17 @@ static int rtl2832_sdr_s_fmt_sdr_cap(struct file *file, void *priv, | |||
1254 | memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); | 1259 | memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); |
1255 | for (i = 0; i < s->num_formats; i++) { | 1260 | for (i = 0; i < s->num_formats; i++) { |
1256 | if (formats[i].pixelformat == f->fmt.sdr.pixelformat) { | 1261 | if (formats[i].pixelformat == f->fmt.sdr.pixelformat) { |
1257 | s->pixelformat = f->fmt.sdr.pixelformat; | 1262 | s->pixelformat = formats[i].pixelformat; |
1263 | s->buffersize = formats[i].buffersize; | ||
1264 | f->fmt.sdr.buffersize = formats[i].buffersize; | ||
1258 | return 0; | 1265 | return 0; |
1259 | } | 1266 | } |
1260 | } | 1267 | } |
1261 | 1268 | ||
1262 | f->fmt.sdr.pixelformat = formats[0].pixelformat; | ||
1263 | s->pixelformat = formats[0].pixelformat; | 1269 | s->pixelformat = formats[0].pixelformat; |
1270 | s->buffersize = formats[0].buffersize; | ||
1271 | f->fmt.sdr.pixelformat = formats[0].pixelformat; | ||
1272 | f->fmt.sdr.buffersize = formats[0].buffersize; | ||
1264 | 1273 | ||
1265 | return 0; | 1274 | return 0; |
1266 | } | 1275 | } |
@@ -1276,11 +1285,14 @@ static int rtl2832_sdr_try_fmt_sdr_cap(struct file *file, void *priv, | |||
1276 | 1285 | ||
1277 | memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); | 1286 | memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); |
1278 | for (i = 0; i < s->num_formats; i++) { | 1287 | for (i = 0; i < s->num_formats; i++) { |
1279 | if (formats[i].pixelformat == f->fmt.sdr.pixelformat) | 1288 | if (formats[i].pixelformat == f->fmt.sdr.pixelformat) { |
1289 | f->fmt.sdr.buffersize = formats[i].buffersize; | ||
1280 | return 0; | 1290 | return 0; |
1291 | } | ||
1281 | } | 1292 | } |
1282 | 1293 | ||
1283 | f->fmt.sdr.pixelformat = formats[0].pixelformat; | 1294 | f->fmt.sdr.pixelformat = formats[0].pixelformat; |
1295 | f->fmt.sdr.buffersize = formats[0].buffersize; | ||
1284 | 1296 | ||
1285 | return 0; | 1297 | return 0; |
1286 | } | 1298 | } |
@@ -1418,7 +1430,8 @@ struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe, | |||
1418 | s->cfg = cfg; | 1430 | s->cfg = cfg; |
1419 | s->f_adc = bands_adc[0].rangelow; | 1431 | s->f_adc = bands_adc[0].rangelow; |
1420 | s->f_tuner = bands_fm[0].rangelow; | 1432 | s->f_tuner = bands_fm[0].rangelow; |
1421 | s->pixelformat = V4L2_SDR_FMT_CU8; | 1433 | s->pixelformat = formats[0].pixelformat; |
1434 | s->buffersize = formats[0].buffersize; | ||
1422 | s->num_formats = NUM_FORMATS; | 1435 | s->num_formats = NUM_FORMATS; |
1423 | if (rtl2832_sdr_emulated_fmt == false) | 1436 | if (rtl2832_sdr_emulated_fmt == false) |
1424 | s->num_formats -= 1; | 1437 | s->num_formats -= 1; |