mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
media: platform: cif: support config adapt to android usb camera hal
usage:
&rkcif {
...
rockchip,android-usb-camerahal-enable;
...
};
Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
Change-Id: Id556c38b65fa528de436443434f50c619a7c9ecc
This commit is contained in:
committed by
Tao Huang
parent
18ef66dbd8
commit
734a63bdb1
@@ -5073,6 +5073,7 @@ static int rkcif_try_fmt_vid_cap_mplane(struct file *file, void *fh,
|
||||
static int rkcif_enum_framesizes(struct file *file, void *prov,
|
||||
struct v4l2_frmsizeenum *fsize)
|
||||
{
|
||||
struct v4l2_frmsize_discrete *d = &fsize->discrete;
|
||||
struct v4l2_frmsize_stepwise *s = &fsize->stepwise;
|
||||
struct rkcif_stream *stream = video_drvdata(file);
|
||||
struct rkcif_device *dev = stream->cifdev;
|
||||
@@ -5093,13 +5094,19 @@ static int rkcif_enum_framesizes(struct file *file, void *prov,
|
||||
&input_rect, stream->id,
|
||||
&csi_info);
|
||||
|
||||
fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
|
||||
s->min_width = CIF_MIN_WIDTH;
|
||||
s->min_height = CIF_MIN_HEIGHT;
|
||||
s->max_width = input_rect.width;
|
||||
s->max_height = input_rect.height;
|
||||
s->step_width = OUTPUT_STEP_WISE;
|
||||
s->step_height = OUTPUT_STEP_WISE;
|
||||
if (dev->hw_dev->adapt_to_usbcamerahal) {
|
||||
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
|
||||
d->width = input_rect.width;
|
||||
d->height = input_rect.height;
|
||||
} else {
|
||||
fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
|
||||
s->min_width = CIF_MIN_WIDTH;
|
||||
s->min_height = CIF_MIN_HEIGHT;
|
||||
s->max_width = input_rect.width;
|
||||
s->max_height = input_rect.height;
|
||||
s->step_width = OUTPUT_STEP_WISE;
|
||||
s->step_height = OUTPUT_STEP_WISE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -5131,13 +5138,19 @@ static int rkcif_enum_frameintervals(struct file *file, void *fh,
|
||||
fi.interval.denominator = 30;
|
||||
}
|
||||
|
||||
fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS;
|
||||
fival->stepwise.step.numerator = 1;
|
||||
fival->stepwise.step.denominator = 1;
|
||||
fival->stepwise.max.numerator = 1;
|
||||
fival->stepwise.max.denominator = 1;
|
||||
fival->stepwise.min.numerator = fi.interval.numerator;
|
||||
fival->stepwise.min.denominator = fi.interval.denominator;
|
||||
if (dev->hw_dev->adapt_to_usbcamerahal) {
|
||||
fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
|
||||
fival->discrete.numerator = fi.interval.numerator;
|
||||
fival->discrete.denominator = fi.interval.denominator;
|
||||
} else {
|
||||
fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS;
|
||||
fival->stepwise.step.numerator = 1;
|
||||
fival->stepwise.step.denominator = 1;
|
||||
fival->stepwise.max.numerator = 1;
|
||||
fival->stepwise.max.denominator = 1;
|
||||
fival->stepwise.min.numerator = fi.interval.numerator;
|
||||
fival->stepwise.min.denominator = fi.interval.denominator;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1197,6 +1197,11 @@ static int rkcif_plat_hw_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(cif_hw->base_addr);
|
||||
}
|
||||
|
||||
if (of_property_read_bool(np, "rockchip,android-usb-camerahal-enable")) {
|
||||
dev_info(dev, "config cif adapt to android usb camera hal!\n");
|
||||
cif_hw->adapt_to_usbcamerahal = true;
|
||||
}
|
||||
|
||||
cif_hw->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
|
||||
if (IS_ERR(cif_hw->grf))
|
||||
dev_warn(dev, "unable to get rockchip,grf\n");
|
||||
|
||||
@@ -127,6 +127,7 @@ struct rkcif_hw {
|
||||
struct mutex dev_lock;
|
||||
struct rkcif_multi_sync_config sync_config;
|
||||
spinlock_t group_lock;
|
||||
bool adapt_to_usbcamerahal;
|
||||
};
|
||||
|
||||
void rkcif_hw_soft_reset(struct rkcif_hw *cif_hw, bool is_rst_iommu);
|
||||
|
||||
Reference in New Issue
Block a user