Lines Matching defs:dphy

24 #include "phy-rockchip-csi2-dphy-common.h"

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)
59 for (i = 0; i < dphy->num_sensors; ++i) {
60 if (dphy->sensors[i].sd == sd) {
61 return &dphy->sensors[i];
70 struct csi2_dphy *dphy = to_csi2_dphy(sd);
95 dphy->data_rate_mbps = qm.value * 0x02;
96 do_div(dphy->data_rate_mbps, 0x3E8 * 0x3E8);
97 v4l2_info(sd, "dphy%d, data_rate_mbps %lld\n", dphy->phy_index, dphy->data_rate_mbps);
103 struct csi2_dphy *dphy = to_csi2_dphy(sd);
105 struct csi2_sensor *sensor = sd_to_sensor(dphy, sensor_sd);
137 struct csi2_dphy *dphy = to_csi2_dphy(sd);
138 struct csi2_dphy_hw *hw = dphy->dphy_hw;
141 if (dphy->is_streaming) {
153 hw->stream_on(dphy, sd);
156 dphy->is_streaming = true;
163 struct csi2_dphy *dphy = to_csi2_dphy(sd);
164 struct csi2_dphy_hw *hw = dphy->dphy_hw;
166 if (!dphy->is_streaming) {
171 hw->stream_off(dphy, sd);
174 dphy->is_streaming = false;
176 dev_info(dphy->dev, "%s stream stop, dphy%d\n", __func__, dphy->phy_index);
183 struct csi2_dphy *dphy = to_csi2_dphy(sd);
186 mutex_lock(&dphy->mutex);
192 mutex_unlock(&dphy->mutex);
194 dev_info(dphy->dev, "%s stream on:%d, dphy%d\n", __func__, on, dphy->phy_index);
212 struct csi2_dphy *dphy = to_csi2_dphy(sd);
219 sensor = sd_to_sensor(dphy, sensor_sd);
228 struct csi2_dphy *dphy = to_csi2_dphy(sd);
231 return pm_runtime_get_sync(dphy->dev);
233 return pm_runtime_put(dphy->dev);
241 struct csi2_dphy *dphy = to_csi2_dphy(sd);
242 struct csi2_dphy_hw *hw = dphy->dphy_hw;
255 struct csi2_dphy *dphy = to_csi2_dphy(sd);
256 struct csi2_dphy_hw *hw = dphy->dphy_hw;
270 /* dphy accepts all fmt/size from sensor */
274 struct csi2_dphy *dphy = to_csi2_dphy(sd);
276 struct csi2_sensor *sensor = sd_to_sensor(dphy, sensor_sd);
326 struct csi2_dphy *dphy = container_of(notifier, struct csi2_dphy, notifier);
331 if (dphy->num_sensors == ARRAY_SIZE(dphy->sensors)) {
335 sensor = &dphy->sensors[dphy->num_sensors++];
340 dev_info(dphy->dev, "dphy%d matches %s:bus type %d\n", dphy->phy_index, sd->name, s_asd->mbus.type);
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,
355 dphy->num_sensors != 1 ? 0 : MEDIA_LNK_FL_ENABLED);
357 dev_err(dphy->dev, "failed to create link for %s\n", sensor->sd->name);
368 struct csi2_dphy *dphy = container_of(notifier, struct csi2_dphy, notifier);
369 struct csi2_sensor *sensor = sd_to_sensor(dphy, sd);
419 static int rockchip_csi2dphy_media_init(struct csi2_dphy *dphy)
423 dphy->pads[CSI2_DPHY_RX_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE | MEDIA_PAD_FL_MUST_CONNECT;
424 dphy->pads[CSI2_DPHY_RX_PAD_SINK].flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
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);
431 v4l2_async_notifier_init(&dphy->notifier);
434 dphy->dev, &dphy->notifier, sizeof(struct sensor_async_subdev), 0, rockchip_csi2_dphy_fwnode_parse);
439 dphy->sd.subdev_notifier = &dphy->notifier;
440 dphy->notifier.ops = &rockchip_csi2_dphy_async_ops;
441 ret = v4l2_async_subdev_notifier_register(&dphy->sd, &dphy->notifier);
443 dev_err(dphy->dev, "failed to register async notifier : %d\n", ret);
444 v4l2_async_notifier_cleanup(&dphy->notifier);
448 return v4l2_async_register_subdev(&dphy->sd);
451 static int rockchip_csi2_dphy_attach_hw(struct csi2_dphy *dphy)
454 struct device *dev = dphy->dev;
460 if (dphy->phy_index % 3 == 0) {
468 dev_err(dphy->dev, "failed to get dphy%d hw node\n", dphy->phy_index);
475 dev_err(dphy->dev, "failed to get dphy%d hw from node\n", dphy->phy_index);
481 dev_err(dphy->dev, "failed attach dphy%d hw\n", dphy->phy_index);
498 dev_err(dphy->dev, "Err:csi2 dphy hw has been set as %s mode by phy%d, target mode is:%s\n",
505 dphy_hw->dphy_dev[dphy_hw->dphy_dev_num] = dphy;
507 dphy->dphy_hw = dphy_hw;
512 static int rockchip_csi2_dphy_detach_hw(struct csi2_dphy *dphy)
514 struct csi2_dphy_hw *dphy_hw = dphy->dphy_hw;
520 if (csi2_dphy && csi2_dphy->phy_index == dphy->phy_index) {
539 .compatible = "rockchip,rk3568-csi2-dphy",
575 dev_err(dev, "csi2 dphy hw can't be attached, register dphy%d failed!\n", csi2dphy->phy_index);
583 snprintf(sd->name, sizeof(sd->name), "rockchip-csi2-dphy%d", csi2dphy->phy_index);
595 dev_info(dev, "csi2 dphy%d probe successfully!\n", csi2dphy->phy_index);
610 struct csi2_dphy *dphy = to_csi2_dphy(sd);
615 mutex_destroy(&dphy->mutex);
627 .name = "rockchip-csi2-dphy",