| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2013 Red Hat |
|---|
| 3 | 4 | * Author: Rob Clark <robdclark@gmail.com> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms of the GNU General Public License version 2 as published by |
|---|
| 7 | | - * the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - * more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 15 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 16 | 5 | */ |
|---|
| 17 | 6 | |
|---|
| 18 | 7 | #ifndef __HDMI_CONNECTOR_H__ |
|---|
| .. | .. |
|---|
| 22 | 11 | #include <linux/clk.h> |
|---|
| 23 | 12 | #include <linux/platform_device.h> |
|---|
| 24 | 13 | #include <linux/regulator/consumer.h> |
|---|
| 14 | +#include <linux/gpio/consumer.h> |
|---|
| 25 | 15 | #include <linux/hdmi.h> |
|---|
| 16 | + |
|---|
| 17 | +#include <drm/drm_bridge.h> |
|---|
| 26 | 18 | |
|---|
| 27 | 19 | #include "msm_drv.h" |
|---|
| 28 | 20 | #include "hdmi.xml.h" |
|---|
| 29 | 21 | |
|---|
| 30 | | -#define HDMI_MAX_NUM_GPIO 6 |
|---|
| 31 | | - |
|---|
| 32 | 22 | struct hdmi_phy; |
|---|
| 33 | 23 | struct hdmi_platform_config; |
|---|
| 34 | | - |
|---|
| 35 | | -struct hdmi_gpio_data { |
|---|
| 36 | | - int num; |
|---|
| 37 | | - bool output; |
|---|
| 38 | | - int value; |
|---|
| 39 | | - const char *label; |
|---|
| 40 | | -}; |
|---|
| 41 | 24 | |
|---|
| 42 | 25 | struct hdmi_audio { |
|---|
| 43 | 26 | bool enabled; |
|---|
| .. | .. |
|---|
| 69 | 52 | struct regulator **pwr_regs; |
|---|
| 70 | 53 | struct clk **hpd_clks; |
|---|
| 71 | 54 | struct clk **pwr_clks; |
|---|
| 55 | + |
|---|
| 56 | + struct gpio_desc *hpd_gpiod; |
|---|
| 72 | 57 | |
|---|
| 73 | 58 | struct hdmi_phy *phy; |
|---|
| 74 | 59 | struct device *phy_dev; |
|---|
| .. | .. |
|---|
| 118 | 103 | /* clks that need to be on for screen pwr (ie pixel clk): */ |
|---|
| 119 | 104 | const char **pwr_clk_names; |
|---|
| 120 | 105 | int pwr_clk_cnt; |
|---|
| 121 | | - |
|---|
| 122 | | - /* gpio's: */ |
|---|
| 123 | | - struct hdmi_gpio_data gpios[HDMI_MAX_NUM_GPIO]; |
|---|
| 124 | 106 | }; |
|---|
| 107 | + |
|---|
| 108 | +struct hdmi_bridge { |
|---|
| 109 | + struct drm_bridge base; |
|---|
| 110 | + struct hdmi *hdmi; |
|---|
| 111 | + struct work_struct hpd_work; |
|---|
| 112 | +}; |
|---|
| 113 | +#define to_hdmi_bridge(x) container_of(x, struct hdmi_bridge, base) |
|---|
| 125 | 114 | |
|---|
| 126 | 115 | void msm_hdmi_set_mode(struct hdmi *hdmi, bool power_on); |
|---|
| 127 | 116 | |
|---|
| .. | .. |
|---|
| 239 | 228 | struct drm_bridge *msm_hdmi_bridge_init(struct hdmi *hdmi); |
|---|
| 240 | 229 | void msm_hdmi_bridge_destroy(struct drm_bridge *bridge); |
|---|
| 241 | 230 | |
|---|
| 242 | | -/* |
|---|
| 243 | | - * hdmi connector: |
|---|
| 244 | | - */ |
|---|
| 245 | | - |
|---|
| 246 | | -void msm_hdmi_connector_irq(struct drm_connector *connector); |
|---|
| 247 | | -struct drm_connector *msm_hdmi_connector_init(struct hdmi *hdmi); |
|---|
| 248 | | -int msm_hdmi_hpd_enable(struct drm_connector *connector); |
|---|
| 231 | +void msm_hdmi_hpd_irq(struct drm_bridge *bridge); |
|---|
| 232 | +enum drm_connector_status msm_hdmi_bridge_detect( |
|---|
| 233 | + struct drm_bridge *bridge); |
|---|
| 234 | +int msm_hdmi_hpd_enable(struct drm_bridge *bridge); |
|---|
| 235 | +void msm_hdmi_hpd_disable(struct hdmi_bridge *hdmi_bridge); |
|---|
| 249 | 236 | |
|---|
| 250 | 237 | /* |
|---|
| 251 | 238 | * i2c adapter for ddc: |
|---|