Commit ec917d77 authored by Daniel Oakley's avatar Daniel Oakley Committed by Mauro Carvalho Chehab

media: vimc: expand the names of vimc entity types

When introducing the lens controller, it became apparent that the vimc
entity type names were hard to understand, e.g. vimc_len_type refers to the
lens. The names of the vimc entity types have been expanded to make the
code easier to understand. There is no functional change intended.
Suggested-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: default avatarDaniel Oakley <daniel.oakley@ideasonboard.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent d534b952
......@@ -167,11 +167,11 @@ struct vimc_ent_config {
*/
bool vimc_is_source(struct media_entity *ent);
extern struct vimc_ent_type vimc_sen_type;
extern struct vimc_ent_type vimc_deb_type;
extern struct vimc_ent_type vimc_sca_type;
extern struct vimc_ent_type vimc_cap_type;
extern struct vimc_ent_type vimc_len_type;
extern struct vimc_ent_type vimc_sensor_type;
extern struct vimc_ent_type vimc_debayer_type;
extern struct vimc_ent_type vimc_scaler_type;
extern struct vimc_ent_type vimc_capture_type;
extern struct vimc_ent_type vimc_lens_type;
/**
* vimc_pix_map_by_index - get vimc_pix_map struct by its index
......
......@@ -69,48 +69,48 @@ struct vimc_pipeline_config {
static struct vimc_ent_config ent_config[] = {
{
.name = "Sensor A",
.type = &vimc_sen_type
.type = &vimc_sensor_type
},
{
.name = "Sensor B",
.type = &vimc_sen_type
.type = &vimc_sensor_type
},
{
.name = "Debayer A",
.type = &vimc_deb_type
.type = &vimc_debayer_type
},
{
.name = "Debayer B",
.type = &vimc_deb_type
.type = &vimc_debayer_type
},
{
.name = "Raw Capture 0",
.type = &vimc_cap_type
.type = &vimc_capture_type
},
{
.name = "Raw Capture 1",
.type = &vimc_cap_type
.type = &vimc_capture_type
},
{
/* TODO: change this to vimc-input when it is implemented */
.name = "RGB/YUV Input",
.type = &vimc_sen_type
.type = &vimc_sensor_type
},
{
.name = "Scaler",
.type = &vimc_sca_type
.type = &vimc_scaler_type
},
{
.name = "RGB/YUV Capture",
.type = &vimc_cap_type
.type = &vimc_capture_type
},
{
.name = "Lens A",
.type = &vimc_len_type
.type = &vimc_lens_type
},
{
.name = "Lens B",
.type = &vimc_len_type
.type = &vimc_lens_type
},
};
......
......@@ -11,92 +11,92 @@
#include "vimc-common.h"
#define VIMC_LEN_MAX_FOCUS_POS 1023
#define VIMC_LEN_MAX_FOCUS_STEP 1
#define VIMC_LENS_MAX_FOCUS_POS 1023
#define VIMC_LENS_MAX_FOCUS_STEP 1
struct vimc_len_device {
struct vimc_lens_device {
struct vimc_ent_device ved;
struct v4l2_subdev sd;
struct v4l2_ctrl_handler hdl;
u32 focus_absolute;
};
static const struct v4l2_subdev_core_ops vimc_len_core_ops = {
static const struct v4l2_subdev_core_ops vimc_lens_core_ops = {
.log_status = v4l2_ctrl_subdev_log_status,
.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
.unsubscribe_event = v4l2_event_subdev_unsubscribe,
};
static const struct v4l2_subdev_ops vimc_len_ops = {
.core = &vimc_len_core_ops
static const struct v4l2_subdev_ops vimc_lens_ops = {
.core = &vimc_lens_core_ops
};
static int vimc_len_s_ctrl(struct v4l2_ctrl *ctrl)
static int vimc_lens_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct vimc_len_device *vlen =
container_of(ctrl->handler, struct vimc_len_device, hdl);
struct vimc_lens_device *vlens =
container_of(ctrl->handler, struct vimc_lens_device, hdl);
if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE) {
vlen->focus_absolute = ctrl->val;
vlens->focus_absolute = ctrl->val;
return 0;
}
return -EINVAL;
}
static const struct v4l2_ctrl_ops vimc_len_ctrl_ops = {
.s_ctrl = vimc_len_s_ctrl,
static const struct v4l2_ctrl_ops vimc_lens_ctrl_ops = {
.s_ctrl = vimc_lens_s_ctrl,
};
static struct vimc_ent_device *vimc_len_add(struct vimc_device *vimc,
const char *vcfg_name)
static struct vimc_ent_device *vimc_lens_add(struct vimc_device *vimc,
const char *vcfg_name)
{
struct v4l2_device *v4l2_dev = &vimc->v4l2_dev;
struct vimc_len_device *vlen;
struct vimc_lens_device *vlens;
int ret;
/* Allocate the vlen struct */
vlen = kzalloc(sizeof(*vlen), GFP_KERNEL);
if (!vlen)
/* Allocate the vlens struct */
vlens = kzalloc(sizeof(*vlens), GFP_KERNEL);
if (!vlens)
return ERR_PTR(-ENOMEM);
v4l2_ctrl_handler_init(&vlen->hdl, 1);
v4l2_ctrl_handler_init(&vlens->hdl, 1);
v4l2_ctrl_new_std(&vlen->hdl, &vimc_len_ctrl_ops,
v4l2_ctrl_new_std(&vlens->hdl, &vimc_lens_ctrl_ops,
V4L2_CID_FOCUS_ABSOLUTE, 0,
VIMC_LEN_MAX_FOCUS_POS, VIMC_LEN_MAX_FOCUS_STEP, 0);
vlen->sd.ctrl_handler = &vlen->hdl;
if (vlen->hdl.error) {
ret = vlen->hdl.error;
goto err_free_vlen;
VIMC_LENS_MAX_FOCUS_POS, VIMC_LENS_MAX_FOCUS_STEP, 0);
vlens->sd.ctrl_handler = &vlens->hdl;
if (vlens->hdl.error) {
ret = vlens->hdl.error;
goto err_free_vlens;
}
vlen->ved.dev = vimc->mdev.dev;
vlens->ved.dev = vimc->mdev.dev;
ret = vimc_ent_sd_register(&vlen->ved, &vlen->sd, v4l2_dev,
ret = vimc_ent_sd_register(&vlens->ved, &vlens->sd, v4l2_dev,
vcfg_name, MEDIA_ENT_F_LENS, 0,
NULL, &vimc_len_ops);
NULL, &vimc_lens_ops);
if (ret)
goto err_free_hdl;
return &vlen->ved;
return &vlens->ved;
err_free_hdl:
v4l2_ctrl_handler_free(&vlen->hdl);
err_free_vlen:
kfree(vlen);
v4l2_ctrl_handler_free(&vlens->hdl);
err_free_vlens:
kfree(vlens);
return ERR_PTR(ret);
}
static void vimc_len_release(struct vimc_ent_device *ved)
static void vimc_lens_release(struct vimc_ent_device *ved)
{
struct vimc_len_device *vlen =
container_of(ved, struct vimc_len_device, ved);
struct vimc_lens_device *vlens =
container_of(ved, struct vimc_lens_device, ved);
v4l2_ctrl_handler_free(&vlen->hdl);
media_entity_cleanup(vlen->ved.ent);
kfree(vlen);
v4l2_ctrl_handler_free(&vlens->hdl);
media_entity_cleanup(vlens->ved.ent);
kfree(vlens);
}
struct vimc_ent_type vimc_len_type = {
.add = vimc_len_add,
.release = vimc_len_release
struct vimc_ent_type vimc_lens_type = {
.add = vimc_lens_add,
.release = vimc_lens_release
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment