mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
media: i2c: sc4238 support get channel info
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com> Change-Id: Iaf4b2986a5aa3b43fb3ea1d29d6e81a1170643ca
This commit is contained in:
@@ -1880,10 +1880,22 @@ static int sc4238_set_hdrae(struct sc4238 *sc4238,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sc4238_get_channel_info(struct sc4238 *sc4238, struct rkmodule_channel_info *ch_info)
|
||||
{
|
||||
if (ch_info->index < PAD0 || ch_info->index >= PAD_MAX)
|
||||
return -EINVAL;
|
||||
ch_info->vc = sc4238->cur_mode->vc[ch_info->index];
|
||||
ch_info->width = sc4238->cur_mode->width;
|
||||
ch_info->height = sc4238->cur_mode->height;
|
||||
ch_info->bus_fmt = sc4238->cur_mode->bus_fmt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long sc4238_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
{
|
||||
struct sc4238 *sc4238 = to_sc4238(sd);
|
||||
struct rkmodule_hdr_cfg *hdr_cfg;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
long ret = 0;
|
||||
u32 i, h, w;
|
||||
u32 stream = 0;
|
||||
@@ -1945,6 +1957,10 @@ static long sc4238_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
ret = sc4238_write_reg(sc4238->client, SC4238_REG_CTRL_MODE,
|
||||
SC4238_REG_VALUE_08BIT, SC4238_MODE_SW_STANDBY);
|
||||
break;
|
||||
case RKMODULE_GET_CHANNEL_INFO:
|
||||
ch_info = (struct rkmodule_channel_info *)arg;
|
||||
ret = sc4238_get_channel_info(sc4238, ch_info);
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
@@ -1962,6 +1978,7 @@ static long sc4238_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;
|
||||
|
||||
@@ -2045,6 +2062,21 @@ static long sc4238_compat_ioctl32(struct v4l2_subdev *sd,
|
||||
else
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
case RKMODULE_GET_CHANNEL_INFO:
|
||||
ch_info = kzalloc(sizeof(*ch_info), GFP_KERNEL);
|
||||
if (!ch_info) {
|
||||
ret = -ENOMEM;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = sc4238_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