[media] e4000: implement controls via v4l2 control framework

Implement gain and bandwidth controls using v4l2 control framework.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
Antti Palosaari
2014-01-26 21:02:53 -03:00
committed by Mauro Carvalho Chehab
parent 28fd31f82d
commit adaa616ffb
3 changed files with 291 additions and 5 deletions

View File

@@ -22,11 +22,25 @@
#define E4000_PRIV_H
#include "e4000.h"
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
struct e4000_priv {
struct i2c_client *client;
u32 clock;
struct dvb_frontend *fe;
struct v4l2_subdev sd;
/* Controls */
struct v4l2_ctrl_handler hdl;
struct v4l2_ctrl *bandwidth_auto;
struct v4l2_ctrl *bandwidth;
struct v4l2_ctrl *lna_gain_auto;
struct v4l2_ctrl *lna_gain;
struct v4l2_ctrl *mixer_gain_auto;
struct v4l2_ctrl *mixer_gain;
struct v4l2_ctrl *if_gain_auto;
struct v4l2_ctrl *if_gain;
};
struct e4000_pll {
@@ -145,4 +159,67 @@ static const struct e4000_if_filter e4000_if_filter_lut[] = {
{ 0xffffffff, 0x00, 0x20 },
};
struct e4000_if_gain {
u8 reg16_val;
u8 reg17_val;
};
static const struct e4000_if_gain e4000_if_gain_lut[] = {
{0x00, 0x00},
{0x20, 0x00},
{0x40, 0x00},
{0x02, 0x00},
{0x22, 0x00},
{0x42, 0x00},
{0x04, 0x00},
{0x24, 0x00},
{0x44, 0x00},
{0x01, 0x00},
{0x21, 0x00},
{0x41, 0x00},
{0x03, 0x00},
{0x23, 0x00},
{0x43, 0x00},
{0x05, 0x00},
{0x25, 0x00},
{0x45, 0x00},
{0x07, 0x00},
{0x27, 0x00},
{0x47, 0x00},
{0x0f, 0x00},
{0x2f, 0x00},
{0x4f, 0x00},
{0x17, 0x00},
{0x37, 0x00},
{0x57, 0x00},
{0x1f, 0x00},
{0x3f, 0x00},
{0x5f, 0x00},
{0x1f, 0x01},
{0x3f, 0x01},
{0x5f, 0x01},
{0x1f, 0x02},
{0x3f, 0x02},
{0x5f, 0x02},
{0x1f, 0x03},
{0x3f, 0x03},
{0x5f, 0x03},
{0x1f, 0x04},
{0x3f, 0x04},
{0x5f, 0x04},
{0x1f, 0x0c},
{0x3f, 0x0c},
{0x5f, 0x0c},
{0x1f, 0x14},
{0x3f, 0x14},
{0x5f, 0x14},
{0x1f, 0x1c},
{0x3f, 0x1c},
{0x5f, 0x1c},
{0x1f, 0x24},
{0x3f, 0x24},
{0x5f, 0x24},
{0x7f, 0x24},
};
#endif