mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
media: i2c: sc301iot support get channel info
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com> Change-Id: Ida660f06b64b68f3508dd77dfea7e6aec8ba9c3b
This commit is contained in:
@@ -1306,10 +1306,23 @@ static void SC301IOT_get_module_inf(struct SC301IOT *SC301IOT,
|
||||
strscpy(inf->base.lens, SC301IOT->len_name, sizeof(inf->base.lens));
|
||||
}
|
||||
|
||||
static int SC301IOT_get_channel_info(struct SC301IOT *SC301IOT,
|
||||
struct rkmodule_channel_info *ch_info)
|
||||
{
|
||||
if (ch_info->index < PAD0 || ch_info->index >= PAD_MAX)
|
||||
return -EINVAL;
|
||||
ch_info->vc = SC301IOT->cur_mode->vc[ch_info->index];
|
||||
ch_info->width = SC301IOT->cur_mode->width;
|
||||
ch_info->height = SC301IOT->cur_mode->height;
|
||||
ch_info->bus_fmt = SC301IOT->cur_mode->bus_fmt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long SC301IOT_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
{
|
||||
struct SC301IOT *SC301IOT = to_SC301IOT(sd);
|
||||
struct rkmodule_hdr_cfg *hdr;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
u32 i, h, w;
|
||||
long ret = 0;
|
||||
u32 stream = 0;
|
||||
@@ -1376,6 +1389,10 @@ static long SC301IOT_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
SC301IOT->sync_mode = sync_mode;
|
||||
dev_info(&SC301IOT->client->dev, "sync_mode = [%u]\n", SC301IOT->sync_mode);
|
||||
break;
|
||||
case RKMODULE_GET_CHANNEL_INFO:
|
||||
ch_info = (struct rkmodule_channel_info *)arg;
|
||||
ret = SC301IOT_get_channel_info(SC301IOT, ch_info);
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
@@ -1393,6 +1410,7 @@ static long SC301IOT_compat_ioctl32(struct v4l2_subdev *sd,
|
||||
struct rkmodule_awb_cfg *cfg;
|
||||
struct rkmodule_hdr_cfg *hdr;
|
||||
struct preisp_hdrae_exp_s *hdrae;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
long ret;
|
||||
u32 stream = 0;
|
||||
|
||||
@@ -1473,6 +1491,21 @@ static long SC301IOT_compat_ioctl32(struct v4l2_subdev *sd,
|
||||
return -EFAULT;
|
||||
ret = SC301IOT_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 = SC301IOT_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