linux/drivers/gpu/drm/msm/edp/edp.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2/*
   3 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
   4 */
   5
   6#ifndef __EDP_CONNECTOR_H__
   7#define __EDP_CONNECTOR_H__
   8
   9#include <linux/i2c.h>
  10#include <linux/interrupt.h>
  11#include <linux/kernel.h>
  12#include <linux/platform_device.h>
  13#include <drm/drm_bridge.h>
  14#include <drm/drm_crtc.h>
  15#include <drm/drm_dp_helper.h>
  16
  17#include "msm_drv.h"
  18
  19#define edp_read(offset) msm_readl((offset))
  20#define edp_write(offset, data) msm_writel((data), (offset))
  21
  22struct edp_ctrl;
  23struct edp_aux;
  24struct edp_phy;
  25
  26struct msm_edp {
  27        struct drm_device *dev;
  28        struct platform_device *pdev;
  29
  30        struct drm_connector *connector;
  31        struct drm_bridge *bridge;
  32
  33        /* the encoder we are hooked to (outside of eDP block) */
  34        struct drm_encoder *encoder;
  35
  36        struct edp_ctrl *ctrl;
  37
  38        int irq;
  39};
  40
  41/* eDP bridge */
  42struct drm_bridge *msm_edp_bridge_init(struct msm_edp *edp);
  43void edp_bridge_destroy(struct drm_bridge *bridge);
  44
  45/* eDP connector */
  46struct drm_connector *msm_edp_connector_init(struct msm_edp *edp);
  47
  48/* AUX */
  49void *msm_edp_aux_init(struct device *dev, void __iomem *regbase,
  50                        struct drm_dp_aux **drm_aux);
  51void msm_edp_aux_destroy(struct device *dev, struct edp_aux *aux);
  52irqreturn_t msm_edp_aux_irq(struct edp_aux *aux, u32 isr);
  53void msm_edp_aux_ctrl(struct edp_aux *aux, int enable);
  54
  55/* Phy */
  56bool msm_edp_phy_ready(struct edp_phy *phy);
  57void msm_edp_phy_ctrl(struct edp_phy *phy, int enable);
  58void msm_edp_phy_vm_pe_init(struct edp_phy *phy);
  59void msm_edp_phy_vm_pe_cfg(struct edp_phy *phy, u32 v0, u32 v1);
  60void msm_edp_phy_lane_power_ctrl(struct edp_phy *phy, bool up, u32 max_lane);
  61void *msm_edp_phy_init(struct device *dev, void __iomem *regbase);
  62
  63/* Ctrl */
  64irqreturn_t msm_edp_ctrl_irq(struct edp_ctrl *ctrl);
  65void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on);
  66int msm_edp_ctrl_init(struct msm_edp *edp);
  67void msm_edp_ctrl_destroy(struct edp_ctrl *ctrl);
  68bool msm_edp_ctrl_panel_connected(struct edp_ctrl *ctrl);
  69int msm_edp_ctrl_get_panel_info(struct edp_ctrl *ctrl,
  70        struct drm_connector *connector, struct edid **edid);
  71int msm_edp_ctrl_timing_cfg(struct edp_ctrl *ctrl,
  72                                const struct drm_display_mode *mode,
  73                                const struct drm_display_info *info);
  74/* @pixel_rate is in kHz */
  75bool msm_edp_ctrl_pixel_clock_valid(struct edp_ctrl *ctrl,
  76        u32 pixel_rate, u32 *pm, u32 *pn);
  77
  78#endif /* __EDP_CONNECTOR_H__ */
  79