Lines Matching refs:disp
130 struct zynqmp_disp *disp; member
405 static u32 zynqmp_disp_avbuf_read(struct zynqmp_disp *disp, int reg) in zynqmp_disp_avbuf_read() argument
407 return readl(disp->avbuf + reg); in zynqmp_disp_avbuf_read()
410 static void zynqmp_disp_avbuf_write(struct zynqmp_disp *disp, int reg, u32 val) in zynqmp_disp_avbuf_write() argument
412 writel(val, disp->avbuf + reg); in zynqmp_disp_avbuf_write()
428 static void zynqmp_disp_avbuf_set_format(struct zynqmp_disp *disp, in zynqmp_disp_avbuf_set_format() argument
438 val = zynqmp_disp_avbuf_read(disp, ZYNQMP_DISP_AV_BUF_FMT); in zynqmp_disp_avbuf_set_format()
443 zynqmp_disp_avbuf_write(disp, reg, val); in zynqmp_disp_avbuf_set_format()
449 zynqmp_disp_avbuf_write(disp, reg, val); in zynqmp_disp_avbuf_set_format()
457 zynqmp_disp_avbuf_write(disp, reg, fmt->sf[i]); in zynqmp_disp_avbuf_set_format()
473 zynqmp_disp_avbuf_set_clocks_sources(struct zynqmp_disp *disp, in zynqmp_disp_avbuf_set_clocks_sources() argument
486 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_CLK_SRC, val); in zynqmp_disp_avbuf_set_clocks_sources()
495 static void zynqmp_disp_avbuf_enable_channels(struct zynqmp_disp *disp) in zynqmp_disp_avbuf_enable_channels() argument
505 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_CHBUF(i), in zynqmp_disp_avbuf_enable_channels()
513 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_CHBUF(i), in zynqmp_disp_avbuf_enable_channels()
523 static void zynqmp_disp_avbuf_disable_channels(struct zynqmp_disp *disp) in zynqmp_disp_avbuf_disable_channels() argument
528 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_CHBUF(i), in zynqmp_disp_avbuf_disable_channels()
538 static void zynqmp_disp_avbuf_enable_audio(struct zynqmp_disp *disp) in zynqmp_disp_avbuf_enable_audio() argument
542 val = zynqmp_disp_avbuf_read(disp, ZYNQMP_DISP_AV_BUF_OUTPUT); in zynqmp_disp_avbuf_enable_audio()
546 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_OUTPUT, val); in zynqmp_disp_avbuf_enable_audio()
555 static void zynqmp_disp_avbuf_disable_audio(struct zynqmp_disp *disp) in zynqmp_disp_avbuf_disable_audio() argument
559 val = zynqmp_disp_avbuf_read(disp, ZYNQMP_DISP_AV_BUF_OUTPUT); in zynqmp_disp_avbuf_disable_audio()
563 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_OUTPUT, val); in zynqmp_disp_avbuf_disable_audio()
573 static void zynqmp_disp_avbuf_enable_video(struct zynqmp_disp *disp, in zynqmp_disp_avbuf_enable_video() argument
578 val = zynqmp_disp_avbuf_read(disp, ZYNQMP_DISP_AV_BUF_OUTPUT); in zynqmp_disp_avbuf_enable_video()
593 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_OUTPUT, val); in zynqmp_disp_avbuf_enable_video()
603 static void zynqmp_disp_avbuf_disable_video(struct zynqmp_disp *disp, in zynqmp_disp_avbuf_disable_video() argument
608 val = zynqmp_disp_avbuf_read(disp, ZYNQMP_DISP_AV_BUF_OUTPUT); in zynqmp_disp_avbuf_disable_video()
616 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_OUTPUT, val); in zynqmp_disp_avbuf_disable_video()
625 static void zynqmp_disp_avbuf_enable(struct zynqmp_disp *disp) in zynqmp_disp_avbuf_enable() argument
627 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_SRST_REG, 0); in zynqmp_disp_avbuf_enable()
636 static void zynqmp_disp_avbuf_disable(struct zynqmp_disp *disp) in zynqmp_disp_avbuf_disable() argument
638 zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_SRST_REG, in zynqmp_disp_avbuf_disable()
646 static void zynqmp_disp_blend_write(struct zynqmp_disp *disp, int reg, u32 val) in zynqmp_disp_blend_write() argument
648 writel(val, disp->blend + reg); in zynqmp_disp_blend_write()
699 static void zynqmp_disp_blend_set_output_format(struct zynqmp_disp *disp, in zynqmp_disp_blend_set_output_format() argument
715 zynqmp_disp_blend_write(disp, ZYNQMP_DISP_V_BLEND_OUTPUT_VID_FMT, fmt); in zynqmp_disp_blend_set_output_format()
725 zynqmp_disp_blend_write(disp, in zynqmp_disp_blend_set_output_format()
730 zynqmp_disp_blend_write(disp, in zynqmp_disp_blend_set_output_format()
746 static void zynqmp_disp_blend_set_bg_color(struct zynqmp_disp *disp, in zynqmp_disp_blend_set_bg_color() argument
749 zynqmp_disp_blend_write(disp, ZYNQMP_DISP_V_BLEND_BG_CLR_0, rcr); in zynqmp_disp_blend_set_bg_color()
750 zynqmp_disp_blend_write(disp, ZYNQMP_DISP_V_BLEND_BG_CLR_1, gy); in zynqmp_disp_blend_set_bg_color()
751 zynqmp_disp_blend_write(disp, ZYNQMP_DISP_V_BLEND_BG_CLR_2, bcb); in zynqmp_disp_blend_set_bg_color()
760 void zynqmp_disp_blend_set_global_alpha(struct zynqmp_disp *disp, in zynqmp_disp_blend_set_global_alpha() argument
763 zynqmp_disp_blend_write(disp, ZYNQMP_DISP_V_BLEND_SET_GLOBAL_ALPHA, in zynqmp_disp_blend_set_global_alpha()
779 static void zynqmp_disp_blend_layer_set_csc(struct zynqmp_disp *disp, in zynqmp_disp_blend_layer_set_csc() argument
806 zynqmp_disp_blend_write(disp, reg + 0, coeffs[i + swap[0]]); in zynqmp_disp_blend_layer_set_csc()
807 zynqmp_disp_blend_write(disp, reg + 4, coeffs[i + swap[1]]); in zynqmp_disp_blend_layer_set_csc()
808 zynqmp_disp_blend_write(disp, reg + 8, coeffs[i + swap[2]]); in zynqmp_disp_blend_layer_set_csc()
817 zynqmp_disp_blend_write(disp, reg + i * 4, offsets[i]); in zynqmp_disp_blend_layer_set_csc()
825 static void zynqmp_disp_blend_layer_enable(struct zynqmp_disp *disp, in zynqmp_disp_blend_layer_enable() argument
837 zynqmp_disp_blend_write(disp, in zynqmp_disp_blend_layer_enable()
849 zynqmp_disp_blend_layer_set_csc(disp, layer, coeffs, offsets); in zynqmp_disp_blend_layer_enable()
857 static void zynqmp_disp_blend_layer_disable(struct zynqmp_disp *disp, in zynqmp_disp_blend_layer_disable() argument
860 zynqmp_disp_blend_write(disp, in zynqmp_disp_blend_layer_disable()
864 zynqmp_disp_blend_layer_set_csc(disp, layer, csc_zero_matrix, in zynqmp_disp_blend_layer_disable()
872 static void zynqmp_disp_audio_write(struct zynqmp_disp *disp, int reg, u32 val) in zynqmp_disp_audio_write() argument
874 writel(val, disp->audio + reg); in zynqmp_disp_audio_write()
884 static void zynqmp_disp_audio_enable(struct zynqmp_disp *disp) in zynqmp_disp_audio_enable() argument
887 zynqmp_disp_audio_write(disp, ZYNQMP_DISP_AUD_SOFT_RESET, 0); in zynqmp_disp_audio_enable()
888 zynqmp_disp_audio_write(disp, ZYNQMP_DISP_AUD_MIXER_VOLUME, in zynqmp_disp_audio_enable()
898 static void zynqmp_disp_audio_disable(struct zynqmp_disp *disp) in zynqmp_disp_audio_disable() argument
900 zynqmp_disp_audio_write(disp, ZYNQMP_DISP_AUD_SOFT_RESET, in zynqmp_disp_audio_disable()
1043 zynqmp_disp_avbuf_enable_video(layer->disp, layer); in zynqmp_disp_layer_enable()
1044 zynqmp_disp_blend_layer_enable(layer->disp, layer); in zynqmp_disp_layer_enable()
1063 zynqmp_disp_avbuf_disable_video(layer->disp, layer); in zynqmp_disp_layer_disable()
1064 zynqmp_disp_blend_layer_disable(layer->disp, layer); in zynqmp_disp_layer_disable()
1090 zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); in zynqmp_disp_layer_set_format()
1132 zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); in zynqmp_disp_layer_set_live_format()
1179 dev_err(layer->disp->dev, in zynqmp_disp_layer_update()
1198 static void zynqmp_disp_layer_release_dma(struct zynqmp_disp *disp, in zynqmp_disp_layer_release_dma() argument
1219 static void zynqmp_disp_destroy_layers(struct zynqmp_disp *disp) in zynqmp_disp_destroy_layers() argument
1223 for (i = 0; i < ARRAY_SIZE(disp->layers); i++) in zynqmp_disp_destroy_layers()
1224 zynqmp_disp_layer_release_dma(disp, &disp->layers[i]); in zynqmp_disp_destroy_layers()
1236 static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp, in zynqmp_disp_layer_request_dma() argument
1249 dma->chan = dma_request_chan(disp->dev, dma_channel_name); in zynqmp_disp_layer_request_dma()
1251 ret = dev_err_probe(disp->dev, PTR_ERR(dma->chan), in zynqmp_disp_layer_request_dma()
1267 static int zynqmp_disp_create_layers(struct zynqmp_disp *disp) in zynqmp_disp_create_layers() argument
1290 for (i = 0; i < ARRAY_SIZE(disp->layers); i++) { in zynqmp_disp_create_layers()
1291 struct zynqmp_disp_layer *layer = &disp->layers[i]; in zynqmp_disp_create_layers()
1294 layer->disp = disp; in zynqmp_disp_create_layers()
1299 if (disp->dpsub->dma_enabled) { in zynqmp_disp_create_layers()
1307 ret = zynqmp_disp_layer_request_dma(disp, layer); in zynqmp_disp_create_layers()
1311 disp->dpsub->layers[i] = layer; in zynqmp_disp_create_layers()
1317 zynqmp_disp_destroy_layers(disp); in zynqmp_disp_create_layers()
1329 void zynqmp_disp_enable(struct zynqmp_disp *disp) in zynqmp_disp_enable() argument
1331 zynqmp_disp_blend_set_output_format(disp, ZYNQMP_DPSUB_FORMAT_RGB); in zynqmp_disp_enable()
1332 zynqmp_disp_blend_set_bg_color(disp, 0, 0, 0); in zynqmp_disp_enable()
1334 zynqmp_disp_avbuf_enable(disp); in zynqmp_disp_enable()
1336 zynqmp_disp_avbuf_set_clocks_sources(disp, disp->dpsub->vid_clk_from_ps, in zynqmp_disp_enable()
1337 disp->dpsub->aud_clk_from_ps, in zynqmp_disp_enable()
1338 disp->dpsub->vid_clk_from_ps); in zynqmp_disp_enable()
1339 zynqmp_disp_avbuf_enable_channels(disp); in zynqmp_disp_enable()
1340 zynqmp_disp_avbuf_enable_audio(disp); in zynqmp_disp_enable()
1342 zynqmp_disp_audio_enable(disp); in zynqmp_disp_enable()
1349 void zynqmp_disp_disable(struct zynqmp_disp *disp) in zynqmp_disp_disable() argument
1351 zynqmp_disp_audio_disable(disp); in zynqmp_disp_disable()
1353 zynqmp_disp_avbuf_disable_audio(disp); in zynqmp_disp_disable()
1354 zynqmp_disp_avbuf_disable_channels(disp); in zynqmp_disp_disable()
1355 zynqmp_disp_avbuf_disable(disp); in zynqmp_disp_disable()
1365 int zynqmp_disp_setup_clock(struct zynqmp_disp *disp, in zynqmp_disp_setup_clock() argument
1372 ret = clk_set_rate(disp->dpsub->vid_clk, mode_clock); in zynqmp_disp_setup_clock()
1374 dev_err(disp->dev, "failed to set the video clock\n"); in zynqmp_disp_setup_clock()
1378 rate = clk_get_rate(disp->dpsub->vid_clk); in zynqmp_disp_setup_clock()
1381 dev_info(disp->dev, in zynqmp_disp_setup_clock()
1385 dev_dbg(disp->dev, in zynqmp_disp_setup_clock()
1399 struct zynqmp_disp *disp; in zynqmp_disp_probe() local
1402 disp = kzalloc(sizeof(*disp), GFP_KERNEL); in zynqmp_disp_probe()
1403 if (!disp) in zynqmp_disp_probe()
1406 disp->dev = &pdev->dev; in zynqmp_disp_probe()
1407 disp->dpsub = dpsub; in zynqmp_disp_probe()
1409 disp->blend = devm_platform_ioremap_resource_byname(pdev, "blend"); in zynqmp_disp_probe()
1410 if (IS_ERR(disp->blend)) { in zynqmp_disp_probe()
1411 ret = PTR_ERR(disp->blend); in zynqmp_disp_probe()
1415 disp->avbuf = devm_platform_ioremap_resource_byname(pdev, "av_buf"); in zynqmp_disp_probe()
1416 if (IS_ERR(disp->avbuf)) { in zynqmp_disp_probe()
1417 ret = PTR_ERR(disp->avbuf); in zynqmp_disp_probe()
1421 disp->audio = devm_platform_ioremap_resource_byname(pdev, "aud"); in zynqmp_disp_probe()
1422 if (IS_ERR(disp->audio)) { in zynqmp_disp_probe()
1423 ret = PTR_ERR(disp->audio); in zynqmp_disp_probe()
1427 ret = zynqmp_disp_create_layers(disp); in zynqmp_disp_probe()
1431 if (disp->dpsub->dma_enabled) { in zynqmp_disp_probe()
1434 layer = &disp->layers[ZYNQMP_DPSUB_LAYER_VID]; in zynqmp_disp_probe()
1438 dpsub->disp = disp; in zynqmp_disp_probe()
1443 kfree(disp); in zynqmp_disp_probe()
1449 struct zynqmp_disp *disp = dpsub->disp; in zynqmp_disp_remove() local
1451 zynqmp_disp_destroy_layers(disp); in zynqmp_disp_remove()