Lines Matching +full:ds90ub913a +full:- +full:q1
1 // SPDX-License-Identifier: GPL-2.0
11 #include <linux/clk-provider.h>
16 #include <linux/i2c-atr.h>
24 #include <media/v4l2-fwnode.h>
25 #include <media/v4l2-mediabus.h>
26 #include <media/v4l2-subdev.h>
102 /* Only RAW10 with 8-bit payload is supported at the moment */
126 ret = regmap_read(priv->regmap, reg, &v); in ub913_read()
128 dev_err(&priv->client->dev, in ub913_read()
141 ret = regmap_write(priv->regmap, reg, val); in ub913_write()
143 dev_err(&priv->client->dev, in ub913_write()
164 return regmap_update_bits(priv->regmap, UB913_REG_GPIO_CFG(reg_idx), in ub913_gpio_direction_out()
181 *flags = gpiospec->args[1]; in ub913_gpio_of_xlate()
183 return gpiospec->args[0]; in ub913_gpio_of_xlate()
188 struct device *dev = &priv->client->dev; in ub913_gpiochip_probe()
189 struct gpio_chip *gc = &priv->gpio_chip; in ub913_gpiochip_probe()
192 /* Initialize GPIOs 0 and 1 to local control, tri-state */ in ub913_gpiochip_probe()
195 gc->label = dev_name(dev); in ub913_gpiochip_probe()
196 gc->parent = dev; in ub913_gpiochip_probe()
197 gc->owner = THIS_MODULE; in ub913_gpiochip_probe()
198 gc->base = -1; in ub913_gpiochip_probe()
199 gc->can_sleep = true; in ub913_gpiochip_probe()
200 gc->ngpio = UB913_NUM_GPIOS; in ub913_gpiochip_probe()
201 gc->get_direction = ub913_gpio_get_direction; in ub913_gpiochip_probe()
202 gc->direction_output = ub913_gpio_direction_out; in ub913_gpiochip_probe()
203 gc->set = ub913_gpio_set; in ub913_gpiochip_probe()
204 gc->of_xlate = ub913_gpio_of_xlate; in ub913_gpiochip_probe()
205 gc->of_gpio_n_cells = 2; in ub913_gpiochip_probe()
218 gpiochip_remove(&priv->gpio_chip); in ub913_gpiochip_remove()
245 ret = v4l2_subdev_enable_streams(priv->source_sd, priv->source_sd_pad, in ub913_enable_streams()
250 priv->enabled_source_streams |= streams_mask; in ub913_enable_streams()
267 ret = v4l2_subdev_disable_streams(priv->source_sd, priv->source_sd_pad, in ub913_disable_streams()
272 priv->enabled_source_streams &= ~streams_mask; in ub913_disable_streams()
310 if (routing->num_routes > V4L2_FRAME_DESC_ENTRY_MAX) in _ub913_set_routing()
311 return -EINVAL; in _ub913_set_routing()
322 stream_configs = &state->stream_configs; in _ub913_set_routing()
324 for (i = 0; i < stream_configs->num_configs; i++) { in _ub913_set_routing()
325 if (stream_configs->configs[i].pad == UB913_PAD_SINK) in _ub913_set_routing()
326 stream_configs->configs[i].fmt = in_format; in _ub913_set_routing()
328 stream_configs->configs[i].fmt = out_format; in _ub913_set_routing()
341 if (which == V4L2_SUBDEV_FORMAT_ACTIVE && priv->enabled_source_streams) in ub913_set_routing()
342 return -EBUSY; in ub913_set_routing()
358 return -EINVAL; in ub913_get_frame_desc()
360 ret = v4l2_subdev_call(priv->source_sd, pad, get_frame_desc, in ub913_get_frame_desc()
361 priv->source_sd_pad, &source_fd); in ub913_get_frame_desc()
365 fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL; in ub913_get_frame_desc()
369 routing = &state->routing; in ub913_get_frame_desc()
374 if (route->source_pad != pad) in ub913_get_frame_desc()
378 if (source_fd.entry[i].stream == route->sink_stream) in ub913_get_frame_desc()
383 dev_err(&priv->client->dev, in ub913_get_frame_desc()
385 ret = -EPIPE; in ub913_get_frame_desc()
389 fd->entry[fd->num_entries].stream = route->source_stream; in ub913_get_frame_desc()
390 fd->entry[fd->num_entries].flags = source_fd.entry[i].flags; in ub913_get_frame_desc()
391 fd->entry[fd->num_entries].length = source_fd.entry[i].length; in ub913_get_frame_desc()
392 fd->entry[fd->num_entries].pixelcode = in ub913_get_frame_desc()
395 fd->num_entries++; in ub913_get_frame_desc()
412 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE && in ub913_set_fmt()
413 priv->enabled_source_streams) in ub913_set_fmt()
414 return -EBUSY; in ub913_set_fmt()
417 if (format->pad == UB913_PAD_SOURCE) in ub913_set_fmt()
420 finfo = ub913_find_format(format->format.code); in ub913_set_fmt()
423 format->format.code = finfo->incode; in ub913_set_fmt()
427 fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream); in ub913_set_fmt()
429 return -EINVAL; in ub913_set_fmt()
431 *fmt = format->format; in ub913_set_fmt()
434 fmt = v4l2_subdev_state_get_opposite_stream_format(state, format->pad, in ub913_set_fmt()
435 format->stream); in ub913_set_fmt()
437 return -EINVAL; in ub913_set_fmt()
439 format->format.code = finfo->outcode; in ub913_set_fmt()
441 *fmt = format->format; in ub913_set_fmt()
470 struct device *dev = &priv->client->dev; in ub913_log_status()
525 struct ub913_data *priv = sd_to_ub913(notifier->sd); in ub913_notify_bound()
526 struct device *dev = &priv->client->dev; in ub913_notify_bound()
529 ret = media_entity_get_fwnode_pad(&source_subdev->entity, in ub913_notify_bound()
530 source_subdev->fwnode, in ub913_notify_bound()
534 source_subdev->name); in ub913_notify_bound()
538 priv->source_sd = source_subdev; in ub913_notify_bound()
539 priv->source_sd_pad = ret; in ub913_notify_bound()
541 ret = media_create_pad_link(&source_subdev->entity, priv->source_sd_pad, in ub913_notify_bound()
542 &priv->sd.entity, UB913_PAD_SINK, in ub913_notify_bound()
546 dev_err(dev, "Unable to link %s:%u -> %s:0\n", in ub913_notify_bound()
547 source_subdev->name, priv->source_sd_pad, in ub913_notify_bound()
548 priv->sd.name); in ub913_notify_bound()
561 struct device *dev = &priv->client->dev; in ub913_v4l2_notifier_register()
570 return -ENODEV; in ub913_v4l2_notifier_register()
573 v4l2_async_subdev_nf_init(&priv->notifier, &priv->sd); in ub913_v4l2_notifier_register()
575 asd = v4l2_async_nf_add_fwnode_remote(&priv->notifier, ep_fwnode, in ub913_v4l2_notifier_register()
582 v4l2_async_nf_cleanup(&priv->notifier); in ub913_v4l2_notifier_register()
586 priv->notifier.ops = &ub913_notify_ops; in ub913_v4l2_notifier_register()
588 ret = v4l2_async_nf_register(&priv->notifier); in ub913_v4l2_notifier_register()
591 v4l2_async_nf_cleanup(&priv->notifier); in ub913_v4l2_notifier_register()
600 v4l2_async_nf_unregister(&priv->notifier); in ub913_v4l2_nf_unregister()
601 v4l2_async_nf_cleanup(&priv->notifier); in ub913_v4l2_nf_unregister()
606 struct device *dev = &priv->client->dev; in ub913_register_clkout()
612 return -ENOMEM; in ub913_register_clkout()
614 priv->clkout_clk_hw = devm_clk_hw_register_fixed_factor(dev, name, in ub913_register_clkout()
615 __clk_get_name(priv->clkin), 0, 1, 2); in ub913_register_clkout()
619 if (IS_ERR(priv->clkout_clk_hw)) in ub913_register_clkout()
620 return dev_err_probe(dev, PTR_ERR(priv->clkout_clk_hw), in ub913_register_clkout()
624 priv->clkout_clk_hw); in ub913_register_clkout()
640 ref = clk_get_rate(priv->clkin) / 2; in ub913_i2c_master_init()
658 struct device *dev = &priv->client->dev; in ub913_add_i2c_adapter()
666 ret = i2c_atr_add_adapter(priv->plat_data->atr, priv->plat_data->port, in ub913_add_i2c_adapter()
679 struct device *dev = &priv->client->dev; in ub913_parse_dt()
689 return dev_err_probe(dev, -ENOENT, "No sink endpoint\n"); in ub913_parse_dt()
700 priv->pclk_polarity_rising = true; in ub913_parse_dt()
702 priv->pclk_polarity_rising = false; in ub913_parse_dt()
704 return dev_err_probe(dev, -EINVAL, in ub913_parse_dt()
705 "bad value for 'pclk-sample'\n"); in ub913_parse_dt()
712 struct device *dev = &priv->client->dev; in ub913_hw_init()
723 return dev_err_probe(dev, -ENODEV, in ub913_hw_init()
738 v |= priv->pclk_polarity_rising ? UB913_REG_GENERAL_CFG_PCLK_RISING : 0; in ub913_hw_init()
746 struct device *dev = &priv->client->dev; in ub913_subdev_init()
749 v4l2_i2c_subdev_init(&priv->sd, priv->client, &ub913_subdev_ops); in ub913_subdev_init()
750 priv->sd.internal_ops = &ub913_internal_ops; in ub913_subdev_init()
751 priv->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS; in ub913_subdev_init()
752 priv->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; in ub913_subdev_init()
753 priv->sd.entity.ops = &ub913_entity_ops; in ub913_subdev_init()
755 priv->pads[0].flags = MEDIA_PAD_FL_SINK; in ub913_subdev_init()
756 priv->pads[1].flags = MEDIA_PAD_FL_SOURCE; in ub913_subdev_init()
758 ret = media_entity_pads_init(&priv->sd.entity, 2, priv->pads); in ub913_subdev_init()
762 ret = v4l2_subdev_init_finalize(&priv->sd); in ub913_subdev_init()
773 ret = v4l2_async_register_subdev(&priv->sd); in ub913_subdev_init()
784 v4l2_subdev_cleanup(&priv->sd); in ub913_subdev_init()
786 media_entity_cleanup(&priv->sd.entity); in ub913_subdev_init()
793 v4l2_async_unregister_subdev(&priv->sd); in ub913_subdev_uninit()
795 v4l2_subdev_cleanup(&priv->sd); in ub913_subdev_uninit()
796 fwnode_handle_put(priv->sd.fwnode); in ub913_subdev_uninit()
797 media_entity_cleanup(&priv->sd.entity); in ub913_subdev_uninit()
802 struct device *dev = &client->dev; in ub913_probe()
808 return -ENOMEM; in ub913_probe()
810 priv->client = client; in ub913_probe()
812 priv->plat_data = dev_get_platdata(&client->dev); in ub913_probe()
813 if (!priv->plat_data) in ub913_probe()
814 return dev_err_probe(dev, -ENODEV, "Platform data missing\n"); in ub913_probe()
816 priv->regmap = devm_regmap_init_i2c(client, &ub913_regmap_config); in ub913_probe()
817 if (IS_ERR(priv->regmap)) in ub913_probe()
818 return dev_err_probe(dev, PTR_ERR(priv->regmap), in ub913_probe()
825 priv->clkin = devm_clk_get(dev, "clkin"); in ub913_probe()
826 if (IS_ERR(priv->clkin)) in ub913_probe()
827 return dev_err_probe(dev, PTR_ERR(priv->clkin), in ub913_probe()
873 i2c_atr_del_adapter(priv->plat_data->atr, priv->plat_data->port); in ub913_remove()
881 { "ds90ub913a-q1" },
887 { .compatible = "ti,ds90ub913a-q1" },
897 .name = "ds90ub913a",
904 MODULE_DESCRIPTION("Texas Instruments DS90UB913 FPD-Link III Serializer Driver");