static int fimc_is_register_callback(struct device *dev, void *p) { struct fimc_is *is = dev_get_drvdata(dev); struct v4l2_subdev *sd; struct fimc_md *fmd = p; int i, ret; if (is == NULL) return -ENXIO; for (i = 0; i < is->pdata->num_sensors; i++) { sd = &is->sensor[i].subdev; ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); if (ret) { v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC-IS-SENSOR (%d)\n", ret); return ret; } } sd = &is->isp.subdev; ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); if (ret) { v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC-ISP (%d)\n", ret); return ret; } pr_info("v4l2_device_register_subdev : FIMC-IS (%d)\n", is->pdev->id); fmd->fimc_is = is; return 0; }
/* * MIPI CSIS and FIMC platform devices registration. */ static int fimc_register_callback(struct device *dev, void *p) { struct fimc_dev *fimc = dev_get_drvdata(dev); struct v4l2_subdev *sd = &fimc->vid_cap.subdev; struct fimc_md *fmd = p; int ret = 0; if (!fimc || !fimc->pdev) return 0; if (fimc->pdev->id < 0 || fimc->pdev->id >= FIMC_MAX_DEVS) return 0; fimc->pipeline_ops = &fimc_pipeline_ops; fmd->fimc[fimc->pdev->id] = fimc; sd->grp_id = FIMC_GROUP_ID; ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); if (ret) { v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n", fimc->id, ret); } return ret; }
int cx23888_ir_probe(struct cx23885_dev *dev) { struct cx23888_ir_state *state; struct v4l2_subdev *sd; struct v4l2_subdev_ir_parameters default_params; int ret; state = kzalloc(sizeof(struct cx23888_ir_state), GFP_KERNEL); if (state == NULL) return -ENOMEM; spin_lock_init(&state->rx_kfifo_lock); #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) state->rx_kfifo = kfifo_alloc(CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL, &state->rx_kfifo_lock); if (state->rx_kfifo == NULL) return -ENOMEM; #else if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL)) return -ENOMEM; #endif state->dev = dev; state->id = V4L2_IDENT_CX23888_IR; state->rev = 0; sd = &state->sd; v4l2_subdev_init(sd, &cx23888_ir_controller_ops); v4l2_set_subdevdata(sd, state); /* FIXME - fix the formatting of dev->v4l2_dev.name and use it */ snprintf(sd->name, sizeof(sd->name), "%s/888-ir", dev->name); sd->grp_id = CX23885_HW_888_IR; ret = v4l2_device_register_subdev(&dev->v4l2_dev, sd); if (ret == 0) { /* * Ensure no interrupts arrive from '888 specific conditions, * since we ignore them in this driver to have commonality with * similar IR controller cores. */ cx23888_ir_write4(dev, CX23888_IR_IRQEN_REG, 0); mutex_init(&state->rx_params_lock); memcpy(&default_params, &default_rx_params, sizeof(struct v4l2_subdev_ir_parameters)); v4l2_subdev_call(sd, ir, rx_s_parameters, &default_params); mutex_init(&state->tx_params_lock); memcpy(&default_params, &default_tx_params, sizeof(struct v4l2_subdev_ir_parameters)); v4l2_subdev_call(sd, ir, tx_s_parameters, &default_params); } else { #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) kfifo_free(state->rx_kfifo); #else kfifo_free(&state->rx_kfifo); #endif } return ret; }
/* * MIPI-CSIS, FIMC and FIMC-LITE platform devices registration. */ static int register_fimc_lite_entity(struct fimc_md *fmd, struct fimc_lite *fimc_lite) { struct v4l2_subdev *sd; struct exynos_media_pipeline *ep; int ret; if (WARN_ON(fimc_lite->index >= FIMC_LITE_MAX_DEVS || fmd->fimc_lite[fimc_lite->index])) return -EBUSY; sd = &fimc_lite->subdev; sd->grp_id = GRP_ID_FLITE; ep = fimc_md_pipeline_create(fmd); if (!ep) return -ENOMEM; v4l2_set_subdev_hostdata(sd, ep); ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); if (!ret) fmd->fimc_lite[fimc_lite->index] = fimc_lite; else v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.LITE%d\n", fimc_lite->index); return ret; }
int atomisp_subdev_register_entities(struct atomisp_sub_device *isp_subdev, struct v4l2_device *vdev) { int ret; /* Register the subdev and video node. */ ret = v4l2_device_register_subdev(vdev, &isp_subdev->subdev); if (ret < 0) goto error; ret = atomisp_video_register(&isp_subdev->video_out_mo, vdev); if (ret < 0) goto error; ret = atomisp_video_register(&isp_subdev->video_out_vf, vdev); if (ret < 0) goto error; ret = atomisp_video_register(&isp_subdev->video_in, vdev); if (ret < 0) goto error; return 0; error: atomisp_subdev_unregister_entities(isp_subdev); return ret; }
int cx18_gpio_register(struct cx18 *cx, u32 hw) { struct v4l2_subdev *sd; const struct v4l2_subdev_ops *ops; char *str; switch (hw) { case CX18_HW_GPIO_MUX: sd = &cx->sd_gpiomux; ops = &gpiomux_ops; str = "gpio-mux"; break; case CX18_HW_GPIO_RESET_CTRL: sd = &cx->sd_resetctrl; ops = &resetctrl_ops; str = "gpio-reset-ctrl"; break; default: return -EINVAL; } v4l2_subdev_init(sd, ops); v4l2_set_subdevdata(sd, cx); snprintf(sd->name, sizeof(sd->name), "%s %s", cx->v4l2_dev.name, str); sd->grp_id = hw; return v4l2_device_register_subdev(&cx->v4l2_dev, sd); }
static int register_fimc_entity(struct fimc_md *fmd, struct fimc_dev *fimc) { struct v4l2_subdev *sd; struct exynos_media_pipeline *ep; int ret; if (WARN_ON(fimc->id >= FIMC_MAX_DEVS || fmd->fimc[fimc->id])) return -EBUSY; sd = &fimc->vid_cap.subdev; sd->grp_id = GRP_ID_FIMC; ep = fimc_md_pipeline_create(fmd); if (!ep) return -ENOMEM; v4l2_set_subdev_hostdata(sd, ep); ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); if (!ret) { if (!fmd->pmf && fimc->pdev) fmd->pmf = &fimc->pdev->dev; fmd->fimc[fimc->id] = fimc; fimc->vid_cap.user_subdev_api = fmd->user_subdev_api; } else { v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n", fimc->id, ret); } return ret; }
static int csis_register_callback(struct device *dev, void *p) { struct v4l2_subdev *sd = dev_get_drvdata(dev); struct platform_device *pdev; struct fimc_md *fmd = p; int id, ret; if (!sd) return 0; pdev = v4l2_get_subdevdata(sd); if (!pdev || pdev->id < 0 || pdev->id >= CSIS_MAX_ENTITIES) return 0; v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name); id = pdev->id < 0 ? 0 : pdev->id; sd->grp_id = CSIS_GROUP_ID; ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); if (!ret) fmd->csis[id].sd = sd; else v4l2_err(&fmd->v4l2_dev, "Failed to register CSIS subdevice: %d\n", ret); return ret; }
struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, struct spi_master *master, struct spi_board_info *info) { struct v4l2_subdev *sd = NULL; struct spi_device *spi = NULL; BUG_ON(!v4l2_dev); if (info->modalias) request_module(info->modalias); spi = spi_new_device(master, info); if (spi == NULL || spi->dev.driver == NULL) goto error; if (!try_module_get(spi->dev.driver->owner)) goto error; sd = spi_get_drvdata(spi); if (v4l2_device_register_subdev(v4l2_dev, sd)) sd = NULL; module_put(spi->dev.driver->owner); error: if (spi && sd == NULL) spi_unregister_device(spi); return sd; }
static int fimc_lite_register_callback(struct device *dev, void *p) { struct fimc_lite *fimc = dev_get_drvdata(dev); struct v4l2_subdev *sd = &fimc->subdev; struct fimc_md *fmd = p; int ret; if (fimc == NULL) return 0; if (fimc->index >= FIMC_LITE_MAX_DEVS) return 0; fimc->pipeline_ops = &fimc_pipeline_ops; fmd->fimc_lite[fimc->index] = fimc; sd->grp_id = FLITE_GROUP_ID; ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); if (ret) { v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC-LITE.%d (%d)\n", fimc->index, ret); } return ret; }
int ivtv_gpio_init(struct ivtv *itv) { u16 pin = 0; if (itv->card->xceive_pin) pin = 1 << itv->card->xceive_pin; if ((itv->card->gpio_init.direction | pin) == 0) return 0; IVTV_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n", read_reg(IVTV_REG_GPIO_DIR), read_reg(IVTV_REG_GPIO_OUT)); /* init output data then direction */ write_reg(itv->card->gpio_init.initial_value | pin, IVTV_REG_GPIO_OUT); write_reg(itv->card->gpio_init.direction | pin, IVTV_REG_GPIO_DIR); v4l2_subdev_init(&itv->sd_gpio, &subdev_ops); snprintf(itv->sd_gpio.name, sizeof(itv->sd_gpio.name), "%s-gpio", itv->v4l2_dev.name); itv->sd_gpio.grp_id = IVTV_HW_GPIO; v4l2_ctrl_handler_init(&itv->hdl_gpio, 1); v4l2_ctrl_new_std(&itv->hdl_gpio, &gpio_ctrl_ops, V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0); if (itv->hdl_gpio.error) return itv->hdl_gpio.error; itv->sd_gpio.ctrl_handler = &itv->hdl_gpio; v4l2_ctrl_handler_setup(&itv->hdl_gpio); return v4l2_device_register_subdev(&itv->v4l2_dev, &itv->sd_gpio); }
int vpfe_resizer_register_entities(struct vpfe_resizer_device *resizer, struct v4l2_device *vdev) { int ret; unsigned int flags = 0; struct vpfe_device *vpfe_dev = to_vpfe_device(resizer); /* Register the subdev */ ret = v4l2_device_register_subdev(vdev, &resizer->subdev); if (ret < 0) { printk(KERN_ERR "failed to register resizer as v4l2-subdev\n"); return ret; } ret = vpfe_video_register(&resizer->video_in, vdev); if (ret) { printk(KERN_ERR "failed to register RSZ video-in device\n"); goto out_video_in_register; } resizer->video_in.vpfe_dev = vpfe_dev; ret = vpfe_video_register(&resizer->video_out, vdev); if (ret) { printk(KERN_ERR "failed to register RSZ video-out device\n"); goto out_video_out_register; } resizer->video_out.vpfe_dev = vpfe_dev; ret = media_entity_create_link(&resizer->video_in.video_dev.entity, 0, &resizer->subdev.entity, 0, flags); if (ret < 0) goto out_create_link; ret = media_entity_create_link(&resizer->subdev.entity, 1, &resizer->video_out.video_dev.entity, 0, flags); if (ret < 0) goto out_create_link; return 0; out_create_link: vpfe_video_unregister(&resizer->video_out); out_video_out_register: vpfe_video_unregister(&resizer->video_in); out_video_in_register: media_entity_cleanup(&resizer->subdev.entity); v4l2_device_unregister_subdev(&resizer->subdev); return ret; }
/* Register I2C client subdev associated with @node. */ static int fimc_md_of_add_sensor(struct fimc_md *fmd, struct device_node *node, int index) { struct fimc_sensor_info *si; struct i2c_client *client; struct v4l2_subdev *sd; int ret; if (WARN_ON(index >= ARRAY_SIZE(fmd->sensor))) return -EINVAL; si = &fmd->sensor[index]; client = of_find_i2c_device_by_node(node); if (!client) return -EPROBE_DEFER; device_lock(&client->dev); if (!client->driver || !try_module_get(client->driver->driver.owner)) { ret = -EPROBE_DEFER; v4l2_info(&fmd->v4l2_dev, "No driver found for %s\n", node->full_name); goto dev_put; } /* Enable sensor's master clock */ ret = __fimc_md_set_camclk(fmd, &si->pdata, true); if (ret < 0) goto mod_put; sd = i2c_get_clientdata(client); ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); __fimc_md_set_camclk(fmd, &si->pdata, false); if (ret < 0) goto mod_put; v4l2_set_subdev_hostdata(sd, &si->pdata); if (si->pdata.fimc_bus_type == FIMC_BUS_TYPE_ISP_WRITEBACK) sd->grp_id = GRP_ID_FIMC_IS_SENSOR; else sd->grp_id = GRP_ID_SENSOR; si->subdev = sd; v4l2_info(&fmd->v4l2_dev, "Registered sensor subdevice: %s (%d)\n", sd->name, fmd->num_sensors); fmd->num_sensors++; mod_put: module_put(client->driver->driver.owner); dev_put: device_unlock(&client->dev); put_device(&client->dev); return ret; }
static int __devinit __wfd_probe(struct platform_device *pdev) { int rc = 0; struct wfd_device *wfd_dev; WFD_MSG_DBG("__wfd_probe: E\n"); wfd_dev = kzalloc(sizeof(*wfd_dev), GFP_KERNEL); /*TODO: Free it*/ if (!wfd_dev) { WFD_MSG_ERR("Could not allocate memory for " "wfd device\n"); return -ENOMEM; } pdev->dev.platform_data = (void *) wfd_dev; rc = v4l2_device_register(&pdev->dev, &wfd_dev->v4l2_dev); if (rc) { WFD_MSG_ERR("Failed to register the video device\n"); goto err_v4l2_registration; } wfd_dev->pvdev = video_device_alloc(); if (!wfd_dev->pvdev) { WFD_MSG_ERR("Failed to allocate video device\n"); goto err_video_device_alloc; } wfd_dev->pvdev->release = release_video_device; wfd_dev->pvdev->fops = &g_wfd_fops; wfd_dev->pvdev->ioctl_ops = &g_wfd_ioctl_ops; rc = video_register_device(wfd_dev->pvdev, VFL_TYPE_GRABBER, -1); if (rc) { WFD_MSG_ERR("Failed to register the device\n"); goto err_video_register_device; } video_set_drvdata(wfd_dev->pvdev, wfd_dev); v4l2_subdev_init(&wfd_dev->mdp_sdev, &mdp_subdev_ops); strncpy(wfd_dev->mdp_sdev.name, "wfd-mdp", V4L2_SUBDEV_NAME_SIZE); rc = v4l2_device_register_subdev(&wfd_dev->v4l2_dev, &wfd_dev->mdp_sdev); if (rc) { WFD_MSG_ERR("Failed to register mdp subdevice: %d\n", rc); goto err_mdp_register_subdev; } WFD_MSG_DBG("__wfd_probe: X\n"); return rc; err_mdp_register_subdev: video_unregister_device(wfd_dev->pvdev); err_video_register_device: video_device_release(wfd_dev->pvdev); err_video_device_alloc: v4l2_device_unregister(&wfd_dev->v4l2_dev); err_v4l2_registration: kfree(wfd_dev); return rc; }
int register_nxp_resc(struct nxp_resc *me) { int ret; pr_debug("%s\n", __func__); ret = v4l2_device_register_subdev(nxp_v4l2_get_v4l2_device(), &me->subdev); if (ret < 0) { pr_err("%s: failed to v4l2_device_register_subdev()\n", __func__); return ret; } return 0; }
int atomisp_tpg_register_entities(struct atomisp_tpg_device *tpg, struct v4l2_device *vdev) { int ret; /* Register the subdev and video nodes. */ ret = v4l2_device_register_subdev(vdev, &tpg->sd); if (ret < 0) goto error; return 0; error: atomisp_tpg_unregister_entities(tpg); return ret; }
static int hdmi_register_entity(struct hdmi_device *hdev) { struct v4l2_subdev *sd = &hdev->sd; struct v4l2_device *v4l2_dev; struct media_pad *pads = &hdev->pad; struct media_entity *me = &sd->entity; struct device *dev = hdev->dev; struct exynos_md *md; int ret; dev_dbg(dev, "HDMI entity init\n"); /* init hdmi subdev */ v4l2_subdev_init(sd, &hdmi_sd_ops); sd->owner = THIS_MODULE; strlcpy(sd->name, "s5p-hdmi", sizeof(sd->name)); dev_set_drvdata(dev, sd); /* init hdmi sub-device as entity */ pads[HDMI_PAD_SINK].flags = MEDIA_PAD_FL_SINK; me->ops = &hdmi_entity_ops; ret = media_entity_init(me, HDMI_PADS_NUM, pads, 0); if (ret) { dev_err(dev, "failed to initialize media entity\n"); return ret; } /* get output media ptr for registering hdmi's sd */ md = (struct exynos_md *)module_name_to_driver_data(MDEV_MODULE_NAME); if (!md) { dev_err(dev, "failed to get output media device\n"); return -ENODEV; } v4l2_dev = &md->v4l2_dev; /* regiser HDMI subdev as entity to v4l2_dev pointer of * output media device */ ret = v4l2_device_register_subdev(v4l2_dev, sd); if (ret) { dev_err(dev, "failed to register HDMI subdev\n"); return ret; } return 0; }
int atomisp_mipi_csi2_register_entities(struct atomisp_mipi_csi2_device *csi2, struct v4l2_device *vdev) { int ret; /* Register the subdev and video nodes. */ ret = v4l2_device_register_subdev(vdev, &csi2->subdev); if (ret < 0) goto error; return 0; error: atomisp_mipi_csi2_unregister_entities(csi2); return ret; }
int omap4iss_ipipe_register_entities(struct iss_ipipe_device *ipipe, struct v4l2_device *vdev) { int ret; /* Register the subdev and video node. */ ret = v4l2_device_register_subdev(vdev, &ipipe->subdev); if (ret < 0) goto error; return 0; error: omap4iss_ipipe_unregister_entities(ipipe); return ret; }
/* Load an i2c sub-device. */ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, struct i2c_adapter *adapter, struct i2c_board_info *info, const unsigned short *probe_addrs) { struct v4l2_subdev *sd = NULL; struct i2c_client *client; BUG_ON(!v4l2_dev); request_module(I2C_MODULE_PREFIX "%s", info->type); /* Create the i2c client */ if (info->addr == 0 && probe_addrs) client = i2c_new_probed_device(adapter, info, probe_addrs, NULL); else client = i2c_new_device(adapter, info); /* Note: by loading the module first we are certain that c->driver will be set if the driver was found. If the module was not loaded first, then the i2c core tries to delay-load the module for us, and then c->driver is still NULL until the module is finally loaded. This delay-load mechanism doesn't work if other drivers want to use the i2c device, so explicitly loading the module is the best alternative. */ if (client == NULL || client->driver == NULL) goto error; /* Lock the module so we can safely get the v4l2_subdev pointer */ if (!try_module_get(client->driver->driver.owner)) goto error; sd = i2c_get_clientdata(client); /* Register with the v4l2_device which increases the module's use count as well. */ if (v4l2_device_register_subdev(v4l2_dev, sd)) sd = NULL; /* Decrease the module use count to match the first try_module_get. */ module_put(client->driver->driver.owner); error: /* If we have a client but no subdev, then something went wrong and we must unregister the client. */ if (client && sd == NULL) i2c_unregister_device(client); return sd; }
static int soc_camera_platform_probe(struct platform_device *pdev) { struct soc_camera_host *ici; struct soc_camera_platform_priv *priv; struct soc_camera_platform_info *p = pdev->dev.platform_data; struct soc_camera_device *icd; int ret; if (!p) return -EINVAL; if (!p->icd) { dev_err(&pdev->dev, "Platform has not set soc_camera_device pointer!\n"); return -EINVAL; } priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; icd = p->icd; /* soc-camera convention: control's drvdata points to the subdev */ platform_set_drvdata(pdev, &priv->subdev); /* Set the control device reference */ icd->control = &pdev->dev; ici = to_soc_camera_host(icd->parent); v4l2_subdev_init(&priv->subdev, &platform_subdev_ops); v4l2_set_subdevdata(&priv->subdev, p); strncpy(priv->subdev.name, dev_name(&pdev->dev), V4L2_SUBDEV_NAME_SIZE); ret = v4l2_device_register_subdev(&ici->v4l2_dev, &priv->subdev); if (ret) goto evdrs; return ret; evdrs: platform_set_drvdata(pdev, NULL); kfree(priv); return ret; }
static int gsc_capture_create_subdev(struct gsc_dev *gsc) { struct v4l2_device *v4l2_dev; struct v4l2_subdev *sd; int ret; sd = kzalloc(sizeof(*sd), GFP_KERNEL); if (!sd) return -ENOMEM; v4l2_subdev_init(sd, &gsc_cap_subdev_ops); sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE; snprintf(sd->name, sizeof(sd->name), "gsc-cap-subdev.%d", gsc->id); gsc->cap.sd_pads[GSC_PAD_SINK].flags = MEDIA_PAD_FL_SINK; gsc->cap.sd_pads[GSC_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_init(&sd->entity, GSC_PADS_NUM, gsc->cap.sd_pads, 0); if (ret) goto err_ent; sd->internal_ops = &gsc_cap_v4l2_internal_ops; sd->entity.ops = &gsc_cap_media_ops; sd->grp_id = GSC_CAP_GRP_ID; v4l2_dev = &gsc->mdev[MDEV_CAPTURE]->v4l2_dev; ret = v4l2_device_register_subdev(v4l2_dev, sd); if (ret) goto err_sub; gsc->mdev[MDEV_CAPTURE]->gsc_cap_sd[gsc->id] = sd; gsc->cap.sd_cap = sd; v4l2_set_subdevdata(sd, gsc); gsc_capture_init_formats(sd, NULL); return 0; err_sub: media_entity_cleanup(&sd->entity); err_ent: kfree(sd); return ret; }
int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2, struct v4l2_device *vdev) { int ret; /* Register the subdev and video nodes. */ ret = v4l2_device_register_subdev(vdev, &csi2->subdev); if (ret < 0) goto error; ret = omap3isp_video_register(&csi2->video_out, vdev); if (ret < 0) goto error; return 0; error: omap3isp_csi2_unregister_entities(csi2); return ret; }
int omap4iss_ipipeif_register_entities(struct iss_ipipeif_device *ipipeif, struct v4l2_device *vdev) { int ret; /* Register the subdev and video node. */ ret = v4l2_device_register_subdev(vdev, &ipipeif->subdev); if (ret < 0) goto error; ret = omap4iss_video_register(&ipipeif->video_out, vdev); if (ret < 0) goto error; return 0; error: omap4iss_ipipeif_unregister_entities(ipipeif); return ret; }
/* * register irq * register switch dev */ int register_nxp_hdmi(struct nxp_hdmi *me) { int ret; pr_debug("%s\n", __func__); ret = v4l2_device_register_subdev(nxp_v4l2_get_v4l2_device(), &me->sd); if (ret < 0) { pr_err("%s: failed to v4l2_device_register_subdev()\n", __func__); return ret; } ret = hdmi_init_context(&me->ctx, me->plat_data->edid, me->plat_data->hdcp); if (ret) { pr_err("%s: failed to hdmi_init_context()\n", __func__); return ret; } hdmi_hook_set_mux(&me->ctx, _set_hdmi_mux); return 0; }
int ivtv_gpio_init(struct ivtv *itv) { u16 pin = 0; if (itv->card->xceive_pin) pin = 1 << itv->card->xceive_pin; if ((itv->card->gpio_init.direction | pin) == 0) return 0; IVTV_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n", read_reg(IVTV_REG_GPIO_DIR), read_reg(IVTV_REG_GPIO_OUT)); /* init output data then direction */ write_reg(itv->card->gpio_init.initial_value | pin, IVTV_REG_GPIO_OUT); write_reg(itv->card->gpio_init.direction | pin, IVTV_REG_GPIO_DIR); v4l2_subdev_init(&itv->sd_gpio, &subdev_ops); snprintf(itv->sd_gpio.name, sizeof(itv->sd_gpio.name), "%s-gpio", itv->v4l2_dev.name); itv->sd_gpio.grp_id = IVTV_HW_GPIO; return v4l2_device_register_subdev(&itv->v4l2_dev, &itv->sd_gpio); }
static int loopback_sensor_probe(struct platform_device *pdev) { struct v4l2_subdev *sd; struct nxp_loopback_sensor *me = &_context; int ret; sd = &me->sd; strcpy(sd->name, "loopback-sensor"); v4l2_subdev_init(sd, &loopback_sensor_ops); v4l2_set_subdevdata(sd, me); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; me->pad.flags = MEDIA_PAD_FL_SOURCE; sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; ret = media_entity_init(&sd->entity, 1, &me->pad, 0); if (ret < 0) { pr_err("%s: failed to media_entity_init()\n", __func__); return ret; } pr_err("%s: v4l2 device check!!\n", __func__); if( nxp_v4l2_get_v4l2_device() == NULL ) { pr_err("%s: error : nxp_v4l2_get_v4l2_device function is null!!\n", __func__); } ret = v4l2_device_register_subdev(nxp_v4l2_get_v4l2_device(), &me->sd); if (ret < 0) { pr_err("%s: failed to v4l2_device_register_subdev()\n", __func__); return ret; } nxp_v4l2_capture_set_sensor_subdev(&me->sd); me->dpc_module = 1; return 0; }
int atomisp_subdev_register_entities(struct atomisp_sub_device *asd, struct v4l2_device *vdev) { int ret; /* Register the subdev and video node. */ ret = v4l2_device_register_subdev(vdev, &asd->subdev); if (ret < 0) goto error; ret = atomisp_video_register(&asd->video_out_capture, vdev); if (ret < 0) goto error; ret = atomisp_video_register(&asd->video_out_vf, vdev); if (ret < 0) goto error; ret = atomisp_video_register(&asd->video_out_preview, vdev); if (ret < 0) goto error; /* * file input only supported on subdev0 * so do not create video node for subdevs other then subdev0 */ if (asd->index) return 0; ret = atomisp_video_register(&asd->video_in, vdev); if (ret < 0) goto error; return 0; error: atomisp_subdev_unregister_entities(asd); return ret; }
static int fimc_lite_register_callback(struct device *dev, void *p) { struct fimc_lite *fimc = dev_get_drvdata(dev); struct fimc_md *fmd = p; int ret; if (fimc == NULL || fimc->index >= FIMC_LITE_MAX_DEVS) return 0; fimc->subdev.grp_id = FLITE_GROUP_ID; v4l2_set_subdev_hostdata(&fimc->subdev, (void *)&fimc_pipeline_ops); ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev); if (ret) { v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC-LITE.%d (%d)\n", fimc->index, ret); return ret; } fmd->fimc_lite[fimc->index] = fimc; return 0; }
static int register_fimc_is_entity(struct fimc_md *fmd, struct fimc_is *is) { struct v4l2_subdev *sd = &is->isp.subdev; struct exynos_media_pipeline *ep; int ret; /* Allocate pipeline object for the ISP capture video node. */ ep = fimc_md_pipeline_create(fmd); if (!ep) return -ENOMEM; v4l2_set_subdev_hostdata(sd, ep); ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); if (ret) { v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC-ISP (%d)\n", ret); return ret; } fmd->fimc_is = is; return 0; }