From patchwork Wed Jun 17 08:03:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11609373 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E8AC813B1 for ; Wed, 17 Jun 2020 08:03:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D211821475 for ; Wed, 17 Jun 2020 08:03:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D211821475 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CF516E373; Wed, 17 Jun 2020 08:03:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA7556E373 for ; Wed, 17 Jun 2020 08:03:43 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 57301AD19; Wed, 17 Jun 2020 08:03:46 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, emil.velikov@collabora.com, kraxel@redhat.com, noralf@tronnes.org, yc_chen@aspeedtech.com Subject: [PATCH v2 1/4] drm/ast: Remove unused code paths for AST 1180 Date: Wed, 17 Jun 2020 10:03:37 +0200 Message-Id: <20200617080340.29584-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200617080340.29584-1-tzimmermann@suse.de> References: <20200617080340.29584-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Emil Velikov , Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The ast driver contains code paths for AST 1180 chips. The chip is not supported and the rsp code has never been tested. Simplify the driver by removing the AST 1180 code. Signed-off-by: Thomas Zimmermann Reviewed-by: Daniel Vetter Reviewed-by: Emil Velikov --- drivers/gpu/drm/ast/ast_drv.c | 1 - drivers/gpu/drm/ast/ast_drv.h | 2 - drivers/gpu/drm/ast/ast_main.c | 89 +++++++++++++++------------------- drivers/gpu/drm/ast/ast_mode.c | 10 +--- drivers/gpu/drm/ast/ast_post.c | 10 ++-- 5 files changed, 43 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index 48a9cc4e080a..f7a14e4e1df0 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -59,7 +59,6 @@ static struct drm_driver driver; static const struct pci_device_id pciidlist[] = { AST_VGA_DEVICE(PCI_CHIP_AST2000, NULL), AST_VGA_DEVICE(PCI_CHIP_AST2100, NULL), - /* AST_VGA_DEVICE(PCI_CHIP_AST1180, NULL), - don't bind to 1180 for now */ {0, 0, 0}, }; diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h index 656d591b154b..09f2659e2911 100644 --- a/drivers/gpu/drm/ast/ast_drv.h +++ b/drivers/gpu/drm/ast/ast_drv.h @@ -52,7 +52,6 @@ #define PCI_CHIP_AST2000 0x2000 #define PCI_CHIP_AST2100 0x2010 -#define PCI_CHIP_AST1180 0x1180 enum ast_chip { @@ -64,7 +63,6 @@ enum ast_chip { AST2300, AST2400, AST2500, - AST1180, }; enum ast_tx_chip { diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index 1b35728ad871..3e64e7c8d325 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -142,50 +142,42 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) ast_detect_config_mode(dev, &scu_rev); /* Identify chipset */ - if (dev->pdev->device == PCI_CHIP_AST1180) { - ast->chip = AST1100; - DRM_INFO("AST 1180 detected\n"); - } else { - if (dev->pdev->revision >= 0x40) { - ast->chip = AST2500; - DRM_INFO("AST 2500 detected\n"); - } else if (dev->pdev->revision >= 0x30) { - ast->chip = AST2400; - DRM_INFO("AST 2400 detected\n"); - } else if (dev->pdev->revision >= 0x20) { - ast->chip = AST2300; - DRM_INFO("AST 2300 detected\n"); - } else if (dev->pdev->revision >= 0x10) { - switch (scu_rev & 0x0300) { - case 0x0200: - ast->chip = AST1100; - DRM_INFO("AST 1100 detected\n"); - break; - case 0x0100: - ast->chip = AST2200; - DRM_INFO("AST 2200 detected\n"); - break; - case 0x0000: - ast->chip = AST2150; - DRM_INFO("AST 2150 detected\n"); - break; - default: - ast->chip = AST2100; - DRM_INFO("AST 2100 detected\n"); - break; - } - ast->vga2_clone = false; - } else { - ast->chip = AST2000; - DRM_INFO("AST 2000 detected\n"); + if (dev->pdev->revision >= 0x40) { + ast->chip = AST2500; + DRM_INFO("AST 2500 detected\n"); + } else if (dev->pdev->revision >= 0x30) { + ast->chip = AST2400; + DRM_INFO("AST 2400 detected\n"); + } else if (dev->pdev->revision >= 0x20) { + ast->chip = AST2300; + DRM_INFO("AST 2300 detected\n"); + } else if (dev->pdev->revision >= 0x10) { + switch (scu_rev & 0x0300) { + case 0x0200: + ast->chip = AST1100; + DRM_INFO("AST 1100 detected\n"); + break; + case 0x0100: + ast->chip = AST2200; + DRM_INFO("AST 2200 detected\n"); + break; + case 0x0000: + ast->chip = AST2150; + DRM_INFO("AST 2150 detected\n"); + break; + default: + ast->chip = AST2100; + DRM_INFO("AST 2100 detected\n"); + break; } + ast->vga2_clone = false; + } else { + ast->chip = AST2000; + DRM_INFO("AST 2000 detected\n"); } /* Check if we support wide screen */ switch (ast->chip) { - case AST1180: - ast->support_wide_screen = true; - break; case AST2000: ast->support_wide_screen = false; break; @@ -469,15 +461,13 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) if (need_post) ast_post_gpu(dev); - if (ast->chip != AST1180) { - ret = ast_get_dram_info(dev); - if (ret) - goto out_free; - ast->vram_size = ast_get_vram_info(dev); - DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", - ast->mclk, ast->dram_type, - ast->dram_bus_width, ast->vram_size); - } + ret = ast_get_dram_info(dev); + if (ret) + goto out_free; + ast->vram_size = ast_get_vram_info(dev); + DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", + ast->mclk, ast->dram_type, + ast->dram_bus_width, ast->vram_size); ret = ast_mm_init(ast); if (ret) @@ -496,8 +486,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) ast->chip == AST2200 || ast->chip == AST2300 || ast->chip == AST2400 || - ast->chip == AST2500 || - ast->chip == AST1180) { + ast->chip == AST2500) { dev->mode_config.max_width = 1920; dev->mode_config.max_height = 2048; } else { diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 3a3a511670c9..9bef90c8423f 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -769,9 +769,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) { struct ast_private *ast = crtc->dev->dev_private; - if (ast->chip == AST1180) - return; - /* TODO: Maybe control display signal generation with * Sync Enable (bit CR17.7). */ @@ -798,11 +795,6 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, const struct drm_format_info *format; bool succ; - if (ast->chip == AST1180) { - DRM_ERROR("AST 1180 modesetting not supported\n"); - return -EINVAL; - } - if (!state->enable) return 0; /* no mode checks if CRTC is being disabled */ @@ -1044,7 +1036,7 @@ static enum drm_mode_status ast_mode_valid(struct drm_connector *connector, if ((ast->chip == AST2100) || (ast->chip == AST2200) || (ast->chip == AST2300) || (ast->chip == AST2400) || - (ast->chip == AST2500) || (ast->chip == AST1180)) { + (ast->chip == AST2500)) { if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080)) return MODE_OK; diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c index 2d1b18619743..af0c8ebb009a 100644 --- a/drivers/gpu/drm/ast/ast_post.c +++ b/drivers/gpu/drm/ast/ast_post.c @@ -58,13 +58,9 @@ bool ast_is_vga_enabled(struct drm_device *dev) struct ast_private *ast = dev->dev_private; u8 ch; - if (ast->chip == AST1180) { - /* TODO 1180 */ - } else { - ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); - return !!(ch & 0x01); - } - return false; + ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); + + return !!(ch & 0x01); } static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff }; From patchwork Wed Jun 17 08:03:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11609379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE5AC92A for ; Wed, 17 Jun 2020 08:03:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D73EF21475 for ; Wed, 17 Jun 2020 08:03:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D73EF21475 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AFFB6EAB1; Wed, 17 Jun 2020 08:03:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF8856E51D for ; Wed, 17 Jun 2020 08:03:43 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6E5C5AF23; Wed, 17 Jun 2020 08:03:46 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, emil.velikov@collabora.com, kraxel@redhat.com, noralf@tronnes.org, yc_chen@aspeedtech.com Subject: [PATCH v2 2/4] drm/ast: Remove test for device from ast_pm_freeze() Date: Wed, 17 Jun 2020 10:03:38 +0200 Message-Id: <20200617080340.29584-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200617080340.29584-1-tzimmermann@suse.de> References: <20200617080340.29584-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The driver cannot suspend before it has loaded completely. So the test for device pointers is not required. Remove them. Signed-off-by: Thomas Zimmermann Acked-by: Sam Ravnborg --- drivers/gpu/drm/ast/ast_drv.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index f7a14e4e1df0..0b58f7aee6b0 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -188,9 +188,6 @@ static int ast_pm_freeze(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); struct drm_device *ddev = pci_get_drvdata(pdev); - - if (!ddev || !ddev->dev_private) - return -ENODEV; return ast_drm_freeze(ddev); } From patchwork Wed Jun 17 08:03:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11609375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DC7613B1 for ; Wed, 17 Jun 2020 08:03:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16CF721475 for ; Wed, 17 Jun 2020 08:03:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16CF721475 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A21366E51D; Wed, 17 Jun 2020 08:03:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C8656E329 for ; Wed, 17 Jun 2020 08:03:44 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9F9F0AF62; Wed, 17 Jun 2020 08:03:46 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, emil.velikov@collabora.com, kraxel@redhat.com, noralf@tronnes.org, yc_chen@aspeedtech.com Subject: [PATCH v2 3/4] drm/ast: Upcast from DRM device to ast structure via to_ast_private() Date: Wed, 17 Jun 2020 10:03:39 +0200 Message-Id: <20200617080340.29584-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200617080340.29584-1-tzimmermann@suse.de> References: <20200617080340.29584-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Emil Velikov , Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" All upcasting from struct drm_device to struct ast_private is now performed via to_ast_private(). Using struct drm_device.dev_private is deprecated. The ast variable in ast_crtc_helper_atomic_check() is unused, so removed it. v2: * fix typo in commit message Signed-off-by: Thomas Zimmermann Reviewed-by: Daniel Vetter Reviewed-by: Emil Velikov Acked-by: Sam Ravnborg --- drivers/gpu/drm/ast/ast_dp501.c | 24 +++++++++---------- drivers/gpu/drm/ast/ast_drv.h | 5 ++++ drivers/gpu/drm/ast/ast_main.c | 10 ++++---- drivers/gpu/drm/ast/ast_mode.c | 41 ++++++++++++++++----------------- drivers/gpu/drm/ast/ast_post.c | 16 ++++++------- 5 files changed, 50 insertions(+), 46 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c index 98cd69269263..4b85a504825a 100644 --- a/drivers/gpu/drm/ast/ast_dp501.c +++ b/drivers/gpu/drm/ast/ast_dp501.c @@ -10,7 +10,7 @@ MODULE_FIRMWARE("ast_dp501_fw.bin"); static int ast_load_dp501_microcode(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); return request_firmware(&ast->dp501_fw, "ast_dp501_fw.bin", dev->dev); } @@ -93,7 +93,7 @@ static bool wait_fw_ready(struct ast_private *ast) static bool ast_write_cmd(struct drm_device *dev, u8 data) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); int retry = 0; if (wait_nack(ast)) { send_nack(ast); @@ -115,7 +115,7 @@ static bool ast_write_cmd(struct drm_device *dev, u8 data) static bool ast_write_data(struct drm_device *dev, u8 data) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); if (wait_nack(ast)) { send_nack(ast); @@ -133,7 +133,7 @@ static bool ast_write_data(struct drm_device *dev, u8 data) #if 0 static bool ast_read_data(struct drm_device *dev, u8 *data) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u8 tmp; *data = 0; @@ -172,7 +172,7 @@ static u32 get_fw_base(struct ast_private *ast) bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u32 i, data; u32 boot_address; @@ -188,7 +188,7 @@ bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size) static bool ast_launch_m68k(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u32 i, data, len = 0; u32 boot_address; u8 *fw_addr = NULL; @@ -255,7 +255,7 @@ static bool ast_launch_m68k(struct drm_device *dev) u8 ast_get_dp501_max_clk(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u32 boot_address, offset, data; u8 linkcap[4], linkrate, linklanes, maxclk = 0xff; @@ -283,7 +283,7 @@ u8 ast_get_dp501_max_clk(struct drm_device *dev) bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u32 i, boot_address, offset, data; boot_address = get_fw_base(ast); @@ -312,7 +312,7 @@ bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata) static bool ast_init_dvo(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u8 jreg; u32 data; ast_write32(ast, 0xf004, 0x1e6e0000); @@ -385,7 +385,7 @@ static bool ast_init_dvo(struct drm_device *dev) static void ast_init_analog(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u32 data; /* @@ -412,7 +412,7 @@ static void ast_init_analog(struct drm_device *dev) void ast_init_3rdtx(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u8 jreg; if (ast->chip == AST2300 || ast->chip == AST2400) { @@ -438,7 +438,7 @@ void ast_init_3rdtx(struct drm_device *dev) void ast_release_firmware(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); release_firmware(ast->dp501_fw); ast->dp501_fw = NULL; diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h index 09f2659e2911..c44c1376c697 100644 --- a/drivers/gpu/drm/ast/ast_drv.h +++ b/drivers/gpu/drm/ast/ast_drv.h @@ -136,6 +136,11 @@ struct ast_private { const struct firmware *dp501_fw; /* dp501 fw */ }; +static inline struct ast_private *to_ast_private(struct drm_device *dev) +{ + return dev->dev_private; +} + int ast_driver_load(struct drm_device *dev, unsigned long flags); void ast_driver_unload(struct drm_device *dev); diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index 3e64e7c8d325..3edfc6c92b9a 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -67,7 +67,7 @@ uint8_t ast_get_index_reg_mask(struct ast_private *ast, static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) { struct device_node *np = dev->pdev->dev.of_node; - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); uint32_t data, jregd0, jregd1; /* Defaults */ @@ -117,7 +117,7 @@ static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) static int ast_detect_chip(struct drm_device *dev, bool *need_post) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); uint32_t jreg, scu_rev; /* @@ -262,7 +262,7 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) static int ast_get_dram_info(struct drm_device *dev) { struct device_node *np = dev->pdev->dev.of_node; - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); uint32_t mcr_cfg, mcr_scu_mpll, mcr_scu_strap; uint32_t denum, num, div, ref_pll, dsel; @@ -388,7 +388,7 @@ static const struct drm_mode_config_funcs ast_mode_funcs = { static u32 ast_get_vram_info(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u8 jreg; u32 vram_size; ast_open_key(ast); @@ -509,7 +509,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) void ast_driver_unload(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); /* enable standard VGA decode */ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04); diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 9bef90c8423f..650fe7efb638 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -566,7 +566,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct ast_private *ast = plane->dev->dev_private; + struct ast_private *ast = to_ast_private(plane->dev); struct drm_plane_state *state = plane->state; struct drm_gem_vram_object *gbo; s64 gpu_addr; @@ -586,7 +586,7 @@ static void ast_primary_plane_helper_atomic_disable(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct ast_private *ast = plane->dev->dev_private; + struct ast_private *ast = to_ast_private(plane->dev); ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x20); } @@ -634,7 +634,7 @@ ast_cursor_plane_helper_prepare_fb(struct drm_plane *plane, WARN_ON_ONCE(fb->height > AST_MAX_HWC_HEIGHT)) return -EINVAL; /* BUG: didn't test in atomic_check() */ - ast = crtc->dev->dev_private; + ast = to_ast_private(crtc->dev); gbo = drm_gem_vram_of_gem(fb->obj[0]); src = drm_gem_vram_vmap(gbo); @@ -706,7 +706,7 @@ ast_cursor_plane_helper_atomic_update(struct drm_plane *plane, struct drm_plane_state *state = plane->state; struct drm_crtc *crtc = state->crtc; struct drm_framebuffer *fb = state->fb; - struct ast_private *ast = plane->dev->dev_private; + struct ast_private *ast = to_ast_private(plane->dev); struct ast_crtc *ast_crtc = to_ast_crtc(crtc); struct drm_gem_vram_object *gbo; s64 off; @@ -739,7 +739,7 @@ static void ast_cursor_plane_helper_atomic_disable(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct ast_private *ast = plane->dev->dev_private; + struct ast_private *ast = to_ast_private(plane->dev); ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, 0x00); } @@ -767,7 +767,7 @@ static const struct drm_plane_funcs ast_cursor_plane_funcs = { static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) { - struct ast_private *ast = crtc->dev->dev_private; + struct ast_private *ast = to_ast_private(crtc->dev); /* TODO: Maybe control display signal generation with * Sync Enable (bit CR17.7). @@ -790,7 +790,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { - struct ast_private *ast = crtc->dev->dev_private; struct ast_crtc_state *ast_state; const struct drm_format_info *format; bool succ; @@ -816,7 +815,7 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, static void ast_crtc_helper_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state) { - struct ast_private *ast = crtc->dev->dev_private; + struct ast_private *ast = to_ast_private(crtc->dev); ast_open_key(ast); } @@ -825,7 +824,7 @@ static void ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state) { struct drm_device *dev = crtc->dev; - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); struct ast_crtc_state *ast_state; const struct drm_format_info *format; struct ast_vbios_mode_info *vbios_mode_info; @@ -938,7 +937,7 @@ static const struct drm_crtc_funcs ast_crtc_funcs = { static int ast_crtc_init(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); struct ast_crtc *crtc; int ret; @@ -967,7 +966,7 @@ static int ast_crtc_init(struct drm_device *dev) static int ast_encoder_init(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); struct drm_encoder *encoder = &ast->encoder; int ret; @@ -987,7 +986,7 @@ static int ast_encoder_init(struct drm_device *dev) static int ast_get_modes(struct drm_connector *connector) { struct ast_connector *ast_connector = to_ast_connector(connector); - struct ast_private *ast = connector->dev->dev_private; + struct ast_private *ast = to_ast_private(connector->dev); struct edid *edid; int ret; bool flags = false; @@ -1018,7 +1017,7 @@ static int ast_get_modes(struct drm_connector *connector) static enum drm_mode_status ast_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { - struct ast_private *ast = connector->dev->dev_private; + struct ast_private *ast = to_ast_private(connector->dev); int flags = MODE_NOMODE; uint32_t jtemp; @@ -1129,7 +1128,7 @@ static int ast_connector_init(struct drm_device *dev) /* allocate cursor cache and pin at start of VRAM */ static int ast_cursor_init(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); size_t size, i; struct drm_gem_vram_object *gbo; int ret; @@ -1167,7 +1166,7 @@ static int ast_cursor_init(struct drm_device *dev) static void ast_cursor_fini(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); size_t i; struct drm_gem_vram_object *gbo; @@ -1180,7 +1179,7 @@ static void ast_cursor_fini(struct drm_device *dev) int ast_mode_init(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); int ret; memset(&ast->primary_plane, 0, sizeof(ast->primary_plane)); @@ -1224,7 +1223,7 @@ void ast_mode_fini(struct drm_device *dev) static int get_clock(void *i2c_priv) { struct ast_i2c_chan *i2c = i2c_priv; - struct ast_private *ast = i2c->dev->dev_private; + struct ast_private *ast = to_ast_private(i2c->dev); uint32_t val, val2, count, pass; count = 0; @@ -1246,7 +1245,7 @@ static int get_clock(void *i2c_priv) static int get_data(void *i2c_priv) { struct ast_i2c_chan *i2c = i2c_priv; - struct ast_private *ast = i2c->dev->dev_private; + struct ast_private *ast = to_ast_private(i2c->dev); uint32_t val, val2, count, pass; count = 0; @@ -1268,7 +1267,7 @@ static int get_data(void *i2c_priv) static void set_clock(void *i2c_priv, int clock) { struct ast_i2c_chan *i2c = i2c_priv; - struct ast_private *ast = i2c->dev->dev_private; + struct ast_private *ast = to_ast_private(i2c->dev); int i; u8 ujcrb7, jtemp; @@ -1284,7 +1283,7 @@ static void set_clock(void *i2c_priv, int clock) static void set_data(void *i2c_priv, int data) { struct ast_i2c_chan *i2c = i2c_priv; - struct ast_private *ast = i2c->dev->dev_private; + struct ast_private *ast = to_ast_private(i2c->dev); int i; u8 ujcrb7, jtemp; @@ -1432,7 +1431,7 @@ static int ast_cursor_move(struct drm_crtc *crtc, int x, int y) { struct ast_crtc *ast_crtc = to_ast_crtc(crtc); - struct ast_private *ast = crtc->dev->dev_private; + struct ast_private *ast = to_ast_private(crtc->dev); struct drm_gem_vram_object *gbo; int x_offset, y_offset; u8 *dst, *sig; diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c index af0c8ebb009a..226e1290227a 100644 --- a/drivers/gpu/drm/ast/ast_post.c +++ b/drivers/gpu/drm/ast/ast_post.c @@ -39,7 +39,7 @@ static void ast_post_chip_2500(struct drm_device *dev); void ast_enable_vga(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); ast_io_write8(ast, AST_IO_VGA_ENABLE_PORT, 0x01); ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, 0x01); @@ -47,7 +47,7 @@ void ast_enable_vga(struct drm_device *dev) void ast_enable_mmio(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); } @@ -55,7 +55,7 @@ void ast_enable_mmio(struct drm_device *dev) bool ast_is_vga_enabled(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u8 ch; ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); @@ -70,7 +70,7 @@ static const u8 extreginfo_ast2300[] = { 0x0f, 0x04, 0x1f, 0xff }; static void ast_set_def_ext_reg(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u8 i, index, reg; const u8 *ext_reg_info; @@ -272,7 +272,7 @@ static void cbrdlli_ast2150(struct ast_private *ast, int busw) static void ast_init_dram_reg(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u8 j; u32 data, temp, i; const struct ast_dramstruct *dram_reg_info; @@ -366,7 +366,7 @@ static void ast_init_dram_reg(struct drm_device *dev) void ast_post_gpu(struct drm_device *dev) { u32 reg; - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); pci_read_config_dword(ast->dev->pdev, 0x04, ®); reg |= 0x3; @@ -1596,7 +1596,7 @@ static void ddr2_init(struct ast_private *ast, struct ast2300_dram_param *param) static void ast_post_chip_2300(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); struct ast2300_dram_param param; u32 temp; u8 reg; @@ -2028,7 +2028,7 @@ static bool ast_dram_init_2500(struct ast_private *ast) void ast_post_chip_2500(struct drm_device *dev) { - struct ast_private *ast = dev->dev_private; + struct ast_private *ast = to_ast_private(dev); u32 temp; u8 reg; From patchwork Wed Jun 17 08:03:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11609377 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2661E92A for ; Wed, 17 Jun 2020 08:03:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F59E21475 for ; Wed, 17 Jun 2020 08:03:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F59E21475 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7BCF6EAAC; Wed, 17 Jun 2020 08:03:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B97B6E373 for ; Wed, 17 Jun 2020 08:03:44 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CE61CB123; Wed, 17 Jun 2020 08:03:46 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, emil.velikov@collabora.com, kraxel@redhat.com, noralf@tronnes.org, yc_chen@aspeedtech.com Subject: [PATCH v2 4/4] drm/ast: Use per-device logging macros Date: Wed, 17 Jun 2020 10:03:40 +0200 Message-Id: <20200617080340.29584-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200617080340.29584-1-tzimmermann@suse.de> References: <20200617080340.29584-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Emil Velikov , Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Converts the ast driver to drm_info(), drm_err() and drm_WARN_*(). No functional changes are made. v2: * also convert WARN_*() macros Signed-off-by: Thomas Zimmermann Reviewed-by: Daniel Vetter Reviewed-by: Emil Velikov --- drivers/gpu/drm/ast/ast_main.c | 34 +++++++++++++++++----------------- drivers/gpu/drm/ast/ast_mode.c | 26 +++++++++++++++----------- drivers/gpu/drm/ast/ast_post.c | 2 +- drivers/gpu/drm/ast/ast_ttm.c | 2 +- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index 3edfc6c92b9a..2eab19a9056f 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -79,7 +79,7 @@ static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) scu_rev)) { /* We do, disable P2A access */ ast->config_mode = ast_use_dt; - DRM_INFO("Using device-tree for configuration\n"); + drm_info(dev, "Using device-tree for configuration\n"); return; } @@ -101,7 +101,7 @@ static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) /* P2A works, grab silicon revision */ ast->config_mode = ast_use_p2a; - DRM_INFO("Using P2A bridge for configuration\n"); + drm_info(dev, "Using P2A bridge for configuration\n"); /* Read SCU7c (silicon revision register) */ ast_write32(ast, 0xf004, 0x1e6e0000); @@ -112,7 +112,7 @@ static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) } /* We have a P2A bridge but it's disabled */ - DRM_INFO("P2A bridge disabled, using default configuration\n"); + drm_info(dev, "P2A bridge disabled, using default configuration\n"); } static int ast_detect_chip(struct drm_device *dev, bool *need_post) @@ -128,7 +128,7 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) */ if (!ast_is_vga_enabled(dev)) { ast_enable_vga(dev); - DRM_INFO("VGA not enabled on entry, requesting chip POST\n"); + drm_info(dev, "VGA not enabled on entry, requesting chip POST\n"); *need_post = true; } else *need_post = false; @@ -144,36 +144,36 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) /* Identify chipset */ if (dev->pdev->revision >= 0x40) { ast->chip = AST2500; - DRM_INFO("AST 2500 detected\n"); + drm_info(dev, "AST 2500 detected\n"); } else if (dev->pdev->revision >= 0x30) { ast->chip = AST2400; - DRM_INFO("AST 2400 detected\n"); + drm_info(dev, "AST 2400 detected\n"); } else if (dev->pdev->revision >= 0x20) { ast->chip = AST2300; - DRM_INFO("AST 2300 detected\n"); + drm_info(dev, "AST 2300 detected\n"); } else if (dev->pdev->revision >= 0x10) { switch (scu_rev & 0x0300) { case 0x0200: ast->chip = AST1100; - DRM_INFO("AST 1100 detected\n"); + drm_info(dev, "AST 1100 detected\n"); break; case 0x0100: ast->chip = AST2200; - DRM_INFO("AST 2200 detected\n"); + drm_info(dev, "AST 2200 detected\n"); break; case 0x0000: ast->chip = AST2150; - DRM_INFO("AST 2150 detected\n"); + drm_info(dev, "AST 2150 detected\n"); break; default: ast->chip = AST2100; - DRM_INFO("AST 2100 detected\n"); + drm_info(dev, "AST 2100 detected\n"); break; } ast->vga2_clone = false; } else { ast->chip = AST2000; - DRM_INFO("AST 2000 detected\n"); + drm_info(dev, "AST 2000 detected\n"); } /* Check if we support wide screen */ @@ -248,13 +248,13 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) /* Print stuff for diagnostic purposes */ switch(ast->tx_chip_type) { case AST_TX_SIL164: - DRM_INFO("Using Sil164 TMDS transmitter\n"); + drm_info(dev, "Using Sil164 TMDS transmitter\n"); break; case AST_TX_DP501: - DRM_INFO("Using DP501 DisplayPort transmitter\n"); + drm_info(dev, "Using DP501 DisplayPort transmitter\n"); break; default: - DRM_INFO("Analog VGA only\n"); + drm_info(dev, "Analog VGA only\n"); } return 0; } @@ -443,7 +443,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) * and higher). */ if (!(pci_resource_flags(dev->pdev, 2) & IORESOURCE_IO)) { - DRM_INFO("platform has no IO space, trying MMIO\n"); + drm_info(dev, "platform has no IO space, trying MMIO\n"); ast->ioregs = ast->regs + AST_IO_MM_OFFSET; } @@ -465,7 +465,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) if (ret) goto out_free; ast->vram_size = ast_get_vram_info(dev); - DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", + drm_info(dev, "dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size); diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 650fe7efb638..510ffb497344 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -566,14 +566,15 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct ast_private *ast = to_ast_private(plane->dev); + struct drm_device *dev = plane->dev; + struct ast_private *ast = to_ast_private(dev); struct drm_plane_state *state = plane->state; struct drm_gem_vram_object *gbo; s64 gpu_addr; gbo = drm_gem_vram_of_gem(state->fb->obj[0]); gpu_addr = drm_gem_vram_offset(gbo); - if (WARN_ON_ONCE(gpu_addr < 0)) + if (drm_WARN_ON_ONCE(dev, gpu_addr < 0)) return; /* Bug: we didn't pin the BO to VRAM in prepare_fb. */ ast_set_offset_reg(ast, state->fb); @@ -620,6 +621,7 @@ static int ast_cursor_plane_helper_prepare_fb(struct drm_plane *plane, struct drm_plane_state *new_state) { + struct drm_device *dev = plane->dev; struct drm_framebuffer *fb = new_state->fb; struct drm_crtc *crtc = new_state->crtc; struct drm_gem_vram_object *gbo; @@ -630,11 +632,11 @@ ast_cursor_plane_helper_prepare_fb(struct drm_plane *plane, if (!crtc || !fb) return 0; - if (WARN_ON_ONCE(fb->width > AST_MAX_HWC_WIDTH) || - WARN_ON_ONCE(fb->height > AST_MAX_HWC_HEIGHT)) + if (drm_WARN_ON_ONCE(dev, fb->width > AST_MAX_HWC_WIDTH) || + drm_WARN_ON_ONCE(dev, fb->height > AST_MAX_HWC_HEIGHT)) return -EINVAL; /* BUG: didn't test in atomic_check() */ - ast = to_ast_private(crtc->dev); + ast = to_ast_private(dev); gbo = drm_gem_vram_of_gem(fb->obj[0]); src = drm_gem_vram_vmap(gbo); @@ -703,6 +705,7 @@ static void ast_cursor_plane_helper_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { + struct drm_device *dev = plane->dev; struct drm_plane_state *state = plane->state; struct drm_crtc *crtc = state->crtc; struct drm_framebuffer *fb = state->fb; @@ -719,7 +722,7 @@ ast_cursor_plane_helper_atomic_update(struct drm_plane *plane, /* A new cursor image was installed. */ gbo = ast->cursor.gbo[ast->cursor.next_index]; off = drm_gem_vram_offset(gbo); - if (WARN_ON_ONCE(off < 0)) + if (drm_WARN_ON_ONCE(dev, off < 0)) return; /* Bug: we didn't pin cursor HW BO to VRAM. */ ast_cursor_set_base(ast, off); @@ -898,8 +901,9 @@ static struct drm_crtc_state * ast_crtc_atomic_duplicate_state(struct drm_crtc *crtc) { struct ast_crtc_state *new_ast_state, *ast_state; + struct drm_device *dev = crtc->dev; - if (WARN_ON(!crtc->state)) + if (drm_WARN_ON(dev, !crtc->state)) return NULL; new_ast_state = kmalloc(sizeof(*new_ast_state), GFP_KERNEL); @@ -1105,7 +1109,7 @@ static int ast_connector_init(struct drm_device *dev) connector = &ast_connector->base; ast_connector->i2c = ast_i2c_create(dev); if (!ast_connector->i2c) - DRM_ERROR("failed to add ddc bus for connector\n"); + drm_err(dev, "failed to add ddc bus for connector\n"); drm_connector_init_with_ddc(dev, connector, &ast_connector_funcs, @@ -1189,7 +1193,7 @@ int ast_mode_init(struct drm_device *dev) ARRAY_SIZE(ast_primary_plane_formats), NULL, DRM_PLANE_TYPE_PRIMARY, NULL); if (ret) { - DRM_ERROR("ast: drm_universal_plane_init() failed: %d\n", ret); + drm_err(dev, "ast: drm_universal_plane_init() failed: %d\n", ret); return ret; } drm_plane_helper_add(&ast->primary_plane, @@ -1201,7 +1205,7 @@ int ast_mode_init(struct drm_device *dev) ARRAY_SIZE(ast_cursor_plane_formats), NULL, DRM_PLANE_TYPE_CURSOR, NULL); if (ret) { - DRM_ERROR("drm_universal_plane_failed(): %d\n", ret); + drm_err(dev, "drm_universal_plane_failed(): %d\n", ret); return ret; } drm_plane_helper_add(&ast->cursor_plane, @@ -1323,7 +1327,7 @@ static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev) i2c->bit.getscl = get_clock; ret = i2c_bit_add_bus(&i2c->adapter); if (ret) { - DRM_ERROR("Failed to register bit i2c\n"); + drm_err(dev, "Failed to register bit i2c\n"); goto out_free; } diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c index 226e1290227a..c043fe717553 100644 --- a/drivers/gpu/drm/ast/ast_post.c +++ b/drivers/gpu/drm/ast/ast_post.c @@ -2067,7 +2067,7 @@ void ast_post_chip_2500(struct drm_device *dev) } if (!ast_dram_init_2500(ast)) - DRM_ERROR("DRAM init failed !\n"); + drm_err(dev, "DRAM init failed !\n"); temp = ast_mindwm(ast, 0x1e6e2040); ast_moutdwm(ast, 0x1e6e2040, temp | 0x40); diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c index fad34106083a..9c3788a4c1c5 100644 --- a/drivers/gpu/drm/ast/ast_ttm.c +++ b/drivers/gpu/drm/ast/ast_ttm.c @@ -44,7 +44,7 @@ int ast_mm_init(struct ast_private *ast) ast->vram_size); if (IS_ERR(vmm)) { ret = PTR_ERR(vmm); - DRM_ERROR("Error initializing VRAM MM; %d\n", ret); + drm_err(dev, "Error initializing VRAM MM; %d\n", ret); return ret; }