drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
/*
|
2015-01-08 04:27:27 +07:00
|
|
|
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
* Copyright (C) 2013 Red Hat
|
|
|
|
* Author: Rob Clark <robdclark@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published by
|
|
|
|
* the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
drm/msm/mdp5: use irqdomains
For mdp5, the irqs of hdmi/eDP/dsi0/dsi1 blocks get routed through the
mdp block. In order to decouple hdmi/eDP/etc, register an irq domain
in mdp5. When hdmi/dsi/etc are used with mdp4, they can directly setup
their irqs in their DT nodes as normal. When used with mdp5, instead
set the mdp device as the interrupt-parent, as in:
mdp: qcom,mdss_mdp@fd900000 {
compatible = "qcom,mdss_mdp";
interrupt-controller;
#interrupt-cells = <1>;
...
};
hdmi: qcom,hdmi_tx@fd922100 {
compatible = "qcom,hdmi-tx-8074";
interrupt-parent = <&mdp>;
interrupts = <8 0>; /* MDP5_HW_INTR_STATUS.INTR_HDMI */
...
};
There is a slight awkwardness, in that we cannot disable child irqs
at the mdp level, they can only be cleared in the child block. So
you must not use threaded irq handlers in the child. I'm not sure
if there is a better way to deal with that.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-11-18 03:28:07 +07:00
|
|
|
#include <linux/of_irq.h>
|
2015-10-30 14:05:55 +07:00
|
|
|
#include <linux/of_gpio.h>
|
|
|
|
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
#include "hdmi.h"
|
|
|
|
|
|
|
|
void hdmi_set_mode(struct hdmi *hdmi, bool power_on)
|
|
|
|
{
|
|
|
|
uint32_t ctrl = 0;
|
2015-04-03 04:49:01 +07:00
|
|
|
unsigned long flags;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
|
2015-04-03 04:49:01 +07:00
|
|
|
spin_lock_irqsave(&hdmi->reg_lock, flags);
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
if (power_on) {
|
|
|
|
ctrl |= HDMI_CTRL_ENABLE;
|
|
|
|
if (!hdmi->hdmi_mode) {
|
|
|
|
ctrl |= HDMI_CTRL_HDMI;
|
|
|
|
hdmi_write(hdmi, REG_HDMI_CTRL, ctrl);
|
|
|
|
ctrl &= ~HDMI_CTRL_HDMI;
|
|
|
|
} else {
|
|
|
|
ctrl |= HDMI_CTRL_HDMI;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ctrl = HDMI_CTRL_HDMI;
|
|
|
|
}
|
|
|
|
|
|
|
|
hdmi_write(hdmi, REG_HDMI_CTRL, ctrl);
|
2015-04-03 04:49:01 +07:00
|
|
|
spin_unlock_irqrestore(&hdmi->reg_lock, flags);
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
DBG("HDMI Core: %s, HDMI_CTRL=0x%08x",
|
|
|
|
power_on ? "Enable" : "Disable", ctrl);
|
|
|
|
}
|
|
|
|
|
drm/msm/mdp5: use irqdomains
For mdp5, the irqs of hdmi/eDP/dsi0/dsi1 blocks get routed through the
mdp block. In order to decouple hdmi/eDP/etc, register an irq domain
in mdp5. When hdmi/dsi/etc are used with mdp4, they can directly setup
their irqs in their DT nodes as normal. When used with mdp5, instead
set the mdp device as the interrupt-parent, as in:
mdp: qcom,mdss_mdp@fd900000 {
compatible = "qcom,mdss_mdp";
interrupt-controller;
#interrupt-cells = <1>;
...
};
hdmi: qcom,hdmi_tx@fd922100 {
compatible = "qcom,hdmi-tx-8074";
interrupt-parent = <&mdp>;
interrupts = <8 0>; /* MDP5_HW_INTR_STATUS.INTR_HDMI */
...
};
There is a slight awkwardness, in that we cannot disable child irqs
at the mdp level, they can only be cleared in the child block. So
you must not use threaded irq handlers in the child. I'm not sure
if there is a better way to deal with that.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-11-18 03:28:07 +07:00
|
|
|
static irqreturn_t hdmi_irq(int irq, void *dev_id)
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
{
|
|
|
|
struct hdmi *hdmi = dev_id;
|
|
|
|
|
|
|
|
/* Process HPD: */
|
|
|
|
hdmi_connector_irq(hdmi->connector);
|
|
|
|
|
|
|
|
/* Process DDC: */
|
|
|
|
hdmi_i2c_irq(hdmi->i2c);
|
|
|
|
|
2015-04-03 04:49:01 +07:00
|
|
|
/* Process HDCP: */
|
|
|
|
if (hdmi->hdcp_ctrl)
|
|
|
|
hdmi_hdcp_irq(hdmi->hdcp_ctrl);
|
|
|
|
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
/* TODO audio.. */
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2014-11-18 20:40:44 +07:00
|
|
|
static void hdmi_destroy(struct hdmi *hdmi)
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
{
|
2015-04-03 04:49:01 +07:00
|
|
|
/*
|
|
|
|
* at this point, hpd has been disabled,
|
|
|
|
* after flush workq, it's safe to deinit hdcp
|
|
|
|
*/
|
|
|
|
if (hdmi->workq) {
|
|
|
|
flush_workqueue(hdmi->workq);
|
|
|
|
destroy_workqueue(hdmi->workq);
|
|
|
|
}
|
|
|
|
hdmi_hdcp_destroy(hdmi);
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
|
2016-02-25 12:52:40 +07:00
|
|
|
if (hdmi->phy_dev) {
|
|
|
|
put_device(hdmi->phy_dev);
|
|
|
|
hdmi->phy = NULL;
|
|
|
|
hdmi->phy_dev = NULL;
|
|
|
|
}
|
|
|
|
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
if (hdmi->i2c)
|
|
|
|
hdmi_i2c_destroy(hdmi->i2c);
|
|
|
|
|
2013-12-12 02:44:02 +07:00
|
|
|
platform_set_drvdata(hdmi->pdev, NULL);
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
}
|
|
|
|
|
2016-02-25 12:52:40 +07:00
|
|
|
static int hdmi_get_phy(struct hdmi *hdmi)
|
|
|
|
{
|
|
|
|
struct platform_device *pdev = hdmi->pdev;
|
|
|
|
struct platform_device *phy_pdev;
|
|
|
|
struct device_node *phy_node;
|
|
|
|
|
|
|
|
phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
|
|
|
|
if (!phy_node) {
|
|
|
|
dev_err(&pdev->dev, "cannot find phy device\n");
|
|
|
|
return -ENXIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
phy_pdev = of_find_device_by_node(phy_node);
|
|
|
|
if (phy_pdev)
|
|
|
|
hdmi->phy = platform_get_drvdata(phy_pdev);
|
|
|
|
|
|
|
|
of_node_put(phy_node);
|
|
|
|
|
|
|
|
if (!phy_pdev || !hdmi->phy) {
|
|
|
|
dev_err(&pdev->dev, "phy driver is not ready\n");
|
|
|
|
return -EPROBE_DEFER;
|
|
|
|
}
|
|
|
|
|
|
|
|
hdmi->phy_dev = get_device(&phy_pdev->dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-11-05 01:33:14 +07:00
|
|
|
/* construct hdmi at bind/probe time, grab all the resources. If
|
|
|
|
* we are to EPROBE_DEFER we want to do it here, rather than later
|
|
|
|
* at modeset_init() time
|
|
|
|
*/
|
|
|
|
static struct hdmi *hdmi_init(struct platform_device *pdev)
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
{
|
2014-11-05 01:33:14 +07:00
|
|
|
struct hdmi_platform_config *config = pdev->dev.platform_data;
|
2013-08-31 00:02:15 +07:00
|
|
|
struct hdmi *hdmi = NULL;
|
2015-04-03 04:49:01 +07:00
|
|
|
struct resource *res;
|
2013-12-02 00:12:54 +07:00
|
|
|
int i, ret;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
|
2014-11-05 01:33:14 +07:00
|
|
|
hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
|
2013-08-31 00:02:15 +07:00
|
|
|
if (!hdmi) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
hdmi->pdev = pdev;
|
2013-12-02 00:12:54 +07:00
|
|
|
hdmi->config = config;
|
2015-04-03 04:49:01 +07:00
|
|
|
spin_lock_init(&hdmi->reg_lock);
|
2013-12-12 02:44:02 +07:00
|
|
|
|
2013-12-02 00:12:54 +07:00
|
|
|
hdmi->mmio = msm_ioremap(pdev, config->mmio_name, "HDMI");
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
if (IS_ERR(hdmi->mmio)) {
|
|
|
|
ret = PTR_ERR(hdmi->mmio);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2015-04-03 04:49:01 +07:00
|
|
|
/* HDCP needs physical address of hdmi register */
|
|
|
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
|
|
|
config->mmio_name);
|
|
|
|
hdmi->mmio_phy_addr = res->start;
|
|
|
|
|
|
|
|
hdmi->qfprom_mmio = msm_ioremap(pdev,
|
|
|
|
config->qfprom_mmio_name, "HDMI_QFPROM");
|
|
|
|
if (IS_ERR(hdmi->qfprom_mmio)) {
|
|
|
|
dev_info(&pdev->dev, "can't find qfprom resource\n");
|
|
|
|
hdmi->qfprom_mmio = NULL;
|
|
|
|
}
|
|
|
|
|
2015-01-14 02:33:40 +07:00
|
|
|
hdmi->hpd_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_regs[0]) *
|
|
|
|
config->hpd_reg_cnt, GFP_KERNEL);
|
|
|
|
if (!hdmi->hpd_regs) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
2013-12-02 00:12:54 +07:00
|
|
|
for (i = 0; i < config->hpd_reg_cnt; i++) {
|
|
|
|
struct regulator *reg;
|
|
|
|
|
2014-08-02 00:08:11 +07:00
|
|
|
reg = devm_regulator_get(&pdev->dev,
|
2013-12-16 04:23:05 +07:00
|
|
|
config->hpd_reg_names[i]);
|
2013-12-02 00:12:54 +07:00
|
|
|
if (IS_ERR(reg)) {
|
|
|
|
ret = PTR_ERR(reg);
|
2014-11-05 01:33:14 +07:00
|
|
|
dev_err(&pdev->dev, "failed to get hpd regulator: %s (%d)\n",
|
2013-12-02 00:12:54 +07:00
|
|
|
config->hpd_reg_names[i], ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
hdmi->hpd_regs[i] = reg;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
}
|
|
|
|
|
2015-01-14 02:33:40 +07:00
|
|
|
hdmi->pwr_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_regs[0]) *
|
|
|
|
config->pwr_reg_cnt, GFP_KERNEL);
|
|
|
|
if (!hdmi->pwr_regs) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
2013-12-02 00:12:54 +07:00
|
|
|
for (i = 0; i < config->pwr_reg_cnt; i++) {
|
|
|
|
struct regulator *reg;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
|
2014-08-02 00:08:11 +07:00
|
|
|
reg = devm_regulator_get(&pdev->dev,
|
2013-12-16 04:23:05 +07:00
|
|
|
config->pwr_reg_names[i]);
|
2013-12-02 00:12:54 +07:00
|
|
|
if (IS_ERR(reg)) {
|
|
|
|
ret = PTR_ERR(reg);
|
2014-11-05 01:33:14 +07:00
|
|
|
dev_err(&pdev->dev, "failed to get pwr regulator: %s (%d)\n",
|
2013-12-02 00:12:54 +07:00
|
|
|
config->pwr_reg_names[i], ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
hdmi->pwr_regs[i] = reg;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
}
|
|
|
|
|
2015-01-14 02:33:40 +07:00
|
|
|
hdmi->hpd_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_clks[0]) *
|
|
|
|
config->hpd_clk_cnt, GFP_KERNEL);
|
|
|
|
if (!hdmi->hpd_clks) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
2013-12-02 00:12:54 +07:00
|
|
|
for (i = 0; i < config->hpd_clk_cnt; i++) {
|
|
|
|
struct clk *clk;
|
|
|
|
|
|
|
|
clk = devm_clk_get(&pdev->dev, config->hpd_clk_names[i]);
|
|
|
|
if (IS_ERR(clk)) {
|
|
|
|
ret = PTR_ERR(clk);
|
2014-11-05 01:33:14 +07:00
|
|
|
dev_err(&pdev->dev, "failed to get hpd clk: %s (%d)\n",
|
2013-12-02 00:12:54 +07:00
|
|
|
config->hpd_clk_names[i], ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
hdmi->hpd_clks[i] = clk;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
}
|
|
|
|
|
2015-01-14 02:33:40 +07:00
|
|
|
hdmi->pwr_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_clks[0]) *
|
|
|
|
config->pwr_clk_cnt, GFP_KERNEL);
|
|
|
|
if (!hdmi->pwr_clks) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
2013-12-02 00:12:54 +07:00
|
|
|
for (i = 0; i < config->pwr_clk_cnt; i++) {
|
|
|
|
struct clk *clk;
|
|
|
|
|
|
|
|
clk = devm_clk_get(&pdev->dev, config->pwr_clk_names[i]);
|
|
|
|
if (IS_ERR(clk)) {
|
|
|
|
ret = PTR_ERR(clk);
|
2014-11-05 01:33:14 +07:00
|
|
|
dev_err(&pdev->dev, "failed to get pwr clk: %s (%d)\n",
|
2013-12-02 00:12:54 +07:00
|
|
|
config->pwr_clk_names[i], ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
hdmi->pwr_clks[i] = clk;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
}
|
|
|
|
|
2015-04-03 04:49:01 +07:00
|
|
|
hdmi->workq = alloc_ordered_workqueue("msm_hdmi", 0);
|
|
|
|
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
hdmi->i2c = hdmi_i2c_init(hdmi);
|
|
|
|
if (IS_ERR(hdmi->i2c)) {
|
|
|
|
ret = PTR_ERR(hdmi->i2c);
|
2014-11-05 01:33:14 +07:00
|
|
|
dev_err(&pdev->dev, "failed to get i2c: %d\n", ret);
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
hdmi->i2c = NULL;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2016-02-25 12:52:40 +07:00
|
|
|
ret = hdmi_get_phy(hdmi);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(&pdev->dev, "failed to get phy\n");
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2015-04-03 04:49:01 +07:00
|
|
|
hdmi->hdcp_ctrl = hdmi_hdcp_init(hdmi);
|
|
|
|
if (IS_ERR(hdmi->hdcp_ctrl)) {
|
|
|
|
dev_warn(&pdev->dev, "failed to init hdcp: disabled\n");
|
|
|
|
hdmi->hdcp_ctrl = NULL;
|
|
|
|
}
|
|
|
|
|
2014-11-05 01:33:14 +07:00
|
|
|
return hdmi;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (hdmi)
|
2014-11-18 20:40:44 +07:00
|
|
|
hdmi_destroy(hdmi);
|
2014-11-05 01:33:14 +07:00
|
|
|
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Second part of initialization, the drm/kms level modeset_init,
|
|
|
|
* constructs/initializes mode objects, etc, is called from master
|
|
|
|
* driver (not hdmi sub-device's probe/bind!)
|
|
|
|
*
|
|
|
|
* Any resource (regulator/clk/etc) which could be missing at boot
|
|
|
|
* should be handled in hdmi_init() so that failure happens from
|
|
|
|
* hdmi sub-device's probe.
|
|
|
|
*/
|
|
|
|
int hdmi_modeset_init(struct hdmi *hdmi,
|
|
|
|
struct drm_device *dev, struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
struct msm_drm_private *priv = dev->dev_private;
|
|
|
|
struct platform_device *pdev = hdmi->pdev;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
hdmi->dev = dev;
|
|
|
|
hdmi->encoder = encoder;
|
|
|
|
|
|
|
|
hdmi_audio_infoframe_init(&hdmi->audio.infoframe);
|
|
|
|
|
2013-08-31 00:02:15 +07:00
|
|
|
hdmi->bridge = hdmi_bridge_init(hdmi);
|
|
|
|
if (IS_ERR(hdmi->bridge)) {
|
|
|
|
ret = PTR_ERR(hdmi->bridge);
|
|
|
|
dev_err(dev->dev, "failed to create HDMI bridge: %d\n", ret);
|
|
|
|
hdmi->bridge = NULL;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
hdmi->connector = hdmi_connector_init(hdmi);
|
|
|
|
if (IS_ERR(hdmi->connector)) {
|
|
|
|
ret = PTR_ERR(hdmi->connector);
|
|
|
|
dev_err(dev->dev, "failed to create HDMI connector: %d\n", ret);
|
|
|
|
hdmi->connector = NULL;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
drm/msm/mdp5: use irqdomains
For mdp5, the irqs of hdmi/eDP/dsi0/dsi1 blocks get routed through the
mdp block. In order to decouple hdmi/eDP/etc, register an irq domain
in mdp5. When hdmi/dsi/etc are used with mdp4, they can directly setup
their irqs in their DT nodes as normal. When used with mdp5, instead
set the mdp device as the interrupt-parent, as in:
mdp: qcom,mdss_mdp@fd900000 {
compatible = "qcom,mdss_mdp";
interrupt-controller;
#interrupt-cells = <1>;
...
};
hdmi: qcom,hdmi_tx@fd922100 {
compatible = "qcom,hdmi-tx-8074";
interrupt-parent = <&mdp>;
interrupts = <8 0>; /* MDP5_HW_INTR_STATUS.INTR_HDMI */
...
};
There is a slight awkwardness, in that we cannot disable child irqs
at the mdp level, they can only be cleared in the child block. So
you must not use threaded irq handlers in the child. I'm not sure
if there is a better way to deal with that.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-11-18 03:28:07 +07:00
|
|
|
hdmi->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
|
|
|
|
if (hdmi->irq < 0) {
|
|
|
|
ret = hdmi->irq;
|
|
|
|
dev_err(dev->dev, "failed to get irq: %d\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
|
drm/msm/mdp5: use irqdomains
For mdp5, the irqs of hdmi/eDP/dsi0/dsi1 blocks get routed through the
mdp block. In order to decouple hdmi/eDP/etc, register an irq domain
in mdp5. When hdmi/dsi/etc are used with mdp4, they can directly setup
their irqs in their DT nodes as normal. When used with mdp5, instead
set the mdp device as the interrupt-parent, as in:
mdp: qcom,mdss_mdp@fd900000 {
compatible = "qcom,mdss_mdp";
interrupt-controller;
#interrupt-cells = <1>;
...
};
hdmi: qcom,hdmi_tx@fd922100 {
compatible = "qcom,hdmi-tx-8074";
interrupt-parent = <&mdp>;
interrupts = <8 0>; /* MDP5_HW_INTR_STATUS.INTR_HDMI */
...
};
There is a slight awkwardness, in that we cannot disable child irqs
at the mdp level, they can only be cleared in the child block. So
you must not use threaded irq handlers in the child. I'm not sure
if there is a better way to deal with that.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-11-18 03:28:07 +07:00
|
|
|
ret = devm_request_irq(&pdev->dev, hdmi->irq,
|
|
|
|
hdmi_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
|
|
|
|
"hdmi_isr", hdmi);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(dev->dev, "failed to request IRQ%u: %d\n",
|
|
|
|
hdmi->irq, ret);
|
|
|
|
goto fail;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
}
|
|
|
|
|
2013-08-31 00:02:15 +07:00
|
|
|
encoder->bridge = hdmi->bridge;
|
|
|
|
|
|
|
|
priv->bridges[priv->num_bridges++] = hdmi->bridge;
|
|
|
|
priv->connectors[priv->num_connectors++] = hdmi->connector;
|
|
|
|
|
2013-12-12 02:44:02 +07:00
|
|
|
platform_set_drvdata(pdev, hdmi);
|
|
|
|
|
2014-11-05 01:33:14 +07:00
|
|
|
return 0;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
|
|
|
|
fail:
|
2015-01-20 23:38:44 +07:00
|
|
|
/* bridge is normally destroyed by drm: */
|
2014-11-05 01:33:14 +07:00
|
|
|
if (hdmi->bridge) {
|
2015-01-20 23:38:44 +07:00
|
|
|
hdmi_bridge_destroy(hdmi->bridge);
|
2014-11-05 01:33:14 +07:00
|
|
|
hdmi->bridge = NULL;
|
|
|
|
}
|
|
|
|
if (hdmi->connector) {
|
|
|
|
hdmi->connector->funcs->destroy(hdmi->connector);
|
|
|
|
hdmi->connector = NULL;
|
2013-08-31 00:02:15 +07:00
|
|
|
}
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
|
2014-11-05 01:33:14 +07:00
|
|
|
return ret;
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The hdmi device:
|
|
|
|
*/
|
|
|
|
|
2015-01-08 04:27:27 +07:00
|
|
|
#define HDMI_CFG(item, entry) \
|
|
|
|
.item ## _names = item ##_names_ ## entry, \
|
|
|
|
.item ## _cnt = ARRAY_SIZE(item ## _names_ ## entry)
|
|
|
|
|
2015-09-15 19:41:49 +07:00
|
|
|
static const char *pwr_reg_names_none[] = {};
|
|
|
|
static const char *hpd_reg_names_none[] = {};
|
|
|
|
|
2016-02-25 12:52:41 +07:00
|
|
|
static struct hdmi_platform_config hdmi_tx_8660_config;
|
2015-01-08 04:27:27 +07:00
|
|
|
|
|
|
|
static const char *hpd_reg_names_8960[] = {"core-vdda", "hdmi-mux"};
|
|
|
|
static const char *hpd_clk_names_8960[] = {"core_clk", "master_iface_clk", "slave_iface_clk"};
|
|
|
|
|
|
|
|
static struct hdmi_platform_config hdmi_tx_8960_config = {
|
|
|
|
HDMI_CFG(hpd_reg, 8960),
|
|
|
|
HDMI_CFG(hpd_clk, 8960),
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"};
|
|
|
|
static const char *hpd_reg_names_8x74[] = {"hpd-gdsc", "hpd-5v"};
|
|
|
|
static const char *pwr_clk_names_8x74[] = {"extp_clk", "alt_iface_clk"};
|
|
|
|
static const char *hpd_clk_names_8x74[] = {"iface_clk", "core_clk", "mdp_core_clk"};
|
|
|
|
static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0};
|
|
|
|
|
2015-07-28 07:52:50 +07:00
|
|
|
static struct hdmi_platform_config hdmi_tx_8974_config = {
|
2015-01-08 04:27:27 +07:00
|
|
|
HDMI_CFG(pwr_reg, 8x74),
|
|
|
|
HDMI_CFG(hpd_reg, 8x74),
|
|
|
|
HDMI_CFG(pwr_clk, 8x74),
|
|
|
|
HDMI_CFG(hpd_clk, 8x74),
|
|
|
|
.hpd_freq = hpd_clk_freq_8x74,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *hpd_reg_names_8084[] = {"hpd-gdsc", "hpd-5v", "hpd-5v-en"};
|
|
|
|
|
|
|
|
static struct hdmi_platform_config hdmi_tx_8084_config = {
|
|
|
|
HDMI_CFG(pwr_reg, 8x74),
|
|
|
|
HDMI_CFG(hpd_reg, 8084),
|
|
|
|
HDMI_CFG(pwr_clk, 8x74),
|
|
|
|
HDMI_CFG(hpd_clk, 8x74),
|
|
|
|
.hpd_freq = hpd_clk_freq_8x74,
|
|
|
|
};
|
|
|
|
|
2015-07-28 07:52:50 +07:00
|
|
|
static struct hdmi_platform_config hdmi_tx_8994_config = {
|
2015-06-20 03:04:47 +07:00
|
|
|
HDMI_CFG(pwr_reg, 8x74),
|
2015-09-15 19:41:49 +07:00
|
|
|
HDMI_CFG(hpd_reg, none),
|
|
|
|
HDMI_CFG(pwr_clk, 8x74),
|
|
|
|
HDMI_CFG(hpd_clk, 8x74),
|
|
|
|
.hpd_freq = hpd_clk_freq_8x74,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct hdmi_platform_config hdmi_tx_8996_config = {
|
|
|
|
HDMI_CFG(pwr_reg, none),
|
|
|
|
HDMI_CFG(hpd_reg, none),
|
2015-06-20 03:04:47 +07:00
|
|
|
HDMI_CFG(pwr_clk, 8x74),
|
|
|
|
HDMI_CFG(hpd_clk, 8x74),
|
|
|
|
.hpd_freq = hpd_clk_freq_8x74,
|
|
|
|
};
|
|
|
|
|
2016-02-25 12:52:36 +07:00
|
|
|
static const struct {
|
|
|
|
const char *name;
|
|
|
|
const bool output;
|
|
|
|
const int value;
|
|
|
|
const char *label;
|
|
|
|
} hdmi_gpio_pdata[] = {
|
|
|
|
{ "qcom,hdmi-tx-ddc-clk", true, 1, "HDMI_DDC_CLK" },
|
|
|
|
{ "qcom,hdmi-tx-ddc-data", true, 1, "HDMI_DDC_DATA" },
|
|
|
|
{ "qcom,hdmi-tx-hpd", false, 1, "HDMI_HPD" },
|
|
|
|
{ "qcom,hdmi-tx-mux-en", true, 1, "HDMI_MUX_EN" },
|
|
|
|
{ "qcom,hdmi-tx-mux-sel", true, 0, "HDMI_MUX_SEL" },
|
|
|
|
{ "qcom,hdmi-tx-mux-lpm", true, 1, "HDMI_MUX_LPM" },
|
|
|
|
};
|
|
|
|
|
|
|
|
static int get_gpio(struct device_node *of_node, const char *name)
|
2014-08-30 01:05:50 +07:00
|
|
|
{
|
|
|
|
int gpio = of_get_named_gpio(of_node, name, 0);
|
|
|
|
if (gpio < 0) {
|
|
|
|
char name2[32];
|
|
|
|
snprintf(name2, sizeof(name2), "%s-gpio", name);
|
|
|
|
gpio = of_get_named_gpio(of_node, name2, 0);
|
|
|
|
if (gpio < 0) {
|
2015-06-20 03:04:47 +07:00
|
|
|
DBG("failed to get gpio: %s (%d)", name, gpio);
|
2014-08-30 01:05:50 +07:00
|
|
|
gpio = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return gpio;
|
|
|
|
}
|
|
|
|
|
2014-03-04 02:19:12 +07:00
|
|
|
static int hdmi_bind(struct device *dev, struct device *master, void *data)
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
{
|
2014-11-18 20:40:44 +07:00
|
|
|
struct drm_device *drm = dev_get_drvdata(master);
|
|
|
|
struct msm_drm_private *priv = drm->dev_private;
|
2015-01-08 04:27:27 +07:00
|
|
|
static struct hdmi_platform_config *hdmi_cfg;
|
2014-11-05 01:33:14 +07:00
|
|
|
struct hdmi *hdmi;
|
2014-03-04 02:19:12 +07:00
|
|
|
struct device_node *of_node = dev->of_node;
|
2016-02-25 12:52:36 +07:00
|
|
|
int i;
|
2013-12-02 00:12:54 +07:00
|
|
|
|
2015-10-30 14:05:55 +07:00
|
|
|
hdmi_cfg = (struct hdmi_platform_config *)
|
|
|
|
of_device_get_match_data(dev);
|
|
|
|
if (!hdmi_cfg) {
|
|
|
|
dev_err(dev, "unknown hdmi_cfg: %s\n", of_node->name);
|
2015-01-08 04:27:27 +07:00
|
|
|
return -ENXIO;
|
2013-12-16 04:23:05 +07:00
|
|
|
}
|
2013-12-02 00:12:54 +07:00
|
|
|
|
2015-01-08 04:27:27 +07:00
|
|
|
hdmi_cfg->mmio_name = "core_physical";
|
2015-04-03 04:49:01 +07:00
|
|
|
hdmi_cfg->qfprom_mmio_name = "qfprom_physical";
|
2016-02-25 12:52:36 +07:00
|
|
|
|
|
|
|
for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) {
|
|
|
|
hdmi_cfg->gpios[i].num = get_gpio(of_node,
|
|
|
|
hdmi_gpio_pdata[i].name);
|
|
|
|
hdmi_cfg->gpios[i].output = hdmi_gpio_pdata[i].output;
|
|
|
|
hdmi_cfg->gpios[i].value = hdmi_gpio_pdata[i].value;
|
|
|
|
hdmi_cfg->gpios[i].label = hdmi_gpio_pdata[i].label;
|
|
|
|
}
|
2013-12-02 00:12:54 +07:00
|
|
|
|
2015-01-08 04:27:27 +07:00
|
|
|
dev->platform_data = hdmi_cfg;
|
|
|
|
|
2014-11-05 01:33:14 +07:00
|
|
|
hdmi = hdmi_init(to_platform_device(dev));
|
|
|
|
if (IS_ERR(hdmi))
|
|
|
|
return PTR_ERR(hdmi);
|
2014-11-18 20:40:44 +07:00
|
|
|
priv->hdmi = hdmi;
|
2015-01-08 04:27:27 +07:00
|
|
|
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-03-04 02:19:12 +07:00
|
|
|
static void hdmi_unbind(struct device *dev, struct device *master,
|
|
|
|
void *data)
|
|
|
|
{
|
2014-11-18 20:40:44 +07:00
|
|
|
struct drm_device *drm = dev_get_drvdata(master);
|
|
|
|
struct msm_drm_private *priv = drm->dev_private;
|
|
|
|
if (priv->hdmi) {
|
|
|
|
hdmi_destroy(priv->hdmi);
|
|
|
|
priv->hdmi = NULL;
|
|
|
|
}
|
2014-03-04 02:19:12 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct component_ops hdmi_ops = {
|
|
|
|
.bind = hdmi_bind,
|
|
|
|
.unbind = hdmi_unbind,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int hdmi_dev_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
return component_add(&pdev->dev, &hdmi_ops);
|
|
|
|
}
|
|
|
|
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
static int hdmi_dev_remove(struct platform_device *pdev)
|
|
|
|
{
|
2014-03-04 02:19:12 +07:00
|
|
|
component_del(&pdev->dev, &hdmi_ops);
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-30 14:05:55 +07:00
|
|
|
static const struct of_device_id dt_match[] = {
|
|
|
|
{ .compatible = "qcom,hdmi-tx-8996", .data = &hdmi_tx_8996_config },
|
|
|
|
{ .compatible = "qcom,hdmi-tx-8994", .data = &hdmi_tx_8994_config },
|
|
|
|
{ .compatible = "qcom,hdmi-tx-8084", .data = &hdmi_tx_8084_config },
|
|
|
|
{ .compatible = "qcom,hdmi-tx-8974", .data = &hdmi_tx_8974_config },
|
|
|
|
{ .compatible = "qcom,hdmi-tx-8960", .data = &hdmi_tx_8960_config },
|
|
|
|
{ .compatible = "qcom,hdmi-tx-8660", .data = &hdmi_tx_8660_config },
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
static struct platform_driver hdmi_driver = {
|
|
|
|
.probe = hdmi_dev_probe,
|
|
|
|
.remove = hdmi_dev_remove,
|
2013-12-02 00:12:54 +07:00
|
|
|
.driver = {
|
|
|
|
.name = "hdmi_msm",
|
|
|
|
.of_match_table = dt_match,
|
|
|
|
},
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
void __init hdmi_register(void)
|
|
|
|
{
|
2016-02-25 12:52:38 +07:00
|
|
|
hdmi_phy_driver_register();
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
platform_driver_register(&hdmi_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
void __exit hdmi_unregister(void)
|
|
|
|
{
|
|
|
|
platform_driver_unregister(&hdmi_driver);
|
2016-02-25 12:52:38 +07:00
|
|
|
hdmi_phy_driver_unregister();
|
drm/msm: basic KMS driver for snapdragon
The snapdragon chips have multiple different display controllers,
depending on which chip variant/version. (As far as I can tell, current
devices have either MDP3 or MDP4, and upcoming devices have MDSS.) And
then external to the display controller are HDMI, DSI, etc. blocks which
may be shared across devices which have different display controller
blocks.
To more easily add support for different display controller blocks, the
display controller specific bits are split out into a "kms" module,
which provides the kms plane/crtc/encoder objects.
The external HDMI, DSI, etc. blocks are part encoder, and part connector
currently. But I think I will pull in the drm_bridge patches from
chromeos tree, and split them into a bridge+connector, with the
registers that need to be set in modeset handled by the bridge. This
would remove the 'msm_connector' base class. But some things need to be
double checked to make sure I could get the correct ON/OFF sequencing..
This patch adds support for mdp4 crtc (including hw cursor), dtv encoder
(part of MDP4 block), and hdmi.
Signed-off-by: Rob Clark <robdclark@gmail.com>
2013-06-26 23:44:06 +07:00
|
|
|
}
|