mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
media: i2c: sc530ai support get channel info
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com> Change-Id: Ie52ca66917de1e1dc9da36ece34d8a3ed44e24fb
This commit is contained in:
@@ -1128,11 +1128,23 @@ static int sc530ai_set_hdrae(struct sc530ai *sc530ai,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sc530ai_get_channel_info(struct sc530ai *sc530ai, struct rkmodule_channel_info *ch_info)
|
||||
{
|
||||
if (ch_info->index < PAD0 || ch_info->index >= PAD_MAX)
|
||||
return -EINVAL;
|
||||
ch_info->vc = sc530ai->cur_mode->vc[ch_info->index];
|
||||
ch_info->width = sc530ai->cur_mode->width;
|
||||
ch_info->height = sc530ai->cur_mode->height;
|
||||
ch_info->bus_fmt = sc530ai->cur_mode->bus_fmt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long sc530ai_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
{
|
||||
struct sc530ai *sc530ai = to_sc530ai(sd);
|
||||
struct rkmodule_hdr_cfg *hdr;
|
||||
const struct sc530ai_mode *mode;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
|
||||
long ret = 0;
|
||||
u32 i, h = 0, w;
|
||||
@@ -1208,6 +1220,10 @@ static long sc530ai_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
SC530AI_REG_VALUE_08BIT,
|
||||
SC530AI_MODE_SW_STANDBY);
|
||||
break;
|
||||
case RKMODULE_GET_CHANNEL_INFO:
|
||||
ch_info = (struct rkmodule_channel_info *)arg;
|
||||
ret = sc530ai_get_channel_info(sc530ai, ch_info);
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
@@ -1224,6 +1240,7 @@ static long sc530ai_compat_ioctl32(struct v4l2_subdev *sd,
|
||||
struct rkmodule_inf *inf;
|
||||
struct rkmodule_hdr_cfg *hdr;
|
||||
struct preisp_hdrae_exp_s *hdrae;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
long ret = 0;
|
||||
u32 stream = 0;
|
||||
|
||||
@@ -1294,6 +1311,21 @@ static long sc530ai_compat_ioctl32(struct v4l2_subdev *sd,
|
||||
|
||||
ret = sc530ai_ioctl(sd, cmd, &stream);
|
||||
break;
|
||||
case RKMODULE_GET_CHANNEL_INFO:
|
||||
ch_info = kzalloc(sizeof(*ch_info), GFP_KERNEL);
|
||||
if (!ch_info) {
|
||||
ret = -ENOMEM;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = sc530ai_ioctl(sd, cmd, ch_info);
|
||||
if (!ret) {
|
||||
ret = copy_to_user(up, ch_info, sizeof(*ch_info));
|
||||
if (ret)
|
||||
ret = -EFAULT;
|
||||
}
|
||||
kfree(ch_info);
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user