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-27 01:44:06 +09: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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "msm_drv.h"
|
2013-11-17 02:56:06 +09:00
|
|
|
#include "msm_mmu.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-27 01:44:06 +09:00
|
|
|
#include "mdp4_kms.h"
|
|
|
|
|
|
|
|
static struct mdp4_platform_config *mdp4_get_config(struct platform_device *dev);
|
|
|
|
|
|
|
|
static int mdp4_hw_init(struct msm_kms *kms)
|
|
|
|
{
|
2013-12-01 07:24:22 +09:00
|
|
|
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
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-27 01:44:06 +09:00
|
|
|
struct drm_device *dev = mdp4_kms->dev;
|
|
|
|
uint32_t version, major, minor, dmap_cfg, vg_cfg;
|
|
|
|
unsigned long clk;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
pm_runtime_get_sync(dev->dev);
|
|
|
|
|
2013-11-17 03:07:31 +09:00
|
|
|
mdp4_enable(mdp4_kms);
|
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-27 01:44:06 +09:00
|
|
|
version = mdp4_read(mdp4_kms, REG_MDP4_VERSION);
|
2013-11-17 03:07:31 +09:00
|
|
|
mdp4_disable(mdp4_kms);
|
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-27 01:44:06 +09:00
|
|
|
|
|
|
|
major = FIELD(version, MDP4_VERSION_MAJOR);
|
|
|
|
minor = FIELD(version, MDP4_VERSION_MINOR);
|
|
|
|
|
2013-12-02 02:12:54 +09:00
|
|
|
DBG("found MDP4 version v%d.%d", major, minor);
|
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-27 01:44:06 +09:00
|
|
|
|
|
|
|
if (major != 4) {
|
|
|
|
dev_err(dev->dev, "unexpected MDP version: v%d.%d\n",
|
|
|
|
major, minor);
|
|
|
|
ret = -ENXIO;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
mdp4_kms->rev = minor;
|
|
|
|
|
|
|
|
if (mdp4_kms->dsi_pll_vdda) {
|
|
|
|
if ((mdp4_kms->rev == 2) || (mdp4_kms->rev == 4)) {
|
|
|
|
ret = regulator_set_voltage(mdp4_kms->dsi_pll_vdda,
|
|
|
|
1200000, 1200000);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev->dev,
|
|
|
|
"failed to set dsi_pll_vdda voltage: %d\n", ret);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mdp4_kms->dsi_pll_vddio) {
|
|
|
|
if (mdp4_kms->rev == 2) {
|
|
|
|
ret = regulator_set_voltage(mdp4_kms->dsi_pll_vddio,
|
|
|
|
1800000, 1800000);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev->dev,
|
|
|
|
"failed to set dsi_pll_vddio voltage: %d\n", ret);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mdp4_kms->rev > 1) {
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_CS_CONTROLLER0, 0x0707ffff);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_CS_CONTROLLER1, 0x03073f3f);
|
|
|
|
}
|
|
|
|
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_PORTMAP_MODE, 0x3);
|
|
|
|
|
|
|
|
/* max read pending cmd config, 3 pending requests: */
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_READ_CNFG, 0x02222);
|
|
|
|
|
|
|
|
clk = clk_get_rate(mdp4_kms->clk);
|
|
|
|
|
|
|
|
if ((mdp4_kms->rev >= 1) || (clk >= 90000000)) {
|
|
|
|
dmap_cfg = 0x47; /* 16 bytes-burst x 8 req */
|
|
|
|
vg_cfg = 0x47; /* 16 bytes-burs x 8 req */
|
|
|
|
} else {
|
|
|
|
dmap_cfg = 0x27; /* 8 bytes-burst x 8 req */
|
|
|
|
vg_cfg = 0x43; /* 16 bytes-burst x 4 req */
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG("fetch config: dmap=%02x, vg=%02x", dmap_cfg, vg_cfg);
|
|
|
|
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_DMA_FETCH_CONFIG(DMA_P), dmap_cfg);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_DMA_FETCH_CONFIG(DMA_E), dmap_cfg);
|
|
|
|
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_PIPE_FETCH_CONFIG(VG1), vg_cfg);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_PIPE_FETCH_CONFIG(VG2), vg_cfg);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_PIPE_FETCH_CONFIG(RGB1), vg_cfg);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_PIPE_FETCH_CONFIG(RGB2), vg_cfg);
|
|
|
|
|
|
|
|
if (mdp4_kms->rev >= 2)
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_LAYERMIXER_IN_CFG_UPDATE_METHOD, 1);
|
2014-08-06 20:43:12 +09:00
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_LAYERMIXER_IN_CFG, 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-27 01:44:06 +09:00
|
|
|
|
|
|
|
/* disable CSC matrix / YUV by default: */
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_PIPE_OP_MODE(VG1), 0);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_PIPE_OP_MODE(VG2), 0);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_DMA_P_OP_MODE, 0);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_DMA_S_OP_MODE, 0);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_OVLP_CSC_CONFIG(1), 0);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_OVLP_CSC_CONFIG(2), 0);
|
|
|
|
|
|
|
|
if (mdp4_kms->rev > 1)
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_RESET_STATUS, 1);
|
|
|
|
|
2015-01-30 23:48:11 +09:00
|
|
|
dev->mode_config.allow_fb_modifiers = true;
|
|
|
|
|
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-27 01:44:06 +09:00
|
|
|
out:
|
|
|
|
pm_runtime_put_sync(dev->dev);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-01-31 07:04:45 +09:00
|
|
|
static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *state)
|
|
|
|
{
|
|
|
|
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
|
|
|
int i, ncrtcs = state->dev->mode_config.num_crtc;
|
|
|
|
|
|
|
|
mdp4_enable(mdp4_kms);
|
|
|
|
|
|
|
|
/* see 119ecb7fd */
|
|
|
|
for (i = 0; i < ncrtcs; i++) {
|
|
|
|
struct drm_crtc *crtc = state->crtcs[i];
|
|
|
|
if (!crtc)
|
|
|
|
continue;
|
|
|
|
drm_crtc_vblank_get(crtc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *state)
|
|
|
|
{
|
|
|
|
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
|
|
|
int i, ncrtcs = state->dev->mode_config.num_crtc;
|
|
|
|
|
|
|
|
/* see 119ecb7fd */
|
|
|
|
for (i = 0; i < ncrtcs; i++) {
|
|
|
|
struct drm_crtc *crtc = state->crtcs[i];
|
|
|
|
if (!crtc)
|
|
|
|
continue;
|
|
|
|
drm_crtc_vblank_put(crtc);
|
|
|
|
}
|
|
|
|
|
|
|
|
mdp4_disable(mdp4_kms);
|
|
|
|
}
|
|
|
|
|
2015-04-29 08:35:37 +09:00
|
|
|
static void mdp4_wait_for_crtc_commit_done(struct msm_kms *kms,
|
|
|
|
struct drm_crtc *crtc)
|
|
|
|
{
|
|
|
|
mdp4_crtc_wait_for_commit_done(crtc);
|
|
|
|
}
|
|
|
|
|
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-27 01:44:06 +09:00
|
|
|
static long mdp4_round_pixclk(struct msm_kms *kms, unsigned long rate,
|
|
|
|
struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
/* if we had >1 encoder, we'd need something more clever: */
|
|
|
|
return mdp4_dtv_round_pixclk(encoder, rate);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mdp4_preclose(struct msm_kms *kms, struct drm_file *file)
|
|
|
|
{
|
2013-12-01 07:24:22 +09:00
|
|
|
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
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-27 01:44:06 +09:00
|
|
|
struct msm_drm_private *priv = mdp4_kms->dev->dev_private;
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
for (i = 0; i < priv->num_crtcs; i++)
|
2013-10-30 01:05:20 +09:00
|
|
|
mdp4_crtc_cancel_pending_flip(priv->crtcs[i], file);
|
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-27 01:44:06 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mdp4_destroy(struct msm_kms *kms)
|
|
|
|
{
|
2013-12-01 07:24:22 +09:00
|
|
|
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
2014-04-23 01:27:28 +09:00
|
|
|
if (mdp4_kms->blank_cursor_iova)
|
|
|
|
msm_gem_put_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id);
|
|
|
|
if (mdp4_kms->blank_cursor_bo)
|
2014-07-02 03:49:25 +09:00
|
|
|
drm_gem_object_unreference_unlocked(mdp4_kms->blank_cursor_bo);
|
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-27 01:44:06 +09:00
|
|
|
kfree(mdp4_kms);
|
|
|
|
}
|
|
|
|
|
2013-12-01 07:24:22 +09:00
|
|
|
static const struct mdp_kms_funcs kms_funcs = {
|
|
|
|
.base = {
|
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-27 01:44:06 +09:00
|
|
|
.hw_init = mdp4_hw_init,
|
|
|
|
.irq_preinstall = mdp4_irq_preinstall,
|
|
|
|
.irq_postinstall = mdp4_irq_postinstall,
|
|
|
|
.irq_uninstall = mdp4_irq_uninstall,
|
|
|
|
.irq = mdp4_irq,
|
|
|
|
.enable_vblank = mdp4_enable_vblank,
|
|
|
|
.disable_vblank = mdp4_disable_vblank,
|
2015-01-31 07:04:45 +09:00
|
|
|
.prepare_commit = mdp4_prepare_commit,
|
|
|
|
.complete_commit = mdp4_complete_commit,
|
2015-04-29 08:35:37 +09:00
|
|
|
.wait_for_crtc_commit_done = mdp4_wait_for_crtc_commit_done,
|
2013-12-01 04:58:23 +09:00
|
|
|
.get_format = mdp_get_format,
|
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-27 01:44:06 +09:00
|
|
|
.round_pixclk = mdp4_round_pixclk,
|
|
|
|
.preclose = mdp4_preclose,
|
|
|
|
.destroy = mdp4_destroy,
|
2013-12-01 07:24:22 +09:00
|
|
|
},
|
|
|
|
.set_irqmask = mdp4_set_irqmask,
|
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-27 01:44:06 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
int mdp4_disable(struct mdp4_kms *mdp4_kms)
|
|
|
|
{
|
|
|
|
DBG("");
|
|
|
|
|
|
|
|
clk_disable_unprepare(mdp4_kms->clk);
|
|
|
|
if (mdp4_kms->pclk)
|
|
|
|
clk_disable_unprepare(mdp4_kms->pclk);
|
|
|
|
clk_disable_unprepare(mdp4_kms->lut_clk);
|
2014-07-01 07:50:51 +09:00
|
|
|
if (mdp4_kms->axi_clk)
|
|
|
|
clk_disable_unprepare(mdp4_kms->axi_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-27 01:44:06 +09:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mdp4_enable(struct mdp4_kms *mdp4_kms)
|
|
|
|
{
|
|
|
|
DBG("");
|
|
|
|
|
|
|
|
clk_prepare_enable(mdp4_kms->clk);
|
|
|
|
if (mdp4_kms->pclk)
|
|
|
|
clk_prepare_enable(mdp4_kms->pclk);
|
|
|
|
clk_prepare_enable(mdp4_kms->lut_clk);
|
2014-07-01 07:50:51 +09:00
|
|
|
if (mdp4_kms->axi_clk)
|
|
|
|
clk_prepare_enable(mdp4_kms->axi_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-27 01:44:06 +09:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-02 02:08:11 +09:00
|
|
|
#ifdef CONFIG_OF
|
|
|
|
static struct drm_panel *detect_panel(struct drm_device *dev, const char *name)
|
|
|
|
{
|
|
|
|
struct device_node *n;
|
|
|
|
struct drm_panel *panel = NULL;
|
|
|
|
|
|
|
|
n = of_parse_phandle(dev->dev->of_node, name, 0);
|
|
|
|
if (n) {
|
|
|
|
panel = of_drm_find_panel(n);
|
|
|
|
if (!panel)
|
|
|
|
panel = ERR_PTR(-EPROBE_DEFER);
|
|
|
|
}
|
|
|
|
|
|
|
|
return panel;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static struct drm_panel *detect_panel(struct drm_device *dev, const char *name)
|
|
|
|
{
|
|
|
|
// ??? maybe use a module param to specify which panel is attached?
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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-27 01:44:06 +09:00
|
|
|
static int modeset_init(struct mdp4_kms *mdp4_kms)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = mdp4_kms->dev;
|
|
|
|
struct msm_drm_private *priv = dev->dev_private;
|
|
|
|
struct drm_plane *plane;
|
|
|
|
struct drm_crtc *crtc;
|
|
|
|
struct drm_encoder *encoder;
|
2014-08-02 02:08:11 +09:00
|
|
|
struct drm_connector *connector;
|
|
|
|
struct drm_panel *panel;
|
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-27 01:44:06 +09:00
|
|
|
int ret;
|
|
|
|
|
2013-10-09 01:57:48 +09:00
|
|
|
/* construct non-private planes: */
|
|
|
|
plane = mdp4_plane_init(dev, VG1, false);
|
|
|
|
if (IS_ERR(plane)) {
|
|
|
|
dev_err(dev->dev, "failed to construct plane for VG1\n");
|
|
|
|
ret = PTR_ERR(plane);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
priv->planes[priv->num_planes++] = plane;
|
|
|
|
|
|
|
|
plane = mdp4_plane_init(dev, VG2, false);
|
|
|
|
if (IS_ERR(plane)) {
|
|
|
|
dev_err(dev->dev, "failed to construct plane for VG2\n");
|
|
|
|
ret = PTR_ERR(plane);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
priv->planes[priv->num_planes++] = plane;
|
|
|
|
|
2014-08-02 02:08:11 +09:00
|
|
|
/*
|
|
|
|
* Setup the LCDC/LVDS path: RGB2 -> DMA_P -> LCDC -> LVDS:
|
|
|
|
*/
|
|
|
|
|
|
|
|
panel = detect_panel(dev, "qcom,lvds-panel");
|
|
|
|
if (IS_ERR(panel)) {
|
|
|
|
ret = PTR_ERR(panel);
|
|
|
|
dev_err(dev->dev, "failed to detect LVDS panel: %d\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
plane = mdp4_plane_init(dev, RGB2, true);
|
|
|
|
if (IS_ERR(plane)) {
|
|
|
|
dev_err(dev->dev, "failed to construct plane for RGB2\n");
|
|
|
|
ret = PTR_ERR(plane);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
crtc = mdp4_crtc_init(dev, plane, priv->num_crtcs, 0, DMA_P);
|
|
|
|
if (IS_ERR(crtc)) {
|
|
|
|
dev_err(dev->dev, "failed to construct crtc for DMA_P\n");
|
|
|
|
ret = PTR_ERR(crtc);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
encoder = mdp4_lcdc_encoder_init(dev, panel);
|
|
|
|
if (IS_ERR(encoder)) {
|
|
|
|
dev_err(dev->dev, "failed to construct LCDC encoder\n");
|
|
|
|
ret = PTR_ERR(encoder);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* LCDC can be hooked to DMA_P: */
|
|
|
|
encoder->possible_crtcs = 1 << priv->num_crtcs;
|
|
|
|
|
|
|
|
priv->crtcs[priv->num_crtcs++] = crtc;
|
|
|
|
priv->encoders[priv->num_encoders++] = encoder;
|
|
|
|
|
|
|
|
connector = mdp4_lvds_connector_init(dev, panel, encoder);
|
|
|
|
if (IS_ERR(connector)) {
|
|
|
|
ret = PTR_ERR(connector);
|
|
|
|
dev_err(dev->dev, "failed to initialize LVDS connector: %d\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->connectors[priv->num_connectors++] = connector;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup DTV/HDMI path: RGB1 -> DMA_E -> DTV -> 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-27 01:44:06 +09:00
|
|
|
plane = mdp4_plane_init(dev, RGB1, true);
|
|
|
|
if (IS_ERR(plane)) {
|
|
|
|
dev_err(dev->dev, "failed to construct plane for RGB1\n");
|
|
|
|
ret = PTR_ERR(plane);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
crtc = mdp4_crtc_init(dev, plane, priv->num_crtcs, 1, DMA_E);
|
|
|
|
if (IS_ERR(crtc)) {
|
|
|
|
dev_err(dev->dev, "failed to construct crtc for DMA_E\n");
|
|
|
|
ret = PTR_ERR(crtc);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
encoder = mdp4_dtv_encoder_init(dev);
|
|
|
|
if (IS_ERR(encoder)) {
|
|
|
|
dev_err(dev->dev, "failed to construct DTV encoder\n");
|
|
|
|
ret = PTR_ERR(encoder);
|
|
|
|
goto fail;
|
|
|
|
}
|
2014-08-02 02:08:11 +09:00
|
|
|
|
|
|
|
/* DTV can be hooked to DMA_E: */
|
|
|
|
encoder->possible_crtcs = 1 << priv->num_crtcs;
|
|
|
|
|
|
|
|
priv->crtcs[priv->num_crtcs++] = crtc;
|
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-27 01:44:06 +09:00
|
|
|
priv->encoders[priv->num_encoders++] = encoder;
|
|
|
|
|
2014-11-05 03:33:14 +09:00
|
|
|
if (priv->hdmi) {
|
|
|
|
/* Construct bridge/connector for HDMI: */
|
|
|
|
ret = hdmi_modeset_init(priv->hdmi, dev, encoder);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev->dev, "failed to initialize HDMI: %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-27 01:44:06 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *iommu_ports[] = {
|
|
|
|
"mdp_port0_cb0", "mdp_port1_cb0",
|
|
|
|
};
|
|
|
|
|
|
|
|
struct msm_kms *mdp4_kms_init(struct drm_device *dev)
|
|
|
|
{
|
|
|
|
struct platform_device *pdev = dev->platformdev;
|
|
|
|
struct mdp4_platform_config *config = mdp4_get_config(pdev);
|
|
|
|
struct mdp4_kms *mdp4_kms;
|
|
|
|
struct msm_kms *kms = NULL;
|
2013-11-17 02:56:06 +09:00
|
|
|
struct msm_mmu *mmu;
|
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-27 01:44:06 +09:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
mdp4_kms = kzalloc(sizeof(*mdp4_kms), GFP_KERNEL);
|
|
|
|
if (!mdp4_kms) {
|
|
|
|
dev_err(dev->dev, "failed to allocate kms\n");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2013-12-01 07:24:22 +09:00
|
|
|
mdp_kms_init(&mdp4_kms->base, &kms_funcs);
|
|
|
|
|
|
|
|
kms = &mdp4_kms->base.base;
|
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-27 01:44:06 +09:00
|
|
|
|
|
|
|
mdp4_kms->dev = dev;
|
|
|
|
|
|
|
|
mdp4_kms->mmio = msm_ioremap(pdev, NULL, "MDP4");
|
|
|
|
if (IS_ERR(mdp4_kms->mmio)) {
|
|
|
|
ret = PTR_ERR(mdp4_kms->mmio);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2013-12-16 06:23:05 +09:00
|
|
|
mdp4_kms->dsi_pll_vdda =
|
|
|
|
devm_regulator_get_optional(&pdev->dev, "dsi_pll_vdda");
|
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-27 01:44:06 +09:00
|
|
|
if (IS_ERR(mdp4_kms->dsi_pll_vdda))
|
|
|
|
mdp4_kms->dsi_pll_vdda = NULL;
|
|
|
|
|
2013-12-16 06:23:05 +09:00
|
|
|
mdp4_kms->dsi_pll_vddio =
|
|
|
|
devm_regulator_get_optional(&pdev->dev, "dsi_pll_vddio");
|
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-27 01:44:06 +09:00
|
|
|
if (IS_ERR(mdp4_kms->dsi_pll_vddio))
|
|
|
|
mdp4_kms->dsi_pll_vddio = NULL;
|
|
|
|
|
2014-11-01 01:19:40 +09:00
|
|
|
/* NOTE: driver for this regulator still missing upstream.. use
|
|
|
|
* _get_exclusive() and ignore the error if it does not exist
|
|
|
|
* (and hope that the bootloader left it on for us)
|
|
|
|
*/
|
2013-12-16 06:23:05 +09:00
|
|
|
mdp4_kms->vdd = devm_regulator_get_exclusive(&pdev->dev, "vdd");
|
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-27 01:44:06 +09:00
|
|
|
if (IS_ERR(mdp4_kms->vdd))
|
|
|
|
mdp4_kms->vdd = NULL;
|
|
|
|
|
|
|
|
if (mdp4_kms->vdd) {
|
|
|
|
ret = regulator_enable(mdp4_kms->vdd);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev->dev, "failed to enable regulator vdd: %d\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mdp4_kms->clk = devm_clk_get(&pdev->dev, "core_clk");
|
|
|
|
if (IS_ERR(mdp4_kms->clk)) {
|
|
|
|
dev_err(dev->dev, "failed to get core_clk\n");
|
|
|
|
ret = PTR_ERR(mdp4_kms->clk);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
mdp4_kms->pclk = devm_clk_get(&pdev->dev, "iface_clk");
|
|
|
|
if (IS_ERR(mdp4_kms->pclk))
|
|
|
|
mdp4_kms->pclk = NULL;
|
|
|
|
|
|
|
|
// XXX if (rev >= MDP_REV_42) { ???
|
|
|
|
mdp4_kms->lut_clk = devm_clk_get(&pdev->dev, "lut_clk");
|
|
|
|
if (IS_ERR(mdp4_kms->lut_clk)) {
|
|
|
|
dev_err(dev->dev, "failed to get lut_clk\n");
|
|
|
|
ret = PTR_ERR(mdp4_kms->lut_clk);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2014-07-01 07:50:51 +09:00
|
|
|
mdp4_kms->axi_clk = devm_clk_get(&pdev->dev, "mdp_axi_clk");
|
|
|
|
if (IS_ERR(mdp4_kms->axi_clk)) {
|
|
|
|
dev_err(dev->dev, "failed to get axi_clk\n");
|
|
|
|
ret = PTR_ERR(mdp4_kms->axi_clk);
|
|
|
|
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-27 01:44:06 +09:00
|
|
|
clk_set_rate(mdp4_kms->clk, config->max_clk);
|
|
|
|
clk_set_rate(mdp4_kms->lut_clk, config->max_clk);
|
|
|
|
|
|
|
|
/* make sure things are off before attaching iommu (bootloader could
|
|
|
|
* have left things on, in which case we'll start getting faults if
|
|
|
|
* we don't disable):
|
|
|
|
*/
|
2013-11-17 03:07:31 +09:00
|
|
|
mdp4_enable(mdp4_kms);
|
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-27 01:44:06 +09:00
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_DTV_ENABLE, 0);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_LCDC_ENABLE, 0);
|
|
|
|
mdp4_write(mdp4_kms, REG_MDP4_DSI_ENABLE, 0);
|
2013-11-17 03:07:31 +09:00
|
|
|
mdp4_disable(mdp4_kms);
|
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-27 01:44:06 +09:00
|
|
|
mdelay(16);
|
|
|
|
|
2013-11-17 02:56:06 +09:00
|
|
|
if (config->iommu) {
|
2014-07-10 11:08:15 +09:00
|
|
|
mmu = msm_iommu_new(&pdev->dev, config->iommu);
|
2013-11-17 02:56:06 +09:00
|
|
|
if (IS_ERR(mmu)) {
|
|
|
|
ret = PTR_ERR(mmu);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
ret = mmu->funcs->attach(mmu, iommu_ports,
|
|
|
|
ARRAY_SIZE(iommu_ports));
|
|
|
|
if (ret)
|
|
|
|
goto fail;
|
|
|
|
} else {
|
|
|
|
dev_info(dev->dev, "no iommu, fallback to phys "
|
|
|
|
"contig buffers for scanout\n");
|
|
|
|
mmu = 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-27 01:44:06 +09:00
|
|
|
|
2013-11-17 02:56:06 +09:00
|
|
|
mdp4_kms->id = msm_register_mmu(dev, mmu);
|
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-27 01:44:06 +09:00
|
|
|
if (mdp4_kms->id < 0) {
|
|
|
|
ret = mdp4_kms->id;
|
|
|
|
dev_err(dev->dev, "failed to register mdp4 iommu: %d\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = modeset_init(mdp4_kms);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev->dev, "modeset_init failed: %d\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2014-04-23 01:27:28 +09:00
|
|
|
mutex_lock(&dev->struct_mutex);
|
|
|
|
mdp4_kms->blank_cursor_bo = msm_gem_new(dev, SZ_16K, MSM_BO_WC);
|
|
|
|
mutex_unlock(&dev->struct_mutex);
|
|
|
|
if (IS_ERR(mdp4_kms->blank_cursor_bo)) {
|
|
|
|
ret = PTR_ERR(mdp4_kms->blank_cursor_bo);
|
|
|
|
dev_err(dev->dev, "could not allocate blank-cursor bo: %d\n", ret);
|
|
|
|
mdp4_kms->blank_cursor_bo = NULL;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = msm_gem_get_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id,
|
|
|
|
&mdp4_kms->blank_cursor_iova);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev->dev, "could not pin blank-cursor bo: %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-27 01:44:06 +09:00
|
|
|
return kms;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (kms)
|
|
|
|
mdp4_destroy(kms);
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct mdp4_platform_config *mdp4_get_config(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
static struct mdp4_platform_config config = {};
|
|
|
|
#ifdef CONFIG_OF
|
|
|
|
/* TODO */
|
2013-12-16 06:23:05 +09:00
|
|
|
config.max_clk = 266667000;
|
|
|
|
config.iommu = iommu_domain_alloc(&platform_bus_type);
|
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-27 01:44:06 +09:00
|
|
|
#else
|
|
|
|
if (cpu_is_apq8064())
|
|
|
|
config.max_clk = 266667000;
|
|
|
|
else
|
|
|
|
config.max_clk = 200000000;
|
|
|
|
|
|
|
|
config.iommu = msm_get_iommu_domain(DISPLAY_READ_DOMAIN);
|
|
|
|
#endif
|
|
|
|
return &config;
|
|
|
|
}
|