Lines Matching refs:sd

36     return container_of(subdev, struct csi2_dphy, sd);

39 static struct v4l2_subdev *get_remote_sensor(struct v4l2_subdev *sd)
44 local = &sd->entity.pads[CSI2_DPHY_RX_PAD_SINK];
47 v4l2_warn(sd, "No link between dphy and sensor\n");
55 static struct csi2_sensor *sd_to_sensor(struct csi2_dphy *dphy, struct v4l2_subdev *sd)
60 if (dphy->sensors[i].sd == sd) {
68 static int csi2_dphy_get_sensor_data_rate(struct v4l2_subdev *sd)
70 struct csi2_dphy *dphy = to_csi2_dphy(sd);
71 struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
80 v4l2_warn(sd, "No pixel rate control in subdev\n");
87 v4l2_err(sd, "Failed to get menu item\n");
92 v4l2_err(sd, "Invalid link_freq\n");
97 v4l2_info(sd, "dphy%d, data_rate_mbps %lld\n", dphy->phy_index, dphy->data_rate_mbps);
101 static int csi2_dphy_update_sensor_mbus(struct v4l2_subdev *sd)
103 struct csi2_dphy *dphy = to_csi2_dphy(sd);
104 struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
135 static int csi2_dphy_s_stream_start(struct v4l2_subdev *sd)
137 struct csi2_dphy *dphy = to_csi2_dphy(sd);
145 ret = csi2_dphy_get_sensor_data_rate(sd);
150 csi2_dphy_update_sensor_mbus(sd);
153 hw->stream_on(dphy, sd);
161 static int csi2_dphy_s_stream_stop(struct v4l2_subdev *sd)
163 struct csi2_dphy *dphy = to_csi2_dphy(sd);
171 hw->stream_off(dphy, sd);
181 static int csi2_dphy_s_stream(struct v4l2_subdev *sd, int on)
183 struct csi2_dphy *dphy = to_csi2_dphy(sd);
188 ret = csi2_dphy_s_stream_start(sd);
190 ret = csi2_dphy_s_stream_stop(sd);
199 static int csi2_dphy_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *fi)
201 struct v4l2_subdev *sensor = get_remote_sensor(sd);
210 static int csi2_dphy_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, struct v4l2_mbus_config *config)
212 struct csi2_dphy *dphy = to_csi2_dphy(sd);
213 struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
220 csi2_dphy_update_sensor_mbus(sd);
226 static int csi2_dphy_s_power(struct v4l2_subdev *sd, int on)
228 struct csi2_dphy *dphy = to_csi2_dphy(sd);
240 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(me);
241 struct csi2_dphy *dphy = to_csi2_dphy(sd);
254 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(me);
255 struct csi2_dphy *dphy = to_csi2_dphy(sd);
271 static int csi2_dphy_get_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
274 struct csi2_dphy *dphy = to_csi2_dphy(sd);
275 struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
292 static int csi2_dphy_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
295 struct v4l2_subdev *sensor = get_remote_sensor(sd);
323 static int rockchip_csi2_dphy_notifier_bound(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd,
338 sensor->sd = sd;
340 dev_info(dphy->dev, "dphy%d matches %s:bus type %d\n", dphy->phy_index, sd->name, s_asd->mbus.type);
342 for (pad = 0; pad < sensor->sd->entity.num_pads; pad++) {
343 if (sensor->sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE) {
348 if (pad == sensor->sd->entity.num_pads) {
349 dev_err(dphy->dev, "failed to find src pad for %s\n", sensor->sd->name);
354 ret = media_create_pad_link(&sensor->sd->entity, pad, &dphy->sd.entity, CSI2_DPHY_RX_PAD_SINK,
357 dev_err(dphy->dev, "failed to create link for %s\n", sensor->sd->name);
365 static void rockchip_csi2_dphy_notifier_unbind(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd,
369 struct csi2_sensor *sensor = sd_to_sensor(dphy, sd);
371 sensor->sd = NULL;
425 dphy->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
426 ret = media_entity_pads_init(&dphy->sd.entity, CSI2_DPHY_RX_PADS_NUM, dphy->pads);
439 dphy->sd.subdev_notifier = &dphy->notifier;
441 ret = v4l2_async_subdev_notifier_register(&dphy->sd, &dphy->notifier);
448 return v4l2_async_register_subdev(&dphy->sd);
553 struct v4l2_subdev *sd;
579 sd = &csi2dphy->sd;
581 v4l2_subdev_init(sd, &csi2_dphy_subdev_ops);
582 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
583 snprintf(sd->name, sizeof(sd->name), "rockchip-csi2-dphy%d", csi2dphy->phy_index);
584 sd->dev = dev;
586 platform_set_drvdata(pdev, &sd->entity);
609 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(me);
610 struct csi2_dphy *dphy = to_csi2_dphy(sd);
612 media_entity_cleanup(&sd->entity);