summaryrefslogtreecommitdiff
path: root/isp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-02-10 00:08:02 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-04-16 23:44:55 +0200
commitda54993ac62ca19f1bff3b1bb2a035a637e75a60 (patch)
tree1342d19643fd161b8e3f182a4fe953e673316a3e /isp
parentde6799715da8893206cf1cee7f7c2022278f0d55 (diff)
omap3isp: Store ccdc, preview and sensor entities in sub-structures
This will allow adding entity-specific fields such as controls to the omap3_isp_device structure. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'isp')
-rw-r--r--isp/controls.c16
-rw-r--r--isp/omap3isp-priv.h12
-rw-r--r--isp/omap3isp.c24
3 files changed, 29 insertions, 23 deletions
diff --git a/isp/controls.c b/isp/controls.c
index 4dc943f..299be5d 100644
--- a/isp/controls.c
+++ b/isp/controls.c
@@ -170,7 +170,7 @@ int omap3_isp_ccdc_set_black_level(struct omap3_isp_device *isp, unsigned int va
memset(&bclamp, 0, sizeof bclamp);
bclamp.dcsubval = value;
- ret = ioctl(isp->ccdc->fd, VIDIOC_OMAP3ISP_CCDC_CFG, &config);
+ ret = ioctl(isp->ccdc.entity->fd, VIDIOC_OMAP3ISP_CCDC_CFG, &config);
if (ret < 0)
return -errno;
@@ -230,9 +230,9 @@ int omap3_isp_preview_setup(struct omap3_isp_device *isp)
memset(&csc, 0, sizeof csc);
matrix_float_to_s10q8(csc.matrix, &omap3isp_preview_csc);
- v4l2_subdev_open(isp->preview);
+ v4l2_subdev_open(isp->preview.entity);
- ret = ioctl(isp->preview->fd, VIDIOC_OMAP3ISP_PRV_CFG, &config);
+ ret = ioctl(isp->preview.entity->fd, VIDIOC_OMAP3ISP_PRV_CFG, &config);
if (ret < 0)
return -errno;
@@ -244,7 +244,7 @@ int omap3_isp_preview_set_contrast(struct omap3_isp_device *isp, unsigned int va
int contrast = value;
int ret;
- ret = v4l2_subdev_set_control(isp->preview, V4L2_CID_CONTRAST, &contrast);
+ ret = v4l2_subdev_set_control(isp->preview.entity, V4L2_CID_CONTRAST, &contrast);
if (ret < 0)
return -errno;
@@ -276,7 +276,7 @@ int omap3_isp_preview_set_saturation(struct omap3_isp_device *isp, float value)
memset(&rgb2rgb, 0, sizeof rgb2rgb);
matrix_float_to_s12q8(rgb2rgb.matrix, &saturation);
- ret = ioctl(isp->preview->fd, VIDIOC_OMAP3ISP_PRV_CFG, &config);
+ ret = ioctl(isp->preview.entity->fd, VIDIOC_OMAP3ISP_PRV_CFG, &config);
if (ret < 0)
return -errno;
@@ -300,7 +300,7 @@ int omap3_isp_sensor_get_exposure(struct omap3_isp_device *isp,
ctrls[0].id = V4L2_CID_EXPOSURE;
- ret = v4l2_subdev_set_controls(isp->sensor, ARRAY_SIZE(ctrls), ctrls);
+ ret = v4l2_subdev_set_controls(isp->sensor.entity, ARRAY_SIZE(ctrls), ctrls);
if (ret < 0)
return ret;
@@ -316,7 +316,7 @@ int omap3_isp_sensor_set_exposure(struct omap3_isp_device *isp,
ctrls[0].id = V4L2_CID_EXPOSURE;
ctrls[0].value = exposure;
- return v4l2_subdev_set_controls(isp->sensor, ARRAY_SIZE(ctrls), ctrls);
+ return v4l2_subdev_set_controls(isp->sensor.entity, ARRAY_SIZE(ctrls), ctrls);
}
int omap3_isp_sensor_set_gains(struct omap3_isp_device *isp, unsigned int red,
@@ -333,5 +333,5 @@ int omap3_isp_sensor_set_gains(struct omap3_isp_device *isp, unsigned int red,
ctrls[3].id = V4L2_CID_GAIN_BLUE;
ctrls[3].value = blue;
- return v4l2_subdev_set_controls(isp->sensor, ARRAY_SIZE(ctrls), ctrls);
+ return v4l2_subdev_set_controls(isp->sensor.entity, ARRAY_SIZE(ctrls), ctrls);
}
diff --git a/isp/omap3isp-priv.h b/isp/omap3isp-priv.h
index 28bcf73..4b3f1bd 100644
--- a/isp/omap3isp-priv.h
+++ b/isp/omap3isp-priv.h
@@ -125,9 +125,15 @@ struct omap3_isp_pipeline {
struct omap3_isp_device {
struct media_device *mdev;
- struct media_entity *ccdc;
- struct media_entity *preview;
- struct media_entity *sensor;
+ struct {
+ struct media_entity *entity;
+ } sensor;
+ struct {
+ struct media_entity *entity;
+ } ccdc;
+ struct {
+ struct media_entity *entity;
+ } preview;
struct v4l2_mbus_framefmt sensor_format;
diff --git a/isp/omap3isp.c b/isp/omap3isp.c
index 341b5e1..9fbd984 100644
--- a/isp/omap3isp.c
+++ b/isp/omap3isp.c
@@ -456,7 +456,7 @@ omap3_isp_pipeline_create_entity(struct omap3_isp_device *isp,
struct media_entity *ment;
if (strncmp(name, ":SENSOR", 7) == 0)
- ment = isp->sensor;
+ ment = isp->sensor.entity;
else
ment = media_get_entity_by_name(isp->mdev, name);
@@ -632,7 +632,7 @@ static int omap3_isp_pipeline_try_format(struct omap3_isp_device *isp,
else
format = *ofmt;
- ret = v4l2_subdev_set_format(isp->sensor, &format, 0,
+ ret = v4l2_subdev_set_format(isp->sensor.entity, &format, 0,
V4L2_SUBDEV_FORMAT_TRY);
if (ret < 0) {
printf("error: get format on sensor output failed.\n");
@@ -676,7 +676,7 @@ static int omap3_isp_pipeline_try_format(struct omap3_isp_device *isp,
}
if (sink->type == OMAP3_ISP_ENTITY_ENTITY) {
- if (sink->entity == isp->ccdc) {
+ if (sink->entity == isp->ccdc.entity) {
if (format_is_shiftable(format.code, ofmt->code))
format.code = ofmt->code;
}
@@ -793,7 +793,7 @@ static int omap3_isp_pipeline_activate(struct omap3_isp_device *isp,
}
if (sink->type == OMAP3_ISP_ENTITY_ENTITY) {
- if (sink->entity == isp->ccdc)
+ if (sink->entity == isp->ccdc.entity)
format.code = sink->sink.format.code;
/* Propagate the format to the link target. */
@@ -855,31 +855,31 @@ struct omap3_isp_device *omap3_isp_open(const char *devname,
/* Locate the entities that will be used in the pipelines. OMAP3 ISP
* modules are looked up by name.
*/
- isp->ccdc = media_get_entity_by_name(isp->mdev, ENTITY_CCDC);
- isp->preview = media_get_entity_by_name(isp->mdev, ENTITY_PREVIEW);
+ isp->ccdc.entity = media_get_entity_by_name(isp->mdev, ENTITY_CCDC);
+ isp->preview.entity = media_get_entity_by_name(isp->mdev, ENTITY_PREVIEW);
- if (isp->ccdc == NULL || isp->preview == NULL) {
+ if (isp->ccdc.entity == NULL || isp->preview.entity == NULL) {
printf("error: unable to locate one or more ISP entities.\n");
goto error;
}
/* The sensor and video nodes are located by following links. */
- for (i = 0; i < isp->ccdc->num_links; ++i) {
- entity = isp->ccdc->links[i].source->entity;
+ for (i = 0; i < isp->ccdc.entity->num_links; ++i) {
+ entity = isp->ccdc.entity->links[i].source->entity;
if (media_entity_type(entity) == MEDIA_ENT_T_V4L2_SUBDEV &&
entity->info.pads == 1)
break;
}
- if (i == isp->ccdc->num_links) {
+ if (i == isp->ccdc.entity->num_links) {
printf("error: unable to locate sensor.\n");
goto error;
}
- isp->sensor = entity;
+ isp->sensor.entity = entity;
/* Retrieve the sensor default format. */
- ret = v4l2_subdev_get_format(isp->sensor, &isp->sensor_format, 0,
+ ret = v4l2_subdev_get_format(isp->sensor.entity, &isp->sensor_format, 0,
V4L2_SUBDEV_FORMAT_TRY);
if (ret < 0) {
printf("error: unable to get sensor default format.\n");