Lines Matching full:decoder

3 // tvp5150 - Texas Instruments TVP5150A/AM1 and TVP5151 video decoder driver
47 MODULE_DESCRIPTION("Texas Instruments TVP5150A/TVP5150AM1/TVP5151 video decoder driver");
110 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_read() local
113 ret = regmap_read(decoder->regmap, addr, &val); in tvp5150_read()
282 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_selmux() local
287 if ((decoder->dev_id == 0x5150 && decoder->rom_ver == 0x0400) || in tvp5150_selmux()
288 (decoder->dev_id == 0x5151 && decoder->rom_ver == 0x0100)) { in tvp5150_selmux()
289 if (!decoder->enable) in tvp5150_selmux()
293 switch (decoder->input) { in tvp5150_selmux()
307 decoder->input == 0 ? "aip1a" : in tvp5150_selmux()
308 decoder->input == 2 ? "aip1b" : "svideo", in tvp5150_selmux()
309 decoder->output == 0 ? "normal" : "black-frame-gen", in tvp5150_selmux()
312 regmap_write(decoder->regmap, TVP5150_OP_MODE_CTL, opmode); in tvp5150_selmux()
313 regmap_write(decoder->regmap, TVP5150_VD_IN_SRC_SEL_1, input); in tvp5150_selmux()
323 if (decoder->input == TVP5150_SVIDEO) in tvp5150_selmux()
327 regmap_update_bits(decoder->regmap, TVP5150_MISC_CTL, mask, val); in tvp5150_selmux()
600 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_write_inittab() local
603 regmap_write(decoder->regmap, regs->reg, regs->value); in tvp5150_write_inittab()
611 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_vdp_init() local
612 struct regmap *map = decoder->regmap; in tvp5150_vdp_init()
682 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_set_vbi() local
683 v4l2_std_id std = decoder->norm; in tvp5150_set_vbi()
715 regmap_write(decoder->regmap, reg, type); in tvp5150_set_vbi()
718 regmap_write(decoder->regmap, reg + 1, type); in tvp5150_set_vbi()
725 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_get_vbi() local
726 v4l2_std_id std = decoder->norm; in tvp5150_get_vbi()
761 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_set_std() local
783 regmap_write(decoder->regmap, TVP5150_VIDEO_STD, fmt); in tvp5150_set_std()
789 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_g_std() local
791 *std = decoder->norm; in tvp5150_g_std()
798 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_s_std() local
799 struct tvp5150_connector *cur_con = decoder->cur_connector; in tvp5150_s_std()
802 if (decoder->norm == std) in tvp5150_s_std()
806 if (!decoder->connectors_num) in tvp5150_s_std()
820 decoder->rect.height = TVP5150_V_MAX_525_60; in tvp5150_s_std()
822 decoder->rect.height = TVP5150_V_MAX_OTHERS; in tvp5150_s_std()
825 decoder->norm = supported_stds & std; in tvp5150_s_std()
854 struct tvp5150 *decoder = to_tvp5150(sd); in query_lock() local
857 if (decoder->irq) in query_lock()
858 return decoder->lock; in query_lock()
860 regmap_read(decoder->regmap, TVP5150_STATUS_REG_1, &status); in query_lock()
880 struct tvp5150 *decoder = dev_id; in tvp5150_isr() local
881 struct regmap *map = decoder->regmap; in tvp5150_isr()
892 decoder->lock = !!(status & TVP5150_INT_A_LOCK_STATUS); in tvp5150_isr()
893 dev_dbg_lvl(decoder->sd.dev, 1, debug, in tvp5150_isr()
895 decoder->lock ? "ck" : "ss"); in tvp5150_isr()
896 v4l2_subdev_notify_event(&decoder->sd, &tvp5150_ev_fmt); in tvp5150_isr()
898 decoder->lock ? decoder->oe : 0); in tvp5150_isr()
917 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_reset() local
918 struct regmap *map = decoder->regmap; in tvp5150_reset()
923 if (decoder->irq) { in tvp5150_reset()
940 /* Selects decoder input */ in tvp5150_reset()
944 v4l2_ctrl_handler_setup(&decoder->hdl); in tvp5150_reset()
951 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_enable() local
957 if (decoder->norm == V4L2_STD_ALL) in tvp5150_enable()
960 std = decoder->norm; in tvp5150_enable()
969 switch (decoder->mbus_type) { in tvp5150_enable()
972 regmap_update_bits(decoder->regmap, TVP5150_DATA_RATE_SEL, in tvp5150_enable()
974 decoder->oe = TVP5150_MISC_CTL_YCBCR_OE | in tvp5150_enable()
979 decoder->oe = TVP5150_MISC_CTL_YCBCR_OE | in tvp5150_enable()
992 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_s_ctrl() local
996 regmap_write(decoder->regmap, TVP5150_BRIGHT_CTL, ctrl->val); in tvp5150_s_ctrl()
999 regmap_write(decoder->regmap, TVP5150_CONTRAST_CTL, ctrl->val); in tvp5150_s_ctrl()
1002 regmap_write(decoder->regmap, TVP5150_SATURATION_CTL, in tvp5150_s_ctrl()
1006 regmap_write(decoder->regmap, TVP5150_HUE_CTL, ctrl->val); in tvp5150_s_ctrl()
1009 decoder->enable = ctrl->val ? false : true; in tvp5150_s_ctrl()
1029 tvp5150_get_pad_crop(struct tvp5150 *decoder, in tvp5150_get_pad_crop() argument
1035 return &decoder->rect; in tvp5150_get_pad_crop()
1052 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_fill_fmt() local
1059 f->width = decoder->rect.width; in tvp5150_fill_fmt()
1060 f->height = decoder->rect.height / 2; in tvp5150_fill_fmt()
1073 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_get_hmax() local
1077 if (decoder->norm == V4L2_STD_ALL) in tvp5150_get_hmax()
1080 std = decoder->norm; in tvp5150_get_hmax()
1089 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_set_hw_selection() local
1092 regmap_write(decoder->regmap, TVP5150_VERT_BLANKING_START, rect->top); in tvp5150_set_hw_selection()
1093 regmap_write(decoder->regmap, TVP5150_VERT_BLANKING_STOP, in tvp5150_set_hw_selection()
1095 regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_ST_MSB, in tvp5150_set_hw_selection()
1097 regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_ST_LSB, in tvp5150_set_hw_selection()
1099 regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_STP_MSB, in tvp5150_set_hw_selection()
1102 regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_STP_LSB, in tvp5150_set_hw_selection()
1110 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_set_selection() local
1141 crop = tvp5150_get_pad_crop(decoder, sd_state, sel->pad, sel->which); in tvp5150_set_selection()
1162 struct tvp5150 *decoder = container_of(sd, struct tvp5150, sd); in tvp5150_get_selection() local
1173 if (decoder->norm == V4L2_STD_ALL) in tvp5150_get_selection()
1176 std = decoder->norm; in tvp5150_get_selection()
1183 crop = tvp5150_get_pad_crop(decoder, sd_state, sel->pad, in tvp5150_get_selection()
1198 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_get_mbus_config() local
1200 cfg->type = decoder->mbus_type; in tvp5150_get_mbus_config()
1215 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_init_state() local
1222 if (decoder->norm == V4L2_STD_ALL) { in tvp5150_init_state()
1224 if (std != decoder->detected_norm) { in tvp5150_init_state()
1225 decoder->detected_norm = std; in tvp5150_init_state()
1226 tvp5150_set_default(std, &decoder->rect); in tvp5150_init_state()
1248 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_enum_frame_size() local
1254 fse->min_width = decoder->rect.width; in tvp5150_enum_frame_size()
1255 fse->max_width = decoder->rect.width; in tvp5150_enum_frame_size()
1256 fse->min_height = decoder->rect.height / 2; in tvp5150_enum_frame_size()
1257 fse->max_height = decoder->rect.height / 2; in tvp5150_enum_frame_size()
1281 static int tvp5150_disable_all_input_links(struct tvp5150 *decoder) in tvp5150_disable_all_input_links() argument
1288 connector_pad = media_pad_remote_pad_first(&decoder->pads[i]); in tvp5150_disable_all_input_links()
1292 err = tvp5150_set_link(connector_pad, &decoder->pads[i], 0); in tvp5150_disable_all_input_links()
1308 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_link_setup() local
1310 &decoder->pads[tvp5150_pad->index ^ 1]; in tvp5150_link_setup()
1324 for (i = 0; i < decoder->connectors_num; i++) { in tvp5150_link_setup()
1325 if (remote->entity == &decoder->connectors[i].ent) { in tvp5150_link_setup()
1326 v4l2c = &decoder->connectors[i].base; in tvp5150_link_setup()
1359 err = tvp5150_disable_all_input_links(decoder); in tvp5150_link_setup()
1383 if (!decoder->connectors_num) in tvp5150_link_setup()
1387 decoder->cur_connector = in tvp5150_link_setup()
1394 v4l2ca = &decoder->cur_connector->base.connector.analog; in tvp5150_link_setup()
1395 new_norm = decoder->norm & v4l2ca->sdtv_stds; in tvp5150_link_setup()
1396 if (decoder->norm == new_norm) in tvp5150_link_setup()
1419 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_runtime_suspend() local
1421 if (decoder->irq) in tvp5150_runtime_suspend()
1423 return regmap_update_bits(decoder->regmap, in tvp5150_runtime_suspend()
1432 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_runtime_resume() local
1434 if (decoder->irq) in tvp5150_runtime_resume()
1436 return regmap_update_bits(decoder->regmap, in tvp5150_runtime_resume()
1445 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_s_stream() local
1459 /* Enable outputs if decoder is locked */ in tvp5150_s_stream()
1460 if (decoder->irq) in tvp5150_s_stream()
1461 val = decoder->lock ? decoder->oe : 0; in tvp5150_s_stream()
1463 val = decoder->oe; in tvp5150_s_stream()
1465 v4l2_subdev_notify_event(&decoder->sd, &tvp5150_ev_fmt); in tvp5150_s_stream()
1470 regmap_update_bits(decoder->regmap, TVP5150_MISC_CTL, mask, val); in tvp5150_s_stream()
1478 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_s_routing() local
1480 decoder->input = input; in tvp5150_s_routing()
1481 decoder->output = output; in tvp5150_s_routing()
1484 decoder->enable = false; in tvp5150_s_routing()
1486 decoder->enable = true; in tvp5150_s_routing()
1494 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_s_raw_fmt() local
1505 regmap_write(decoder->regmap, TVP5150_LUMA_PROC_CTL_1, 0x70); in tvp5150_s_raw_fmt()
1507 regmap_write(decoder->regmap, TVP5150_VERT_BLANKING_START, in tvp5150_s_raw_fmt()
1509 regmap_write(decoder->regmap, TVP5150_VERT_BLANKING_STOP, 0x01); in tvp5150_s_raw_fmt()
1516 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_s_sliced_fmt() local
1527 regmap_write(decoder->regmap, TVP5150_FIFO_OUT_CTRL, 1); in tvp5150_s_sliced_fmt()
1530 regmap_write(decoder->regmap, TVP5150_FIFO_OUT_CTRL, 0); in tvp5150_s_sliced_fmt()
1533 regmap_write(decoder->regmap, TVP5150_FULL_FIELD_ENA, 0); in tvp5150_s_sliced_fmt()
1537 regmap_write(decoder->regmap, i, 0xff); in tvp5150_s_sliced_fmt()
1575 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_s_register() local
1577 return regmap_write(decoder->regmap, reg->reg & 0xff, reg->val & 0xff); in tvp5150_s_register()
1605 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_registered() local
1613 for (i = 0; i < decoder->connectors_num; i++) { in tvp5150_registered()
1614 struct media_entity *con = &decoder->connectors[i].ent; in tvp5150_registered()
1615 struct media_pad *pad = &decoder->connectors[i].pad; in tvp5150_registered()
1617 &decoder->connectors[i].base; in tvp5150_registered()
1652 decoder->input = in tvp5150_registered()
1658 decoder->cur_connector = &decoder->connectors[i]; in tvp5150_registered()
1666 for (i = 0; i < decoder->connectors_num; i++) { in tvp5150_registered()
1667 media_device_unregister_entity(&decoder->connectors[i].ent); in tvp5150_registered()
1668 media_entity_cleanup(&decoder->connectors[i].ent); in tvp5150_registered()
1898 static int tvp5150_mc_init(struct tvp5150 *decoder) in tvp5150_mc_init() argument
1900 struct v4l2_subdev *sd = &decoder->sd; in tvp5150_mc_init()
1907 decoder->pads[i].flags = MEDIA_PAD_FL_SINK; in tvp5150_mc_init()
1908 decoder->pads[i].sig_type = PAD_SIGNAL_ANALOG; in tvp5150_mc_init()
1911 decoder->pads[i].flags = MEDIA_PAD_FL_SOURCE; in tvp5150_mc_init()
1912 decoder->pads[i].sig_type = PAD_SIGNAL_DV; in tvp5150_mc_init()
1915 decoder->pads); in tvp5150_mc_init()
1920 static inline int tvp5150_mc_init(struct tvp5150 *decoder) in tvp5150_mc_init() argument
1926 static int tvp5150_validate_connectors(struct tvp5150 *decoder) in tvp5150_validate_connectors() argument
1928 struct device *dev = decoder->sd.dev; in tvp5150_validate_connectors()
1933 if (!decoder->connectors_num) { in tvp5150_validate_connectors()
1938 for (i = 0; i < decoder->connectors_num; i++) { in tvp5150_validate_connectors()
1942 tvpc = &decoder->connectors[i]; in tvp5150_validate_connectors()
1989 static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) in tvp5150_parse_dt() argument
1991 struct device *dev = decoder->sd.dev; in tvp5150_parse_dt()
2022 unsigned int next_connector = decoder->connectors_num; in tvp5150_parse_dt()
2032 tvpc = &decoder->connectors[next_connector]; in tvp5150_parse_dt()
2042 decoder->connectors_num++; in tvp5150_parse_dt()
2046 tvpc = &decoder->connectors[i]; in tvp5150_parse_dt()
2058 ret = tvp5150_validate_connectors(decoder); in tvp5150_parse_dt()
2062 for (i = 0; i < decoder->connectors_num; i++) { in tvp5150_parse_dt()
2063 tvpc = &decoder->connectors[i]; in tvp5150_parse_dt()
2097 decoder->mbus_type = bus_cfg.bus_type; in tvp5150_parse_dt()
2105 v4l2_fwnode_connector_free(&decoder->connectors[i].base); in tvp5150_parse_dt()
2240 struct tvp5150 *decoder = to_tvp5150(sd); in tvp5150_remove() local
2247 for (i = 0; i < decoder->connectors_num; i++) in tvp5150_remove()
2248 v4l2_fwnode_connector_free(&decoder->connectors[i].base); in tvp5150_remove()
2249 for (i = 0; i < decoder->connectors_num; i++) { in tvp5150_remove()
2250 media_device_unregister_entity(&decoder->connectors[i].ent); in tvp5150_remove()
2251 media_entity_cleanup(&decoder->connectors[i].ent); in tvp5150_remove()
2254 v4l2_ctrl_handler_free(&decoder->hdl); in tvp5150_remove()