Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arch/x86/configs/deepin_x86_desktop_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3224,6 +3224,7 @@ CONFIG_DRM_VMWGFX=m
CONFIG_DRM_GMA500=m
CONFIG_DRM_UDL=m
CONFIG_DRM_AST=m
CONFIG_DRM_MWV207=m
CONFIG_DRM_MGAG200=m
CONFIG_DRM_QXL=m
CONFIG_DRM_VIRTIO_GPU=m
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ source "drivers/gpu/drm/udl/Kconfig"

source "drivers/gpu/drm/ast/Kconfig"

source "drivers/gpu/drm/mwv207/Kconfig"

source "drivers/gpu/drm/mgag200/Kconfig"

source "drivers/gpu/drm/armada/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ obj-$(CONFIG_DRM_ROCKCHIP) +=rockchip/
obj-$(CONFIG_DRM_GMA500) += gma500/
obj-$(CONFIG_DRM_UDL) += udl/
obj-$(CONFIG_DRM_AST) += ast/
obj-$(CONFIG_DRM_MWV207) += mwv207/
obj-$(CONFIG_DRM_ARMADA) += armada/
obj-$(CONFIG_DRM_ATMEL_HLCDC) += atmel-hlcdc/
obj-y += renesas/
Expand Down
15 changes: 15 additions & 0 deletions drivers/gpu/drm/mwv207/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
config DRM_MWV207
tristate "MWV207 chip"
depends on DRM && SND_PCM
select DRM_KMS_HELPER
select DRM_VRAM_HELPER
select DRM_TTM
select DRM_SCHED
select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
select DRM_GEM_SHMEM_HELPER
select DRM_DEVFREQ
select DRM_TTM_HELPER
help
Choose this option if you have a Jingjia graphics card.
If M is selected, the module will be called mwv207 (JM9100).

33 changes: 33 additions & 0 deletions drivers/gpu/drm/mwv207/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
mwv207-y := mwv207_drv.o \
mwv207_irq.o \
mwv207_db.o \
mwv207_ctx.o \
mwv207_submit.o \
mwv207_sched.o \
mwv207_pipe_codec_common.o \
mwv207_devfreq.o \
mwv207_pipe_2d.o \
mwv207_pipe_3d.o \
mwv207_pipe_dec.o \
mwv207_pipe_enc.o \
mwv207_pipe_dma.o \
mwv207_gem.o \
mwv207_bo.o \
mwv207_ttm.o \
mwv207_vcmd.o \
mwv207_vbios.o \
dc/mwv207_kms.o \
dc/mwv207_va.o \
dc/mwv207_edp.o \
dc/mwv207_hdmi.o \
dc/mwv207_vga.o \
dc/mwv207_dvo.o \
dc/mwv207_vi.o \
dc/mwv207_i2c.o \
selftest/selftest.o

obj-$(CONFIG_DRM_MWV207) := mwv207.o

ccflags-y := -I$(src)


179 changes: 179 additions & 0 deletions drivers/gpu/drm/mwv207/dc/mwv207_dvo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2020 ChangSha JingJiaMicro Electronics Co., Ltd.
* All rights reserved.
*
* Author:
* shanjinkui <shanjinkui@jingjiamicro.com>
*
* The software and information contained herein is proprietary and
* confidential to JingJiaMicro Electronics. This software can only be
* used by JingJiaMicro Electronics Corporation. Any use, reproduction,
* or disclosure without the written permission of JingJiaMicro
* Electronics Corporation is strictly prohibited.
*/
#include "mwv207_vi.h"

static void mwv207_dvo_switch(struct mwv207_output *output, bool on)
{
mwv207_output_modify(output, 0x200,
0x1 << 0, (on ? 1 : 0) << 0);
}

static void mwv207_dvo_config(struct mwv207_output *output)
{
struct drm_display_mode *mode = &output->cur_crtc->state->adjusted_mode;
int hpol, vpol;

hpol = (mode->flags & DRM_MODE_FLAG_PHSYNC) ? 0 : 1;
vpol = (mode->flags & DRM_MODE_FLAG_PVSYNC) ? 0 : 1;

mwv207_output_modify(output, 0x200, 0x1 << 9, hpol << 9);
mwv207_output_modify(output, 0x200, 0x1 << 8, vpol << 8);

}

static void mwv207_dvo_select_crtc(struct mwv207_output *output)
{

mwv207_output_modify(output, 0x200, 0x7 << 16,
drm_crtc_index(output->cur_crtc) << 16);

jdev_modify(output->jdev, 0x9b003c, 0xf,
drm_crtc_index(output->cur_crtc));
}
static enum drm_mode_status mwv207_dvo_mode_valid(struct mwv207_output *output,
const struct drm_display_mode *mode)
{

if (mode->clock > 162000)
return MODE_CLOCK_HIGH;

return MODE_OK;
}

static enum drm_mode_status mwv207_dvo_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
return mwv207_dvo_mode_valid(connector_to_output(connector), mode);
}

static int mwv207_dvo_detect_ctx(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx,
bool force)
{
struct mwv207_output *output = connector_to_output(connector);

if (mwv207_i2c_probe(output->ddc))
return connector_status_connected;
else
return connector_status_disconnected;
}

static void mwv207_dvo_destroy(struct drm_connector *conn)
{
drm_connector_unregister(conn);
drm_connector_cleanup(conn);
}

static const struct drm_connector_helper_funcs mwv207_dvo_connector_helper_funcs = {
.get_modes = mwv207_output_get_modes,
.mode_valid = mwv207_dvo_connector_mode_valid,
.detect_ctx = mwv207_dvo_detect_ctx
};

static const struct drm_connector_funcs mwv207_dvo_connector_funcs = {
.reset = drm_atomic_helper_connector_reset,
.fill_modes = drm_helper_probe_single_connector_modes,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
.destroy = mwv207_dvo_destroy,
.late_register = mwv207_output_late_register,
.early_unregister = mwv207_output_early_unregister,
};

static enum drm_mode_status mwv207_dvo_encoder_mode_valid(struct drm_encoder *encoder,
const struct drm_display_mode *mode)
{
struct mwv207_output *output = encoder_to_output(encoder);

return mwv207_dvo_mode_valid(output, mode);
}

static int mwv207_dvo_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{
return 0;
}

static void mwv207_dvo_encoder_enable(struct drm_encoder *encoder)
{
struct mwv207_output *output = encoder_to_output(encoder);

mwv207_dvo_select_crtc(output);

mwv207_dvo_config(output);

mwv207_dvo_switch(output, true);
}

static void mwv207_dvo_encoder_disable(struct drm_encoder *encoder)
{
struct mwv207_output *output = encoder_to_output(encoder);

mwv207_dvo_switch(output, false);
}

static void mwv207_dvo_encoder_reset(struct drm_encoder *encoder)
{
mwv207_dvo_encoder_disable(encoder);
}

static const struct drm_encoder_funcs mwv207_dvo_encoder_funcs = {
.destroy = drm_encoder_cleanup,
.reset = mwv207_dvo_encoder_reset,
};

static const struct drm_encoder_helper_funcs mwv207_dvo_encoder_helper_funcs = {
.mode_valid = mwv207_dvo_encoder_mode_valid,
.atomic_check = mwv207_dvo_encoder_atomic_check,
.enable = mwv207_dvo_encoder_enable,
.disable = mwv207_dvo_encoder_disable,
};

int mwv207_dvo_init(struct mwv207_device *jdev)
{
struct mwv207_output *output;
int ret;

output = devm_kzalloc(jdev->dev, sizeof(*output), GFP_KERNEL);
if (!output)
return -ENOMEM;

output->jdev = jdev;
output->idx = 0;
output->mmio = jdev->mmio + 0x9a0000;
output->i2c_chan = 5;

output->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
ret = drm_connector_init(&jdev->base, &output->connector,
&mwv207_dvo_connector_funcs, DRM_MODE_CONNECTOR_DVII);
if (ret)
return ret;
drm_connector_helper_add(&output->connector, &mwv207_dvo_connector_helper_funcs);

output->encoder.possible_crtcs = (1 << jdev->base.mode_config.num_crtc) - 1;
ret = drm_encoder_init(&jdev->base, &output->encoder,
&mwv207_dvo_encoder_funcs, DRM_MODE_ENCODER_DAC,
"dvo-%d", output->idx);
if (ret)
return ret;
drm_encoder_helper_add(&output->encoder, &mwv207_dvo_encoder_helper_funcs);

ret = drm_connector_attach_encoder(&output->connector, &output->encoder);
if (ret)
return ret;

return drm_connector_register(&output->connector);
}
21 changes: 21 additions & 0 deletions drivers/gpu/drm/mwv207/dc/mwv207_edp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2020 ChangSha JingJiaMicro Electronics Co., Ltd.
* All rights reserved.
*
* Author:
* shanjinkui <shanjinkui@jingjiamicro.com>
*
* The software and information contained herein is proprietary and
* confidential to JingJiaMicro Electronics. This software can only be
* used by JingJiaMicro Electronics Corporation. Any use, reproduction,
* or disclosure without the written permission of JingJiaMicro
* Electronics Corporation is strictly prohibited.
*/
#include "mwv207_vi.h"

int mwv207_edp_init(struct mwv207_device *jdev)
{
pr_info("%s TBD", __func__);
return 0;
}
Loading