提交 d92c20e0 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

V4L/DVB (3279): Added VIDIOC_QUERYCTRL to cx25840.


- Added VIDIOC_QUERYCTRL
- Removed unnecessary inlines.
Signed-off-by: NHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab@brturbo.com.br>
上级 fac9e899
......@@ -170,7 +170,7 @@ void cx25840_audio_set_path(struct i2c_client *client)
set_audclk_freq(client, state->audclk_freq);
}
inline static int get_volume(struct i2c_client *client)
static int get_volume(struct i2c_client *client)
{
/* Volume runs +18dB to -96dB in 1/2dB steps
* change to fit the msp3400 -114dB to +12dB range */
......@@ -181,7 +181,7 @@ inline static int get_volume(struct i2c_client *client)
return vol << 9;
}
inline static void set_volume(struct i2c_client *client, int volume)
static void set_volume(struct i2c_client *client, int volume)
{
/* First convert the volume to msp3400 values (0-127) */
int vol = volume >> 9;
......@@ -198,7 +198,7 @@ inline static void set_volume(struct i2c_client *client, int volume)
cx25840_write(client, 0x8d4, 228 - (vol * 2));
}
inline static int get_bass(struct i2c_client *client)
static int get_bass(struct i2c_client *client)
{
/* bass is 49 steps +12dB to -12dB */
......@@ -208,13 +208,13 @@ inline static int get_bass(struct i2c_client *client)
return bass;
}
inline static void set_bass(struct i2c_client *client, int bass)
static void set_bass(struct i2c_client *client, int bass)
{
/* PATH1_EQ_BASS_VOL */
cx25840_and_or(client, 0x8d9, ~0x3f, 48 - (bass * 48 / 0xffff));
}
inline static int get_treble(struct i2c_client *client)
static int get_treble(struct i2c_client *client)
{
/* treble is 49 steps +12dB to -12dB */
......@@ -224,13 +224,13 @@ inline static int get_treble(struct i2c_client *client)
return treble;
}
inline static void set_treble(struct i2c_client *client, int treble)
static void set_treble(struct i2c_client *client, int treble)
{
/* PATH1_EQ_TREBLE_VOL */
cx25840_and_or(client, 0x8db, ~0x3f, 48 - (treble * 48 / 0xffff));
}
inline static int get_balance(struct i2c_client *client)
static int get_balance(struct i2c_client *client)
{
/* balance is 7 bit, 0 to -96dB */
......@@ -244,7 +244,7 @@ inline static int get_balance(struct i2c_client *client)
return balance << 8;
}
inline static void set_balance(struct i2c_client *client, int balance)
static void set_balance(struct i2c_client *client, int balance)
{
int bal = balance >> 8;
if (bal > 0x80) {
......@@ -260,13 +260,13 @@ inline static void set_balance(struct i2c_client *client, int balance)
}
}
inline static int get_mute(struct i2c_client *client)
static int get_mute(struct i2c_client *client)
{
/* check SRC1_MUTE_EN */
return cx25840_read(client, 0x8d3) & 0x2 ? 1 : 0;
}
inline static void set_mute(struct i2c_client *client, int mute)
static void set_mute(struct i2c_client *client, int mute)
{
struct cx25840_state *state = i2c_get_clientdata(client);
......
......@@ -121,7 +121,7 @@ static void log_status(struct i2c_client *client);
/* ----------------------------------------------------------------------- */
static inline void init_dll1(struct i2c_client *client)
static void init_dll1(struct i2c_client *client)
{
/* This is the Hauppauge sequence used to
* initialize the Delay Lock Loop 1 (ADC DLL). */
......@@ -135,7 +135,7 @@ static inline void init_dll1(struct i2c_client *client)
cx25840_write(client, 0x15b, 0x10);
}
static inline void init_dll2(struct i2c_client *client)
static void init_dll2(struct i2c_client *client)
{
/* This is the Hauppauge sequence used to
* initialize the Delay Lock Loop 2 (ADC DLL). */
......@@ -562,6 +562,91 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
/* ----------------------------------------------------------------------- */
static struct v4l2_queryctrl cx25840_qctrl[] = {
{
.id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Brightness",
.minimum = 0,
.maximum = 255,
.step = 1,
.default_value = 128,
.flags = 0,
}, {
.id = V4L2_CID_CONTRAST,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Contrast",
.minimum = 0,
.maximum = 255,
.step = 1,
.default_value = 64,
.flags = 0,
}, {
.id = V4L2_CID_SATURATION,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Saturation",
.minimum = 0,
.maximum = 255,
.step = 1,
.default_value = 64,
.flags = 0,
}, {
.id = V4L2_CID_HUE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Hue",
.minimum = -128,
.maximum = 127,
.step = 1,
.default_value = 0,
.flags = 0,
}, {
.id = V4L2_CID_AUDIO_VOLUME,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Volume",
.minimum = 0,
.maximum = 65535,
.step = 65535/100,
.default_value = 58880,
.flags = 0,
}, {
.id = V4L2_CID_AUDIO_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Balance",
.minimum = 0,
.maximum = 65535,
.step = 65535/100,
.default_value = 32768,
.flags = 0,
}, {
.id = V4L2_CID_AUDIO_MUTE,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "Mute",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 1,
.flags = 0,
}, {
.id = V4L2_CID_AUDIO_BASS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Bass",
.minimum = 0,
.maximum = 65535,
.step = 65535/100,
.default_value = 32768,
}, {
.id = V4L2_CID_AUDIO_TREBLE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Treble",
.minimum = 0,
.maximum = 65535,
.step = 65535/100,
.default_value = 32768,
},
};
/* ----------------------------------------------------------------------- */
static int cx25840_command(struct i2c_client *client, unsigned int cmd,
void *arg)
{
......@@ -623,6 +708,19 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
case VIDIOC_S_CTRL:
return set_v4lctrl(client, (struct v4l2_control *)arg);
case VIDIOC_QUERYCTRL:
{
struct v4l2_queryctrl *qc = arg;
int i;
for (i = 0; i < ARRAY_SIZE(cx25840_qctrl); i++)
if (qc->id && qc->id == cx25840_qctrl[i].id) {
memcpy(qc, &cx25840_qctrl[i], sizeof(*qc));
return 0;
}
return -EINVAL;
}
case VIDIOC_G_STD:
*(v4l2_std_id *)arg = cx25840_get_v4lstd(client);
break;
......
......@@ -37,7 +37,7 @@ module_param(firmware, charp, 0444);
MODULE_PARM_DESC(fastfw, "Load firmware fast [0=100MHz 1=333MHz (default)]");
MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]");
static inline void set_i2c_delay(struct i2c_client *client, int delay)
static void set_i2c_delay(struct i2c_client *client, int delay)
{
struct i2c_algo_bit_data *algod = client->adapter->algo_data;
......@@ -51,7 +51,7 @@ static inline void set_i2c_delay(struct i2c_client *client, int delay)
}
}
static inline void start_fw_load(struct i2c_client *client)
static void start_fw_load(struct i2c_client *client)
{
/* DL_ADDR_LB=0 DL_ADDR_HB=0 */
cx25840_write(client, 0x800, 0x00);
......@@ -65,7 +65,7 @@ static inline void start_fw_load(struct i2c_client *client)
set_i2c_delay(client, 3);
}
static inline void end_fw_load(struct i2c_client *client)
static void end_fw_load(struct i2c_client *client)
{
if (fastfw)
set_i2c_delay(client, 10);
......@@ -76,7 +76,7 @@ static inline void end_fw_load(struct i2c_client *client)
cx25840_write(client, 0x803, 0x03);
}
static inline int check_fw_load(struct i2c_client *client, int size)
static int check_fw_load(struct i2c_client *client, int size)
{
/* DL_ADDR_HB DL_ADDR_LB */
int s = cx25840_read(client, 0x801) << 8;
......@@ -91,7 +91,7 @@ static inline int check_fw_load(struct i2c_client *client, int size)
return 0;
}
static inline int fw_write(struct i2c_client *client, u8 * data, int size)
static int fw_write(struct i2c_client *client, u8 * data, int size)
{
int sent;
......
......@@ -22,7 +22,7 @@
#include "cx25840.h"
static inline int odd_parity(u8 c)
static int odd_parity(u8 c)
{
c ^= (c >> 4);
c ^= (c >> 2);
......@@ -31,7 +31,7 @@ static inline int odd_parity(u8 c)
return c & 1;
}
static inline int decode_vps(u8 * dst, u8 * p)
static int decode_vps(u8 * dst, u8 * p)
{
static const u8 biphase_tbl[] = {
0xf0, 0x78, 0x70, 0xf0, 0xb4, 0x3c, 0x34, 0xb4,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册