Add HDMI audio supportdiff -r1.23 -r1.24 src/sys/arch/arm/nvidia/tegra_car.c
(jmcneill)
--- src/sys/arch/arm/nvidia/Attic/tegra_car.c 2015/07/23 18:22:05 1.23
+++ src/sys/arch/arm/nvidia/Attic/tegra_car.c 2015/07/25 15:50:42 1.24
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: tegra_car.c,v 1.23 2015/07/23 18:22:05 jmcneill Exp $ */ | 1 | /* $NetBSD: tegra_car.c,v 1.24 2015/07/25 15:50:42 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -19,27 +19,27 @@ | @@ -19,27 +19,27 @@ | |||
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include "locators.h" | 29 | #include "locators.h" | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.23 2015/07/23 18:22:05 jmcneill Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.24 2015/07/25 15:50:42 jmcneill Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/bus.h> | 35 | #include <sys/bus.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/intr.h> | 37 | #include <sys/intr.h> | |
38 | #include <sys/systm.h> | 38 | #include <sys/systm.h> | |
39 | #include <sys/kernel.h> | 39 | #include <sys/kernel.h> | |
40 | #include <sys/rndpool.h> | 40 | #include <sys/rndpool.h> | |
41 | #include <sys/rndsource.h> | 41 | #include <sys/rndsource.h> | |
42 | 42 | |||
43 | #include <arm/nvidia/tegra_reg.h> | 43 | #include <arm/nvidia/tegra_reg.h> | |
44 | #include <arm/nvidia/tegra_carreg.h> | 44 | #include <arm/nvidia/tegra_carreg.h> | |
45 | #include <arm/nvidia/tegra_pmcreg.h> | 45 | #include <arm/nvidia/tegra_pmcreg.h> | |
@@ -525,44 +525,47 @@ tegra_car_utmip_enable(u_int port) | @@ -525,44 +525,47 @@ tegra_car_utmip_enable(u_int port) | |||
525 | } | 525 | } | |
526 | 526 | |||
527 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG, 0, bit); | 527 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG, 0, bit); | |
528 | } | 528 | } | |
529 | 529 | |||
530 | void | 530 | void | |
531 | tegra_car_periph_hda_enable(void) | 531 | tegra_car_periph_hda_enable(void) | |
532 | { | 532 | { | |
533 | bus_space_tag_t bst; | 533 | bus_space_tag_t bst; | |
534 | bus_space_handle_t bsh; | 534 | bus_space_handle_t bsh; | |
535 | 535 | |||
536 | tegra_car_get_bs(&bst, &bsh); | 536 | tegra_car_get_bs(&bst, &bsh); | |
537 | 537 | |||
538 | /* HDA */ | |||
539 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, CAR_DEV_V_HDA); | 538 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, CAR_DEV_V_HDA); | |
540 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_HDA); | 539 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_HDA); | |
541 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, CAR_DEV_V_HDA); | |||
542 | ||||
543 | /* HDA2CODEC_2X */ | |||
544 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, | 540 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, | |
545 | CAR_DEV_V_HDA2CODEC_2X); | 541 | CAR_DEV_V_HDA2CODEC_2X); | |
546 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, | 542 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, | |
547 | CAR_DEV_V_HDA2CODEC_2X); | 543 | CAR_DEV_V_HDA2CODEC_2X); | |
548 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, | |||
549 | CAR_DEV_V_HDA2CODEC_2X); | |||
550 | ||||
551 | /* HDA2HDMICODEC */ | |||
552 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_SET_REG, | 544 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_SET_REG, | |
553 | CAR_DEV_W_HDA2HDMICODEC); | 545 | CAR_DEV_W_HDA2HDMICODEC); | |
554 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG, | 546 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG, | |
555 | CAR_DEV_W_HDA2HDMICODEC); | 547 | CAR_DEV_W_HDA2HDMICODEC); | |
548 | ||||
549 | /* configure HDA2CODEC_2X for 48 MHz */ | |||
550 | const u_int div = howmany(tegra_car_pllp0_rate() * 2, 48000000) - 2; | |||
551 | bus_space_write_4(bst, bsh, CAR_CLKSRC_HDA2CODEC_2X_REG, | |||
552 | __SHIFTIN(CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLP_OUT0, | |||
553 | CAR_CLKSRC_HDA2CODEC_2X_SRC) | | |||
554 | __SHIFTIN(div, CAR_CLKSRC_HDA2CODEC_2X_DIV)); | |||
555 | ||||
556 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, CAR_DEV_V_HDA); | |||
557 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, | |||
558 | CAR_DEV_V_HDA2CODEC_2X); | |||
556 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, | 559 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, | |
557 | CAR_DEV_W_HDA2HDMICODEC); | 560 | CAR_DEV_W_HDA2HDMICODEC); | |
558 | } | 561 | } | |
559 | 562 | |||
560 | void | 563 | void | |
561 | tegra_car_periph_sata_enable(void) | 564 | tegra_car_periph_sata_enable(void) | |
562 | { | 565 | { | |
563 | bus_space_tag_t bst; | 566 | bus_space_tag_t bst; | |
564 | bus_space_handle_t bsh; | 567 | bus_space_handle_t bsh; | |
565 | 568 | |||
566 | tegra_car_get_bs(&bst, &bsh); | 569 | tegra_car_get_bs(&bst, &bsh); | |
567 | 570 | |||
568 | /* Assert resets */ | 571 | /* Assert resets */ |
--- src/sys/arch/arm/nvidia/Attic/tegra_carreg.h 2015/07/23 15:07:31 1.19
+++ src/sys/arch/arm/nvidia/Attic/tegra_carreg.h 2015/07/25 15:50:42 1.20
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: tegra_carreg.h,v 1.19 2015/07/23 15:07:31 skrll Exp $ */ | 1 | /* $NetBSD: tegra_carreg.h,v 1.20 2015/07/25 15:50:42 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -380,26 +380,36 @@ | @@ -380,26 +380,36 @@ | |||
380 | #define CAR_DEV_X_I2C6 __BIT(6) | 380 | #define CAR_DEV_X_I2C6 __BIT(6) | |
381 | #define CAR_DEV_X_CAM_MCLK2 __BIT(5) | 381 | #define CAR_DEV_X_CAM_MCLK2 __BIT(5) | |
382 | #define CAR_DEV_X_CAM_MCLK __BIT(4) | 382 | #define CAR_DEV_X_CAM_MCLK __BIT(4) | |
383 | #define CAR_DEV_X_SPARE __BIT(0) | 383 | #define CAR_DEV_X_SPARE __BIT(0) | |
384 | 384 | |||
385 | #define CAR_CCLKG_BURST_POLICY_REG 0x368 | 385 | #define CAR_CCLKG_BURST_POLICY_REG 0x368 | |
386 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE __BITS(31,28) | 386 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE __BITS(31,28) | |
387 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE_IDLE 1 | 387 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE_IDLE 1 | |
388 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE_RUN 2 | 388 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE_RUN 2 | |
389 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE __BITS(3,0) | 389 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE __BITS(3,0) | |
390 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_CLKM 0 | 390 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_CLKM 0 | |
391 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_PLLX_OUT0_LJ 8 | 391 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_PLLX_OUT0_LJ 8 | |
392 | 392 | |||
393 | #define CAR_CLKSRC_HDA2CODEC_2X_REG 0x3e4 | |||
394 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC __BITS(31,29) | |||
395 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLP_OUT0 0 | |||
396 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC2_OUT0 1 | |||
397 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC_OUT0 2 | |||
398 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC3_OUT0 3 | |||
399 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLM_OUT0 4 | |||
400 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_CLKM 6 | |||
401 | #define CAR_CLKSRC_HDA2CODEC_2X_DIV __BITS(7,0) | |||
402 | ||||
393 | #define CAR_CLKSRC_SATA_OOB_REG 0x420 | 403 | #define CAR_CLKSRC_SATA_OOB_REG 0x420 | |
394 | #define CAR_CLKSRC_SATA_OOB_SRC __BITS(31,29) | 404 | #define CAR_CLKSRC_SATA_OOB_SRC __BITS(31,29) | |
395 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLP_OUT0 0 | 405 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLP_OUT0 0 | |
396 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLC_OUT0 2 | 406 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLC_OUT0 2 | |
397 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLM_OUT0 4 | 407 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLM_OUT0 4 | |
398 | #define CAR_CLKSRC_SATA_OOB_SRC_CLKM 6 | 408 | #define CAR_CLKSRC_SATA_OOB_SRC_CLKM 6 | |
399 | #define CAR_CLKSRC_SATA_OOB_DIV __BITS(7,0) | 409 | #define CAR_CLKSRC_SATA_OOB_DIV __BITS(7,0) | |
400 | 410 | |||
401 | #define CAR_CLKSRC_SATA_REG 0x424 | 411 | #define CAR_CLKSRC_SATA_REG 0x424 | |
402 | #define CAR_CLKSRC_SATA_SRC __BITS(31,29) | 412 | #define CAR_CLKSRC_SATA_SRC __BITS(31,29) | |
403 | #define CAR_CLKSRC_SATA_SRC_PLLP_OUT0 0 | 413 | #define CAR_CLKSRC_SATA_SRC_PLLP_OUT0 0 | |
404 | #define CAR_CLKSRC_SATA_SRC_PLLC_OUT0 2 | 414 | #define CAR_CLKSRC_SATA_SRC_PLLC_OUT0 2 | |
405 | #define CAR_CLKSRC_SATA_SRC_PLLM_OUT0 4 | 415 | #define CAR_CLKSRC_SATA_SRC_PLLM_OUT0 4 | |
@@ -452,14 +462,22 @@ | @@ -452,14 +462,22 @@ | |||
452 | #define CAR_SATA_PLL_CFG0_SEQ_LANE_PD_INPUT_VALUE __BIT(6) | 462 | #define CAR_SATA_PLL_CFG0_SEQ_LANE_PD_INPUT_VALUE __BIT(6) | |
453 | #define CAR_SATA_PLL_CFG0_SEQ_RESET_INPUT_VALUE __BIT(5) | 463 | #define CAR_SATA_PLL_CFG0_SEQ_RESET_INPUT_VALUE __BIT(5) | |
454 | #define CAR_SATA_PLL_CFG0_SEQ_IN_SWCTL __BIT(4) | 464 | #define CAR_SATA_PLL_CFG0_SEQ_IN_SWCTL __BIT(4) | |
455 | #define CAR_SATA_PLL_CFG0_PADPLL_USE_LOCKDET __BIT(2) | 465 | #define CAR_SATA_PLL_CFG0_PADPLL_USE_LOCKDET __BIT(2) | |
456 | #define CAR_SATA_PLL_CFG0_PADPLL_RESET_OVERRIDE_VALUE __BIT(1) | 466 | #define CAR_SATA_PLL_CFG0_PADPLL_RESET_OVERRIDE_VALUE __BIT(1) | |
457 | #define CAR_SATA_PLL_CFG0_PADPLL_RESET_SWCTL __BIT(0) | 467 | #define CAR_SATA_PLL_CFG0_PADPLL_RESET_SWCTL __BIT(0) | |
458 | 468 | |||
459 | #define CAR_SATA_PLL_CFG1_REG 0x494 | 469 | #define CAR_SATA_PLL_CFG1_REG 0x494 | |
460 | #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_RESET_DLY __BITS(31,24) | 470 | #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_RESET_DLY __BITS(31,24) | |
461 | #define CAR_SATA_PLL_CFG1_PADPLL_IDDQ2LANE_SLUMBER_DLY __BITS(23,16) | 471 | #define CAR_SATA_PLL_CFG1_PADPLL_IDDQ2LANE_SLUMBER_DLY __BITS(23,16) | |
462 | #define CAR_SATA_PLL_CFG1_PADPLL_PU_POST_DLY __BITS(15,8) | 472 | #define CAR_SATA_PLL_CFG1_PADPLL_PU_POST_DLY __BITS(15,8) | |
463 | #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_IDDQ_DLY __BITS(7,0) | 473 | #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_IDDQ_DLY __BITS(7,0) | |
464 | 474 | |||
475 | #define CAR_CLKSRC_HDMI_AUDIO_REG 0x668 | |||
476 | #define CAR_CLKSRC_HDMI_AUDIO_SRC __BITS(31,29) | |||
477 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLP_OUT0 0 | |||
478 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLC_OUT0 1 | |||
479 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLC2_OUT0 2 | |||
480 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_CLKM 3 | |||
481 | #define CAR_CLKSRC_HDMI_AUDIO_DIV __BITS(7,0) | |||
482 | ||||
465 | #endif /* _ARM_TEGRA_CARREG_H */ | 483 | #endif /* _ARM_TEGRA_CARREG_H */ |
--- src/sys/arch/arm/nvidia/Attic/tegra_hdmi.c 2015/07/23 15:43:06 1.5
+++ src/sys/arch/arm/nvidia/Attic/tegra_hdmi.c 2015/07/25 15:50:42 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: tegra_hdmi.c,v 1.5 2015/07/23 15:43:06 jmcneill Exp $ */ | 1 | /* $NetBSD: tegra_hdmi.c,v 1.6 2015/07/25 15:50:42 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -19,27 +19,27 @@ | @@ -19,27 +19,27 @@ | |||
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include "locators.h" | 29 | #include "locators.h" | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: tegra_hdmi.c,v 1.5 2015/07/23 15:43:06 jmcneill Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: tegra_hdmi.c,v 1.6 2015/07/25 15:50:42 jmcneill Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/bus.h> | 35 | #include <sys/bus.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/intr.h> | 37 | #include <sys/intr.h> | |
38 | #include <sys/systm.h> | 38 | #include <sys/systm.h> | |
39 | #include <sys/kernel.h> | 39 | #include <sys/kernel.h> | |
40 | 40 | |||
41 | #include <dev/i2c/i2cvar.h> | 41 | #include <dev/i2c/i2cvar.h> | |
42 | #include <dev/i2c/ddcvar.h> | 42 | #include <dev/i2c/ddcvar.h> | |
43 | #include <dev/videomode/videomode.h> | 43 | #include <dev/videomode/videomode.h> | |
44 | #include <dev/videomode/edidvar.h> | 44 | #include <dev/videomode/edidvar.h> | |
45 | 45 | |||
@@ -77,33 +77,38 @@ static const struct tegra_hdmi_tmds_conf | @@ -77,33 +77,38 @@ static const struct tegra_hdmi_tmds_conf | |||
77 | struct tegra_hdmi_softc { | 77 | struct tegra_hdmi_softc { | |
78 | device_t sc_dev; | 78 | device_t sc_dev; | |
79 | bus_space_tag_t sc_bst; | 79 | bus_space_tag_t sc_bst; | |
80 | bus_space_handle_t sc_bsh; | 80 | bus_space_handle_t sc_bsh; | |
81 | 81 | |||
82 | device_t sc_displaydev; | 82 | device_t sc_displaydev; | |
83 | device_t sc_ddcdev; | 83 | device_t sc_ddcdev; | |
84 | struct tegra_gpio_pin *sc_pin_hpd; | 84 | struct tegra_gpio_pin *sc_pin_hpd; | |
85 | struct tegra_gpio_pin *sc_pin_pll; | 85 | struct tegra_gpio_pin *sc_pin_pll; | |
86 | struct tegra_gpio_pin *sc_pin_power; | 86 | struct tegra_gpio_pin *sc_pin_power; | |
87 | 87 | |||
88 | bool sc_connected; | 88 | bool sc_connected; | |
89 | const struct videomode *sc_curmode; | 89 | const struct videomode *sc_curmode; | |
90 | bool sc_hdmimode; | |||
90 | }; | 91 | }; | |
91 | 92 | |||
92 | static void tegra_hdmi_hpd(struct tegra_hdmi_softc *); | 93 | static void tegra_hdmi_hpd(struct tegra_hdmi_softc *); | |
93 | static void tegra_hdmi_connect(struct tegra_hdmi_softc *); | 94 | static void tegra_hdmi_connect(struct tegra_hdmi_softc *); | |
94 | static void tegra_hdmi_disconnect(struct tegra_hdmi_softc *); | 95 | static void tegra_hdmi_disconnect(struct tegra_hdmi_softc *); | |
95 | static void tegra_hdmi_enable(struct tegra_hdmi_softc *, const uint8_t *); | 96 | static void tegra_hdmi_enable(struct tegra_hdmi_softc *, const uint8_t *); | |
96 | static int tegra_hdmi_sor_start(struct tegra_hdmi_softc *); | 97 | static int tegra_hdmi_sor_start(struct tegra_hdmi_softc *); | |
98 | static bool tegra_hdmi_is_hdmi(struct tegra_hdmi_softc *, | |||
99 | const struct edid_info *); | |||
100 | static void tegra_hdmi_setup_audio_infoframe(struct tegra_hdmi_softc *); | |||
101 | static uint8_t tegra_hdmi_infoframe_csum(const uint8_t *, size_t); | |||
97 | 102 | |||
98 | CFATTACH_DECL_NEW(tegra_hdmi, sizeof(struct tegra_hdmi_softc), | 103 | CFATTACH_DECL_NEW(tegra_hdmi, sizeof(struct tegra_hdmi_softc), | |
99 | tegra_hdmi_match, tegra_hdmi_attach, NULL, NULL); | 104 | tegra_hdmi_match, tegra_hdmi_attach, NULL, NULL); | |
100 | 105 | |||
101 | #define HDMI_READ(sc, reg) \ | 106 | #define HDMI_READ(sc, reg) \ | |
102 | bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) | 107 | bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) | |
103 | #define HDMI_WRITE(sc, reg, val) \ | 108 | #define HDMI_WRITE(sc, reg, val) \ | |
104 | bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) | 109 | bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) | |
105 | #define HDMI_SET_CLEAR(sc, reg, set, clr) \ | 110 | #define HDMI_SET_CLEAR(sc, reg, set, clr) \ | |
106 | tegra_reg_set_clear((sc)->sc_bst, (sc)->sc_bsh, (reg), (set), (clr)) | 111 | tegra_reg_set_clear((sc)->sc_bst, (sc)->sc_bsh, (reg), (set), (clr)) | |
107 | 112 | |||
108 | static int | 113 | static int | |
109 | tegra_hdmi_match(device_t parent, cfdata_t cf, void *aux) | 114 | tegra_hdmi_match(device_t parent, cfdata_t cf, void *aux) | |
@@ -220,68 +225,74 @@ tegra_hdmi_connect(struct tegra_hdmi_sof | @@ -220,68 +225,74 @@ tegra_hdmi_connect(struct tegra_hdmi_sof | |||
220 | edid_print(&ei); | 225 | edid_print(&ei); | |
221 | #endif | 226 | #endif | |
222 | pedid = edid; | 227 | pedid = edid; | |
223 | } | 228 | } | |
224 | } | 229 | } | |
225 | } | 230 | } | |
226 | 231 | |||
227 | mode = ei.edid_preferred_mode; | 232 | mode = ei.edid_preferred_mode; | |
228 | if (mode == NULL) { | 233 | if (mode == NULL) { | |
229 | mode = pick_mode_by_ref(640, 480, 60); | 234 | mode = pick_mode_by_ref(640, 480, 60); | |
230 | } | 235 | } | |
231 | 236 | |||
232 | sc->sc_curmode = mode; | 237 | sc->sc_curmode = mode; | |
238 | sc->sc_hdmimode = tegra_hdmi_is_hdmi(sc, &ei); | |||
239 | device_printf(sc->sc_dev, "connected to %s display\n", sc->sc_hdmimode ? "HDMI" : "DVI"); | |||
240 | if (sc->sc_hdmimode == false) { | |||
241 | device_printf(sc->sc_dev, "forcing HDMI mode\n"); | |||
242 | sc->sc_hdmimode = true; | |||
243 | } | |||
244 | ||||
233 | tegra_hdmi_enable(sc, pedid); | 245 | tegra_hdmi_enable(sc, pedid); | |
234 | } | 246 | } | |
235 | 247 | |||
236 | static void | 248 | static void | |
237 | tegra_hdmi_disconnect(struct tegra_hdmi_softc *sc) | 249 | tegra_hdmi_disconnect(struct tegra_hdmi_softc *sc) | |
238 | { | 250 | { | |
239 | } | 251 | } | |
240 | 252 | |||
241 | static void | 253 | static void | |
242 | tegra_hdmi_enable(struct tegra_hdmi_softc *sc, const uint8_t *edid) | 254 | tegra_hdmi_enable(struct tegra_hdmi_softc *sc, const uint8_t *edid) | |
243 | { | 255 | { | |
244 | const struct tegra_hdmi_tmds_config *tmds = NULL; | 256 | const struct tegra_hdmi_tmds_config *tmds = NULL; | |
245 | const struct videomode *mode = sc->sc_curmode; | 257 | const struct videomode *mode = sc->sc_curmode; | |
246 | uint32_t input_ctrl; | 258 | uint32_t input_ctrl; | |
247 | u_int n; | 259 | u_int i; | |
248 | 260 | |||
249 | KASSERT(sc->sc_curmode != NULL); | 261 | KASSERT(sc->sc_curmode != NULL); | |
250 | tegra_pmc_hdmi_enable(); | 262 | tegra_pmc_hdmi_enable(); | |
251 | 263 | |||
252 | tegra_car_hdmi_enable(mode->dot_clock * 1000); | 264 | tegra_car_hdmi_enable(mode->dot_clock * 1000); | |
253 | 265 | |||
254 | for (n = 0; n < __arraycount(tegra_hdmi_tmds_config); n++) { | 266 | for (i = 0; i < __arraycount(tegra_hdmi_tmds_config); i++) { | |
255 | if (tegra_hdmi_tmds_config[n].dot_clock >= mode->dot_clock) { | 267 | if (tegra_hdmi_tmds_config[i].dot_clock >= mode->dot_clock) { | |
256 | break; | 268 | break; | |
257 | } | 269 | } | |
258 | } | 270 | } | |
259 | if (n < __arraycount(tegra_hdmi_tmds_config)) { | 271 | if (i < __arraycount(tegra_hdmi_tmds_config)) { | |
260 | tmds = &tegra_hdmi_tmds_config[n]; | 272 | tmds = &tegra_hdmi_tmds_config[i]; | |
261 | } else { | 273 | } else { | |
262 | tmds = &tegra_hdmi_tmds_config[__arraycount(tegra_hdmi_tmds_config) - 1]; | 274 | tmds = &tegra_hdmi_tmds_config[__arraycount(tegra_hdmi_tmds_config) - 1]; | |
263 | } | 275 | } | |
264 | if (tmds != NULL) { | 276 | ||
265 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_PLL0_REG, tmds->sor_pll0); | 277 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_PLL0_REG, tmds->sor_pll0); | |
266 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_PLL1_REG, tmds->sor_pll1); | 278 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_PLL1_REG, tmds->sor_pll1); | |
267 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT_REG, | 279 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT_REG, | |
268 | tmds->sor_lane_drive_current); | 280 | tmds->sor_lane_drive_current); | |
269 | HDMI_WRITE(sc, HDMI_NV_PDISP_PE_CURRENT_REG, tmds->pe_current); | 281 | HDMI_WRITE(sc, HDMI_NV_PDISP_PE_CURRENT_REG, tmds->pe_current); | |
270 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_IO_PEAK_CURRENT_REG, | 282 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_IO_PEAK_CURRENT_REG, | |
271 | tmds->sor_io_peak_current); | 283 | tmds->sor_io_peak_current); | |
272 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_PAD_CTLS0_REG, | 284 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_PAD_CTLS0_REG, | |
273 | tmds->sor_pad_ctls0); | 285 | tmds->sor_pad_ctls0); | |
274 | } | |||
275 | 286 | |||
276 | tegra_dc_enable(sc->sc_displaydev, sc->sc_dev, mode, edid); | 287 | tegra_dc_enable(sc->sc_displaydev, sc->sc_dev, mode, edid); | |
277 | 288 | |||
278 | const u_int div = (mode->dot_clock / 1000) * 4; | 289 | const u_int div = (mode->dot_clock / 1000) * 4; | |
279 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_REFCLK_REG, | 290 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_REFCLK_REG, | |
280 | __SHIFTIN(div >> 2, HDMI_NV_PDISP_SOR_REFCLK_DIV_INT) | | 291 | __SHIFTIN(div >> 2, HDMI_NV_PDISP_SOR_REFCLK_DIV_INT) | | |
281 | __SHIFTIN(div & 3, HDMI_NV_PDISP_SOR_REFCLK_DIV_FRAC)); | 292 | __SHIFTIN(div & 3, HDMI_NV_PDISP_SOR_REFCLK_DIV_FRAC)); | |
282 | 293 | |||
283 | HDMI_SET_CLEAR(sc, HDMI_NV_PDISP_SOR_CSTM_REG, | 294 | HDMI_SET_CLEAR(sc, HDMI_NV_PDISP_SOR_CSTM_REG, | |
284 | __SHIFTIN(HDMI_NV_PDISP_SOR_CSTM_MODE_TMDS, | 295 | __SHIFTIN(HDMI_NV_PDISP_SOR_CSTM_MODE_TMDS, | |
285 | HDMI_NV_PDISP_SOR_CSTM_MODE) | | 296 | HDMI_NV_PDISP_SOR_CSTM_MODE) | | |
286 | __SHIFTIN(2, HDMI_NV_PDISP_SOR_CSTM_ROTCLK) | | 297 | __SHIFTIN(2, HDMI_NV_PDISP_SOR_CSTM_ROTCLK) | | |
287 | HDMI_NV_PDISP_SOR_CSTM_PLLDIV, | 298 | HDMI_NV_PDISP_SOR_CSTM_PLLDIV, | |
@@ -304,37 +315,77 @@ tegra_hdmi_enable(struct tegra_hdmi_soft | @@ -304,37 +315,77 @@ tegra_hdmi_enable(struct tegra_hdmi_soft | |||
304 | HDMI_WRITE(sc, HDMI_NV_PDISP_INPUT_CONTROL_REG, input_ctrl); | 315 | HDMI_WRITE(sc, HDMI_NV_PDISP_INPUT_CONTROL_REG, input_ctrl); | |
305 | 316 | |||
306 | if (tegra_hdmi_sor_start(sc) != 0) | 317 | if (tegra_hdmi_sor_start(sc) != 0) | |
307 | return; | 318 | return; | |
308 | 319 | |||
309 | const u_int rekey = 56; | 320 | const u_int rekey = 56; | |
310 | const u_int hspw = mode->hsync_end - mode->hsync_start; | 321 | const u_int hspw = mode->hsync_end - mode->hsync_start; | |
311 | const u_int hbp = mode->htotal - mode->hsync_end; | 322 | const u_int hbp = mode->htotal - mode->hsync_end; | |
312 | const u_int hfp = mode->hsync_start - mode->hdisplay; | 323 | const u_int hfp = mode->hsync_start - mode->hdisplay; | |
313 | const u_int max_ac_packet = (hspw + hbp + hfp - rekey - 18) / 32; | 324 | const u_int max_ac_packet = (hspw + hbp + hfp - rekey - 18) / 32; | |
314 | uint32_t ctrl = | 325 | uint32_t ctrl = | |
315 | __SHIFTIN(rekey, HDMI_NV_PDISP_HDMI_CTRL_REKEY) | | 326 | __SHIFTIN(rekey, HDMI_NV_PDISP_HDMI_CTRL_REKEY) | | |
316 | __SHIFTIN(max_ac_packet, HDMI_NV_PDISP_HDMI_CTRL_MAX_AC_PACKET); | 327 | __SHIFTIN(max_ac_packet, HDMI_NV_PDISP_HDMI_CTRL_MAX_AC_PACKET); | |
317 | #if notyet | 328 | if (sc->sc_hdmimode) { | |
318 | if (HDMI mode) { | |||
319 | ctrl |= HDMI_NV_PDISP_HDMI_CTRL_ENABLE; /* HDMI ENABLE */ | 329 | ctrl |= HDMI_NV_PDISP_HDMI_CTRL_ENABLE; /* HDMI ENABLE */ | |
320 | } | 330 | } | |
321 | #endif | |||
322 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_CTRL_REG, ctrl); | 331 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_CTRL_REG, ctrl); | |
323 | 332 | |||
324 | /* XXX DVI */ | 333 | if (sc->sc_hdmimode) { | |
325 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_GENERIC_CTRL_REG, 0); | 334 | const u_int n = 6144; /* 48 kHz */ | |
326 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_REG, 0); | 335 | const u_int cts = ((mode->dot_clock * 10) * (n / 128)) / 480; | |
327 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_REG, 0); | 336 | ||
337 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_REG, | |||
338 | __SHIFTIN(HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SOURCE_SELECT_AUTO, | |||
339 | HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SOURCE_SELECT) | | |||
340 | HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_INJECT_NULLSMPL); | |||
341 | HDMI_WRITE(sc, HDMI_NV_PDISP_AUDIO_N_REG, | |||
342 | HDMI_NV_PDISP_AUDIO_N_RESETF | | |||
343 | HDMI_NV_PDISP_AUDIO_N_GENERATE | | |||
344 | __SHIFTIN(n - 1, HDMI_NV_PDISP_AUDIO_N_VALUE)); | |||
345 | ||||
346 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_SPARE_REG, | |||
347 | HDMI_NV_PDISP_HDMI_SPARE_HW_CTS | | |||
348 | HDMI_NV_PDISP_HDMI_SPARE_FORCE_SW_CTS | | |||
349 | __SHIFTIN(1, HDMI_NV_PDISP_HDMI_SPARE_CTS_RESET_VAL)); | |||
350 | ||||
351 | /* | |||
352 | * When HW_CTS=1 and FORCE_SW_CTS=1, the CTS is programmed by | |||
353 | * software in the 44.1 kHz register regardless of chosen rate. | |||
354 | */ | |||
355 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW_REG, | |||
356 | cts << 8); | |||
357 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH_REG, | |||
358 | 0x80000000 | n); | |||
359 | ||||
360 | HDMI_SET_CLEAR(sc, HDMI_NV_PDISP_AUDIO_N_REG, 0, | |||
361 | HDMI_NV_PDISP_AUDIO_N_RESETF); | |||
362 | ||||
363 | HDMI_WRITE(sc, 24000, HDMI_NV_PDISP_SOR_AUDIO_AVAL_0480_REG); | |||
364 | ||||
365 | tegra_hdmi_setup_audio_infoframe(sc); | |||
366 | ||||
367 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_GENERIC_CTRL_REG, | |||
368 | HDMI_NV_PDISP_HDMI_GENERIC_CTRL_AUDIO); | |||
369 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_REG, 0); | |||
370 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_REG, | |||
371 | HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_ENABLE); | |||
372 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_ACR_CTRL_REG, 0); | |||
373 | } else { | |||
374 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_GENERIC_CTRL_REG, 0); | |||
375 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_REG, 0); | |||
376 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_REG, 0); | |||
377 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_ACR_CTRL_REG, 0); | |||
378 | } | |||
328 | 379 | |||
329 | /* Start HDMI output */ | 380 | /* Start HDMI output */ | |
330 | tegra_dc_hdmi_start(sc->sc_displaydev); | 381 | tegra_dc_hdmi_start(sc->sc_displaydev); | |
331 | } | 382 | } | |
332 | 383 | |||
333 | static int | 384 | static int | |
334 | tegra_hdmi_sor_start(struct tegra_hdmi_softc *sc) | 385 | tegra_hdmi_sor_start(struct tegra_hdmi_softc *sc) | |
335 | { | 386 | { | |
336 | int retry; | 387 | int retry; | |
337 | 388 | |||
338 | HDMI_SET_CLEAR(sc, HDMI_NV_PDISP_SOR_PLL0_REG, | 389 | HDMI_SET_CLEAR(sc, HDMI_NV_PDISP_SOR_PLL0_REG, | |
339 | 0, | 390 | 0, | |
340 | HDMI_NV_PDISP_SOR_PLL0_PWR | | 391 | HDMI_NV_PDISP_SOR_PLL0_PWR | | |
@@ -381,13 +432,109 @@ tegra_hdmi_sor_start(struct tegra_hdmi_s | @@ -381,13 +432,109 @@ tegra_hdmi_sor_start(struct tegra_hdmi_s | |||
381 | 432 | |||
382 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_STATE0_REG, 0); | 433 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_STATE0_REG, 0); | |
383 | 434 | |||
384 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_STATE0_REG, | 435 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_STATE0_REG, | |
385 | HDMI_NV_PDISP_SOR_STATE0_UPDATE); | 436 | HDMI_NV_PDISP_SOR_STATE0_UPDATE); | |
386 | 437 | |||
387 | HDMI_SET_CLEAR(sc, HDMI_NV_PDISP_SOR_STATE1_REG, | 438 | HDMI_SET_CLEAR(sc, HDMI_NV_PDISP_SOR_STATE1_REG, | |
388 | HDMI_NV_PDISP_SOR_STATE1_ATTACHED, 0); | 439 | HDMI_NV_PDISP_SOR_STATE1_ATTACHED, 0); | |
389 | 440 | |||
390 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_STATE0_REG, 0); | 441 | HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_STATE0_REG, 0); | |
391 | 442 | |||
392 | return 0; | 443 | return 0; | |
393 | } | 444 | } | |
445 | ||||
446 | static bool | |||
447 | tegra_hdmi_is_hdmi(struct tegra_hdmi_softc *sc, const struct edid_info *ei) | |||
448 | { | |||
449 | char edid[128]; | |||
450 | bool found_hdmi = false; | |||
451 | unsigned int n, p; | |||
452 | ||||
453 | /* | |||
454 | * Scan through extension blocks, looking for a CEA-861-D v3 | |||
455 | * block. If an HDMI Vendor-Specific Data Block (HDMI VSDB) is | |||
456 | * found in that, assume HDMI mode. | |||
457 | */ | |||
458 | for (n = 1; n <= MIN(ei->edid_ext_block_count, 4); n++) { | |||
459 | if (ddc_dev_read_edid_block(sc->sc_ddcdev, edid, | |||
460 | sizeof(edid), n)) { | |||
461 | break; | |||
462 | } | |||
463 | ||||
464 | const uint8_t tag = edid[0]; | |||
465 | const uint8_t rev = edid[1]; | |||
466 | const uint8_t off = edid[2]; | |||
467 | ||||
468 | /* We are looking for a CEA-861-D tag (02h) with revision 3 */ | |||
469 | if (tag != 0x02 || rev != 3) | |||
470 | continue; | |||
471 | /* | |||
472 | * CEA data block collection starts at byte 4, so the | |||
473 | * DTD blocks must start after it. | |||
474 | */ | |||
475 | if (off <= 4) | |||
476 | continue; | |||
477 | ||||
478 | /* Parse the CEA data blocks */ | |||
479 | for (p = 4; p < off;) { | |||
480 | const uint8_t btag = (edid[p] >> 5) & 0x7; | |||
481 | const uint8_t blen = edid[p] & 0x1f; | |||
482 | ||||
483 | /* Make sure the length is sane */ | |||
484 | if (p + blen + 1 > off) | |||
485 | break; | |||
486 | /* Looking for a VSDB tag */ | |||
487 | if (btag != 3) | |||
488 | goto next_block; | |||
489 | /* HDMI VSDB is at least 5 bytes long */ | |||
490 | if (blen < 5) | |||
491 | goto next_block; | |||
492 | ||||
493 | /* HDMI 24-bit IEEE registration ID is 0x000C03 */ | |||
494 | if (memcmp(&edid[p + 1], "\x03\x0c\x00", 3) == 0) | |||
495 | found_hdmi = true; | |||
496 | ||||
497 | next_block: | |||
498 | p += (1 + blen); | |||
499 | } | |||
500 | } | |||
501 | ||||
502 | return found_hdmi; | |||
503 | } | |||
504 | ||||
505 | static void | |||
506 | tegra_hdmi_setup_audio_infoframe(struct tegra_hdmi_softc *sc) | |||
507 | { | |||
508 | uint8_t data[10] = { | |||
509 | 0x84, 0x01, 0x10, | |||
510 | 0x00, /* PB0 (checksum) */ | |||
511 | 0x01, /* CT=0, CC=2ch */ | |||
512 | 0xc0, /* SS=0, SF=48kHz */ | |||
513 | 0x00, /* CA=FR/FL */ | |||
514 | 0x00, /* LSV=0dB, DM_INH=permitted */ | |||
515 | 0x00, 0x00 | |||
516 | }; | |||
517 | ||||
518 | data[3] = tegra_hdmi_infoframe_csum(data, sizeof(data)); | |||
519 | ||||
520 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_HEADER_REG, | |||
521 | data[0] | (data[1] << 8) | (data[2] << 16)); | |||
522 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_LOW_REG, | |||
523 | data[3] | (data[4] << 8) | (data[5] << 16) | (data[6] << 24)); | |||
524 | HDMI_WRITE(sc, HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_HIGH_REG, | |||
525 | data[7] | (data[8] << 8) | (data[9] << 16)); | |||
526 | } | |||
527 | ||||
528 | static uint8_t | |||
529 | tegra_hdmi_infoframe_csum(const uint8_t *data, size_t len) | |||
530 | { | |||
531 | uint8_t csum = 0; | |||
532 | u_int n; | |||
533 | ||||
534 | for (n = 0; n < len; n++) | |||
535 | csum += data[n]; | |||
536 | if (csum) | |||
537 | csum = 0x100 - csum; | |||
538 | ||||
539 | return csum; | |||
540 | } |
--- src/sys/arch/arm/nvidia/tegra_hdmireg.h 2015/07/23 15:08:19 1.3
+++ src/sys/arch/arm/nvidia/tegra_hdmireg.h 2015/07/25 15:50:42 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: tegra_hdmireg.h,v 1.3 2015/07/23 15:08:19 skrll Exp $ */ | 1 | /* $NetBSD: tegra_hdmireg.h,v 1.4 2015/07/25 15:50:42 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -49,39 +49,58 @@ | @@ -49,39 +49,58 @@ | |||
49 | #define HDMI_NV_PDISP_SOR_STATE2_REG 0x00c | 49 | #define HDMI_NV_PDISP_SOR_STATE2_REG 0x00c | |
50 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_DEPOL __BIT(14) | 50 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_DEPOL __BIT(14) | |
51 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_VSYNCPOL __BIT(13) | 51 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_VSYNCPOL __BIT(13) | |
52 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_HSYNCPOL __BIT(12) | 52 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_HSYNCPOL __BIT(12) | |
53 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_PROTOCOL __BITS(11,8) | 53 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_PROTOCOL __BITS(11,8) | |
54 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_CRCMODE __BITS(7,6) | 54 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_CRCMODE __BITS(7,6) | |
55 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_SUBOWNER __BITS(5,4) | 55 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_SUBOWNER __BITS(5,4) | |
56 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_OWNER __BITS(3,0) | 56 | #define HDMI_NV_PDISP_SOR_STATE2_ASY_OWNER __BITS(3,0) | |
57 | 57 | |||
58 | #define HDMI_NV_PDISP_HDMI_AUDIO_EMU0_REG 0x068 | 58 | #define HDMI_NV_PDISP_HDMI_AUDIO_EMU0_REG 0x068 | |
59 | #define HDMI_NV_PDISP_HDMI_AUDIO_EMU_RDATA0_REG 0x06c | 59 | #define HDMI_NV_PDISP_HDMI_AUDIO_EMU_RDATA0_REG 0x06c | |
60 | #define HDMI_NV_PDISP_HDMI_AUDIO_EMU1_REG 0x070 | 60 | #define HDMI_NV_PDISP_HDMI_AUDIO_EMU1_REG 0x070 | |
61 | #define HDMI_NV_PDISP_HDMI_AUDIO_EMU2_REG 0x074 | 61 | #define HDMI_NV_PDISP_HDMI_AUDIO_EMU2_REG 0x074 | |
62 | ||||
62 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_REG 0x078 | 63 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_REG 0x078 | |
64 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_CHKSUM_HW __BIT(9) | |||
65 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_SINGLE __BIT(8) | |||
66 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_OTHER __BIT(4) | |||
67 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_CTRL_ENABLE __BIT(0) | |||
68 | ||||
63 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_STATUS_REG 0x07c | 69 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_STATUS_REG 0x07c | |
64 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_HEADER_REG 0x080 | 70 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_HEADER_REG 0x080 | |
65 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_LOW_REG 0x084 | 71 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_LOW_REG 0x084 | |
66 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_HIGH_REG 0x088 | 72 | #define HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_SUBPACK0_HIGH_REG 0x088 | |
73 | ||||
67 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_REG 0x08c | 74 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_REG 0x08c | |
75 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_CHKSUM_HW __BIT(9) | |||
76 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_SINGLE __BIT(8) | |||
77 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_OTHER __BIT(4) | |||
78 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_CTRL_ENABLE __BIT(0) | |||
79 | ||||
68 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_STATUS_REG 0x090 | 80 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_STATUS_REG 0x090 | |
69 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_HEADER_REG 0x094 | 81 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_HEADER_REG 0x094 | |
70 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK0_LOW_REG 0x098 | 82 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK0_LOW_REG 0x098 | |
71 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK0_HIGH_REG 0x09c | 83 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK0_HIGH_REG 0x09c | |
72 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK1_LOW_REG 0x0a0 | 84 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK1_LOW_REG 0x0a0 | |
73 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK1_HIGH_REG 0x0a4 | 85 | #define HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_SUBPACK1_HIGH_REG 0x0a4 | |
86 | ||||
74 | #define HDMI_NV_PDISP_HDMI_GENERIC_CTRL_REG 0x0a8 | 87 | #define HDMI_NV_PDISP_HDMI_GENERIC_CTRL_REG 0x0a8 | |
88 | #define HDMI_NV_PDISP_HDMI_GENERIC_CTRL_AUDIO __BIT(16) | |||
89 | #define HDMI_NV_PDISP_HDMI_GENERIC_CTRL_HBLANK __BIT(12) | |||
90 | #define HDMI_NV_PDISP_HDMI_GENERIC_CTRL_SINGLE __BIT(8) | |||
91 | #define HDMI_NV_PDISP_HDMI_GENERIC_CTRL_OTHER __BIT(4) | |||
92 | #define HDMI_NV_PDISP_HDMI_GENERIC_CTRL_ENABLE __BIT(0) | |||
93 | ||||
75 | #define HDMI_NV_PDISP_HDMI_GENERIC_STATUS_REG 0x0ac | 94 | #define HDMI_NV_PDISP_HDMI_GENERIC_STATUS_REG 0x0ac | |
76 | #define HDMI_NV_PDISP_HDMI_GENERIC_HEADER_REG 0x0b0 | 95 | #define HDMI_NV_PDISP_HDMI_GENERIC_HEADER_REG 0x0b0 | |
77 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK0_LOW_REG 0x0b4 | 96 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK0_LOW_REG 0x0b4 | |
78 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK0_HIGH_REG 0x0b8 | 97 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK0_HIGH_REG 0x0b8 | |
79 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK1_LOW_REG 0x0bc | 98 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK1_LOW_REG 0x0bc | |
80 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK1_HIGH_REG 0x0c0 | 99 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK1_HIGH_REG 0x0c0 | |
81 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK2_LOW_REG 0x0c4 | 100 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK2_LOW_REG 0x0c4 | |
82 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK2_HIGH_REG 0x0c8 | 101 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK2_HIGH_REG 0x0c8 | |
83 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK3_LOW_REG 0x0cc | 102 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK3_LOW_REG 0x0cc | |
84 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK3_HIGH_REG 0x0d0 | 103 | #define HDMI_NV_PDISP_HDMI_GENERIC_INFOFRAME_SUBPACK3_HIGH_REG 0x0d0 | |
85 | #define HDMI_NV_PDISP_HDMI_ACR_CTRL_REG 0x0d4 | 104 | #define HDMI_NV_PDISP_HDMI_ACR_CTRL_REG 0x0d4 | |
86 | #define HDMI_NV_PDISP_HDMI_ACR_0320_SUBPACK_LOW_REG 0x0d8 | 105 | #define HDMI_NV_PDISP_HDMI_ACR_0320_SUBPACK_LOW_REG 0x0d8 | |
87 | #define HDMI_NV_PDISP_HDMI_ACR_0320_SUBPACK_HIGH_REG 0x0dc | 106 | #define HDMI_NV_PDISP_HDMI_ACR_0320_SUBPACK_HIGH_REG 0x0dc | |
@@ -111,27 +130,32 @@ | @@ -111,27 +130,32 @@ | |||
111 | #define HDMI_NV_PDISP_HDMI_CTRL_AUDIO_LAYOUT __BIT(8) | 130 | #define HDMI_NV_PDISP_HDMI_CTRL_AUDIO_LAYOUT __BIT(8) | |
112 | #define HDMI_NV_PDISP_HDMI_CTRL_REKEY __BITS(6,0) | 131 | #define HDMI_NV_PDISP_HDMI_CTRL_REKEY __BITS(6,0) | |
113 | 132 | |||
114 | #define HDMI_NV_PDISP_HDMI_VSYNC_KEEPOUT_REG 0x114 | 133 | #define HDMI_NV_PDISP_HDMI_VSYNC_KEEPOUT_REG 0x114 | |
115 | #define HDMI_NV_PDISP_HDMI_VSYNC_WINDOW_REG 0x118 | 134 | #define HDMI_NV_PDISP_HDMI_VSYNC_WINDOW_REG 0x118 | |
116 | #define HDMI_NV_PDISP_HDMI_GCP_CTRL_REG 0x11c | 135 | #define HDMI_NV_PDISP_HDMI_GCP_CTRL_REG 0x11c | |
117 | #define HDMI_NV_PDISP_HDMI_GCP_STATUS_REG 0x120 | 136 | #define HDMI_NV_PDISP_HDMI_GCP_STATUS_REG 0x120 | |
118 | #define HDMI_NV_PDISP_HDMI_GCP_SUBPACK_REG 0x124 | 137 | #define HDMI_NV_PDISP_HDMI_GCP_SUBPACK_REG 0x124 | |
119 | #define HDMI_NV_PDISP_HDMI_CHANNEL_STATUS1_REG 0x128 | 138 | #define HDMI_NV_PDISP_HDMI_CHANNEL_STATUS1_REG 0x128 | |
120 | #define HDMI_NV_PDISP_HDMI_CHANNEL_STATUS2_REG 0x12c | 139 | #define HDMI_NV_PDISP_HDMI_CHANNEL_STATUS2_REG 0x12c | |
121 | #define HDMI_NV_PDISP_HDMI_EMU0_REG 0x130 | 140 | #define HDMI_NV_PDISP_HDMI_EMU0_REG 0x130 | |
122 | #define HDMI_NV_PDISP_HDMI_EMU1_REG 0x134 | 141 | #define HDMI_NV_PDISP_HDMI_EMU1_REG 0x134 | |
123 | #define HDMI_NV_PDISP_HDMI_EMU1_RDATA_REG 0x138 | 142 | #define HDMI_NV_PDISP_HDMI_EMU1_RDATA_REG 0x138 | |
143 | ||||
124 | #define HDMI_NV_PDISP_HDMI_SPARE_REG 0x13c | 144 | #define HDMI_NV_PDISP_HDMI_SPARE_REG 0x13c | |
145 | #define HDMI_NV_PDISP_HDMI_SPARE_HW_CTS __BIT(0) | |||
146 | #define HDMI_NV_PDISP_HDMI_SPARE_FORCE_SW_CTS __BIT(1) | |||
147 | #define HDMI_NV_PDISP_HDMI_SPARE_CTS_RESET_VAL __BITS(18,16) | |||
148 | ||||
125 | #define HDMI_NV_PDISP_HDMI_SPDIF_CHN_STATUS1_REG 0x140 | 149 | #define HDMI_NV_PDISP_HDMI_SPDIF_CHN_STATUS1_REG 0x140 | |
126 | #define HDMI_NV_PDISP_HDMI_SPDIF_CHN_STAUTS2_REG 0x144 | 150 | #define HDMI_NV_PDISP_HDMI_SPDIF_CHN_STAUTS2_REG 0x144 | |
127 | #define HDMI_NV_PDISP_CRC_CONTROL_REG 0x258 | 151 | #define HDMI_NV_PDISP_CRC_CONTROL_REG 0x258 | |
128 | 152 | |||
129 | #define HDMI_NV_PDISP_INPUT_CONTROL_REG 0x25c | 153 | #define HDMI_NV_PDISP_INPUT_CONTROL_REG 0x25c | |
130 | #define HDMI_NV_PDISP_INPUT_CONTROL_ARM_VIDEO_RANGE __BIT(1) | 154 | #define HDMI_NV_PDISP_INPUT_CONTROL_ARM_VIDEO_RANGE __BIT(1) | |
131 | #define HDMI_NV_PDISP_INPUT_CONTROL_HDMI_SRC_SELECT __BIT(0) | 155 | #define HDMI_NV_PDISP_INPUT_CONTROL_HDMI_SRC_SELECT __BIT(0) | |
132 | 156 | |||
133 | #define HDMI_NV_PDISP_SCRATCH_REG 0x260 | 157 | #define HDMI_NV_PDISP_SCRATCH_REG 0x260 | |
134 | #define HDMI_NV_PDISP_PE_CURRENT_REG 0x264 | 158 | #define HDMI_NV_PDISP_PE_CURRENT_REG 0x264 | |
135 | #define HDMI_NV_PDISP_KEY_CTRL_REG 0x268 | 159 | #define HDMI_NV_PDISP_KEY_CTRL_REG 0x268 | |
136 | #define HDMI_NV_PDISP_KEY_DEBUG0_REG 0x26c | 160 | #define HDMI_NV_PDISP_KEY_DEBUG0_REG 0x26c | |
137 | #define HDMI_NV_PDISP_KEY_DEBUG1_REG 0x270 | 161 | #define HDMI_NV_PDISP_KEY_DEBUG1_REG 0x270 | |
@@ -261,27 +285,50 @@ | @@ -261,27 +285,50 @@ | |||
261 | 285 | |||
262 | #define HDMI_NV_PDISP_SOR_REFCLK_REG 0x254 | 286 | #define HDMI_NV_PDISP_SOR_REFCLK_REG 0x254 | |
263 | #define HDMI_NV_PDISP_SOR_REFCLK_DIV_INT __BITS(15,8) | 287 | #define HDMI_NV_PDISP_SOR_REFCLK_DIV_INT __BITS(15,8) | |
264 | #define HDMI_NV_PDISP_SOR_REFCLK_DIV_FRAC __BITS(7,6) | 288 | #define HDMI_NV_PDISP_SOR_REFCLK_DIV_FRAC __BITS(7,6) | |
265 | 289 | |||
266 | #define HDMI_NV_PDISP_SOR_IO_PEAK_CURRENT_REG 0x344 | 290 | #define HDMI_NV_PDISP_SOR_IO_PEAK_CURRENT_REG 0x344 | |
267 | #define HDMI_NV_PDISP_SOR_PAD_CTLS0_REG 0x348 | 291 | #define HDMI_NV_PDISP_SOR_PAD_CTLS0_REG 0x348 | |
268 | #define HDMI_NV_PDISP_SOR_PAD_CTLS1_REG 0x34c | 292 | #define HDMI_NV_PDISP_SOR_PAD_CTLS1_REG 0x34c | |
269 | 293 | |||
270 | /* | 294 | /* | |
271 | * Audio Registers | 295 | * Audio Registers | |
272 | */ | 296 | */ | |
273 | #define HDMI_NV_PDISP_AUDIO_N_REG 0x230 | 297 | #define HDMI_NV_PDISP_AUDIO_N_REG 0x230 | |
298 | #define HDMI_NV_PDISP_AUDIO_N_LOOKUP __BIT(28) | |||
299 | #define HDMI_NV_PDISP_AUDIO_N_GENERATE __BIT(24) | |||
300 | #define HDMI_NV_PDISP_AUDIO_N_RESETF __BIT(20) | |||
301 | #define HDMI_NV_PDISP_AUDIO_N_VALUE __BITS(19,0) | |||
302 | ||||
274 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_REG 0x2b0 | 303 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_REG 0x2b0 | |
304 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_INPUT_MODE __BIT(31) | |||
305 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_INJECT_NULLSMPL __BIT(29) | |||
306 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SOURCE_SELECT __BITS(21,20) | |||
307 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SOURCE_SELECT_AUTO 0 | |||
308 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SOURCE_SELECT_SPDIF 1 | |||
309 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SOURCE_SELECT_HDAL 2 | |||
310 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ __BITS(19,16) | |||
311 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ_32_0KHZ 3 | |||
312 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ_44_1KHZ 0 | |||
313 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ_88_2KHZ 8 | |||
314 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ_176_4KHZ 12 | |||
315 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ_48_0KHZ 2 | |||
316 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ_96_0KHZ 10 | |||
317 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ_192_0KHZ 14 | |||
318 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_SAMPLING_FREQ_UNKNOWN 1 | |||
319 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_AFIFO_FLUSH __BIT(12) | |||
320 | #define HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_PORT_CONNECTIVITY __BIT(0) | |||
321 | ||||
275 | #define HDMI_NV_PDISP_SOR_AUDIO_DEBUG_REG 0x2b4 | 322 | #define HDMI_NV_PDISP_SOR_AUDIO_DEBUG_REG 0x2b4 | |
276 | #define HDMI_NV_PDISP_SOR_AUDIO_SPARE0_REG 0x2b8 | 323 | #define HDMI_NV_PDISP_SOR_AUDIO_SPARE0_REG 0x2b8 | |
277 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0320_REG 0x2bc | 324 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0320_REG 0x2bc | |
278 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0441_REG 0x2c0 | 325 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0441_REG 0x2c0 | |
279 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0882_REG 0x2c4 | 326 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0882_REG 0x2c4 | |
280 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_1764_REG 0x2c8 | 327 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_1764_REG 0x2c8 | |
281 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0480_REG 0x2cc | 328 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0480_REG 0x2cc | |
282 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0960_REG 0x2d0 | 329 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_0960_REG 0x2d0 | |
283 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_1920_REG 0x2d4 | 330 | #define HDMI_NV_PDISP_SOR_AUDIO_NVAL_1920_REG 0x2d4 | |
284 | #define HDMI_NV_PDISP_SOR_AUDIO_HDA_SCRATCH0_REG 0x2d8 | 331 | #define HDMI_NV_PDISP_SOR_AUDIO_HDA_SCRATCH0_REG 0x2d8 | |
285 | #define HDMI_NV_PDISP_SOR_AUDIO_HDA_SCRATCH1_REG 0x2dc | 332 | #define HDMI_NV_PDISP_SOR_AUDIO_HDA_SCRATCH1_REG 0x2dc | |
286 | #define HDMI_NV_PDISP_SOR_AUDIO_HDA_SCRATCH2_REG 0x2e0 | 333 | #define HDMI_NV_PDISP_SOR_AUDIO_HDA_SCRATCH2_REG 0x2e0 | |
287 | #define HDMI_NV_PDISP_SOR_AUDIO_HDA_SCRATCH3_REG 0x2e4 | 334 | #define HDMI_NV_PDISP_SOR_AUDIO_HDA_SCRATCH3_REG 0x2e4 |