cdns-mhdp8546-j721e.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * TI j721e Cadence MHDP8546 DP wrapper
  4. *
  5. * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
  6. * Author: Jyri Sarha <[email protected]>
  7. */
  8. #include <linux/io.h>
  9. #include <linux/platform_device.h>
  10. #include "cdns-mhdp8546-j721e.h"
  11. #define REVISION 0x00
  12. #define DPTX_IPCFG 0x04
  13. #define ECC_MEM_CFG 0x08
  14. #define DPTX_DSC_CFG 0x0c
  15. #define DPTX_SRC_CFG 0x10
  16. #define DPTX_VIF_SECURE_MODE_CFG 0x14
  17. #define DPTX_VIF_CONN_STATUS 0x18
  18. #define PHY_CLK_STATUS 0x1c
  19. #define DPTX_SRC_AIF_EN BIT(16)
  20. #define DPTX_SRC_VIF_3_IN30B BIT(11)
  21. #define DPTX_SRC_VIF_2_IN30B BIT(10)
  22. #define DPTX_SRC_VIF_1_IN30B BIT(9)
  23. #define DPTX_SRC_VIF_0_IN30B BIT(8)
  24. #define DPTX_SRC_VIF_3_SEL_DPI5 BIT(7)
  25. #define DPTX_SRC_VIF_3_SEL_DPI3 0
  26. #define DPTX_SRC_VIF_2_SEL_DPI4 BIT(6)
  27. #define DPTX_SRC_VIF_2_SEL_DPI2 0
  28. #define DPTX_SRC_VIF_1_SEL_DPI3 BIT(5)
  29. #define DPTX_SRC_VIF_1_SEL_DPI1 0
  30. #define DPTX_SRC_VIF_0_SEL_DPI2 BIT(4)
  31. #define DPTX_SRC_VIF_0_SEL_DPI0 0
  32. #define DPTX_SRC_VIF_3_EN BIT(3)
  33. #define DPTX_SRC_VIF_2_EN BIT(2)
  34. #define DPTX_SRC_VIF_1_EN BIT(1)
  35. #define DPTX_SRC_VIF_0_EN BIT(0)
  36. /* TODO turn DPTX_IPCFG fw_mem_clk_en at pm_runtime_suspend. */
  37. static int cdns_mhdp_j721e_init(struct cdns_mhdp_device *mhdp)
  38. {
  39. struct platform_device *pdev = to_platform_device(mhdp->dev);
  40. mhdp->j721e_regs = devm_platform_ioremap_resource(pdev, 1);
  41. return PTR_ERR_OR_ZERO(mhdp->j721e_regs);
  42. }
  43. static void cdns_mhdp_j721e_enable(struct cdns_mhdp_device *mhdp)
  44. {
  45. /*
  46. * Enable VIF_0 and select DPI2 as its input. DSS0 DPI0 is connected
  47. * to eDP DPI2. This is the only supported SST configuration on
  48. * J721E.
  49. */
  50. writel(DPTX_SRC_VIF_0_EN | DPTX_SRC_VIF_0_SEL_DPI2,
  51. mhdp->j721e_regs + DPTX_SRC_CFG);
  52. }
  53. static void cdns_mhdp_j721e_disable(struct cdns_mhdp_device *mhdp)
  54. {
  55. /* Put everything to defaults */
  56. writel(0, mhdp->j721e_regs + DPTX_DSC_CFG);
  57. }
  58. const struct mhdp_platform_ops mhdp_ti_j721e_ops = {
  59. .init = cdns_mhdp_j721e_init,
  60. .enable = cdns_mhdp_j721e_enable,
  61. .disable = cdns_mhdp_j721e_disable,
  62. };
  63. const struct drm_bridge_timings mhdp_ti_j721e_bridge_timings = {
  64. .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
  65. DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE |
  66. DRM_BUS_FLAG_DE_HIGH,
  67. };