From patchwork Mon Jul 11 15:50:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589578 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EE0CCCA485 for ; Mon, 11 Jul 2022 15:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231140AbiGKPun (ORCPT ); Mon, 11 Jul 2022 11:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230358AbiGKPum (ORCPT ); Mon, 11 Jul 2022 11:50:42 -0400 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A6EA77A47 for ; Mon, 11 Jul 2022 08:50:39 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by baptiste.telenet-ops.be with bizsmtp id trqd2700Z4C55Sk01rqdeL; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgD-0036wx-8w; Mon, 11 Jul 2022 17:50:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgC-006sh9-RW; Mon, 11 Jul 2022 17:50:36 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 01/10] video: fbdev: atari: Simplify atafb_pan_display() Date: Mon, 11 Jul 2022 17:50:25 +0200 Message-Id: <7b7c1c25309f40d780e25b258f726e6ebcc79ca4.1657554353.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The fb_pan_display() function in the core already takes care of validating the panning parameters before calling the driver's .fb_pan_display() callback, and of updating the panning state afterwards, so there is no need to repeat that in the driver. Remove the duplicate code. Signed-off-by: Geert Uytterhoeven --- drivers/video/fbdev/atafb.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index 102c727cedc0f005..c0683d2a4efaf1e8 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -2407,35 +2407,10 @@ static void atafb_set_disp(struct fb_info *info) static int atafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { - int xoffset = var->xoffset; - int yoffset = var->yoffset; - int err; - - if (var->vmode & FB_VMODE_YWRAP) { - if (yoffset < 0 || yoffset >= info->var.yres_virtual || xoffset) - return -EINVAL; - } else { - if (xoffset + info->var.xres > info->var.xres_virtual || - yoffset + info->var.yres > info->var.yres_virtual) - return -EINVAL; - } - - if (fbhw->pan_display) { - err = fbhw->pan_display(var, info); - if (err) - return err; - } else + if (!fbhw->pan_display) return -EINVAL; - info->var.xoffset = xoffset; - info->var.yoffset = yoffset; - - if (var->vmode & FB_VMODE_YWRAP) - info->var.vmode |= FB_VMODE_YWRAP; - else - info->var.vmode &= ~FB_VMODE_YWRAP; - - return 0; + return fbhw->pan_display(var, info); } /* From patchwork Mon Jul 11 15:50:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FA5ECCA47B for ; Mon, 11 Jul 2022 15:50:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230157AbiGKPum (ORCPT ); Mon, 11 Jul 2022 11:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbiGKPul (ORCPT ); Mon, 11 Jul 2022 11:50:41 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3B5D5D0E0 for ; Mon, 11 Jul 2022 08:50:39 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by xavier.telenet-ops.be with bizsmtp id trqd2700h4C55Sk01rqd4C; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgD-0036wy-D6; Mon, 11 Jul 2022 17:50:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgC-006shH-SJ; Mon, 11 Jul 2022 17:50:36 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 02/10] video: fbdev: atari: Remove bogus FB_VMODE_YWRAP flags Date: Mon, 11 Jul 2022 17:50:26 +0200 Message-Id: <0373f203dc541e17e4e52981c9416b46b4df0c95.1657554353.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Vertical wrap is not supported (fb_fix_screeninfo.ywrapstep = 0), hence there is no point in setting the FB_VMODE_YWRAP flag in video modes. Signed-off-by: Geert Uytterhoeven --- drivers/video/fbdev/atafb.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index c0683d2a4efaf1e8..172ef547ff6f4883 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -467,27 +467,27 @@ static struct fb_videomode atafb_modedb[] __initdata = { { /* 320x200, 15 kHz, 60 Hz (ST low) */ "st-low", 60, 320, 200, 32000, 32, 16, 31, 14, 96, 4, - 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + 0, FB_VMODE_NONINTERLACED }, { /* 640x200, 15 kHz, 60 Hz (ST medium) */ "st-mid", 60, 640, 200, 32000, 32, 16, 31, 14, 96, 4, - 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + 0, FB_VMODE_NONINTERLACED }, { /* 640x400, 30.25 kHz, 63.5 Hz (ST high) */ "st-high", 63, 640, 400, 32000, 128, 0, 40, 14, 128, 4, - 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + 0, FB_VMODE_NONINTERLACED }, { /* 320x480, 15 kHz, 60 Hz (TT low) */ "tt-low", 60, 320, 480, 31041, 120, 100, 8, 16, 140, 30, - 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + 0, FB_VMODE_NONINTERLACED }, { /* 640x480, 29 kHz, 57 Hz (TT medium) */ "tt-mid", 60, 640, 480, 31041, 120, 100, 8, 16, 140, 30, - 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + 0, FB_VMODE_NONINTERLACED }, { /* 1280x960, 72 kHz, 72 Hz (TT high) */ "tt-high", 57, 1280, 960, 7760, 260, 60, 36, 4, 192, 4, - 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + 0, FB_VMODE_NONINTERLACED }, /* @@ -497,11 +497,11 @@ static struct fb_videomode atafb_modedb[] __initdata = { { /* 640x480, 31 kHz, 60 Hz (VGA) */ "vga", 63.5, 640, 480, 32000, 18, 42, 31, 11, 96, 3, - 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + 0, FB_VMODE_NONINTERLACED }, { /* 640x400, 31 kHz, 70 Hz (VGA) */ "vga70", 70, 640, 400, 32000, 18, 42, 31, 11, 96, 3, - FB_SYNC_VERT_HIGH_ACT | FB_SYNC_COMP_HIGH_ACT, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + FB_SYNC_VERT_HIGH_ACT | FB_SYNC_COMP_HIGH_ACT, FB_VMODE_NONINTERLACED }, /* @@ -511,7 +511,7 @@ static struct fb_videomode atafb_modedb[] __initdata = { { /* 896x608, 31 kHz, 60 Hz (Falcon High) */ "falh", 60, 896, 608, 32000, 18, 42, 31, 1, 96,3, - 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP + 0, FB_VMODE_NONINTERLACED }, }; From patchwork Mon Jul 11 15:50:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589576 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 736F1C43334 for ; Mon, 11 Jul 2022 15:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231708AbiGKPvE (ORCPT ); Mon, 11 Jul 2022 11:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231484AbiGKPu6 (ORCPT ); Mon, 11 Jul 2022 11:50:58 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E482422C9 for ; Mon, 11 Jul 2022 08:50:39 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by xavier.telenet-ops.be with bizsmtp id trqd2700e4C55Sk01rqd4B; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgD-0036wz-AP; Mon, 11 Jul 2022 17:50:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgC-006shN-T7; Mon, 11 Jul 2022 17:50:36 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 03/10] video: fbdev: atari: Fix inverse handling Date: Mon, 11 Jul 2022 17:50:27 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Currently, the "inverse" option does not do anything, as it just sets a flag, which is further unused. Fix this by calling fb_invert_cmaps() instead, like other drivers do. As this only affects the console colormap, this does not affect X. Update the documentation to match the actual behavior. Signed-off-by: Geert Uytterhoeven --- Documentation/m68k/kernel-options.rst | 4 ++-- drivers/video/fbdev/atafb.c | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Documentation/m68k/kernel-options.rst b/Documentation/m68k/kernel-options.rst index cabd9419740d5ada..2008a20b43295bd5 100644 --- a/Documentation/m68k/kernel-options.rst +++ b/Documentation/m68k/kernel-options.rst @@ -367,8 +367,8 @@ activated by a "external:" sub-option. 4.1.2) inverse -------------- -Invert the display. This affects both, text (consoles) and graphics -(X) display. Usually, the background is chosen to be black. With this +Invert the display. This affects only text consoles. +Usually, the background is chosen to be black. With this option, you can make the background white. 4.1.3) font diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index 172ef547ff6f4883..39c3b860a797d4bc 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -236,8 +236,6 @@ static int *MV300_reg = MV300_reg_8bit; #endif /* ATAFB_EXT */ -static int inverse; - /* * struct fb_ops { * * open/release and usage marking @@ -2971,7 +2969,7 @@ static int __init atafb_setup(char *options) default_par = temp; mode_option = this_opt; } else if (!strcmp(this_opt, "inverse")) - inverse = 1; + fb_invert_cmaps(); else if (!strncmp(this_opt, "hwscroll_", 9)) { hwscroll = simple_strtoul(this_opt + 9, NULL, 10); if (hwscroll < 0) From patchwork Mon Jul 11 15:50:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60BC7C43334 for ; Mon, 11 Jul 2022 15:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231542AbiGKPvG (ORCPT ); Mon, 11 Jul 2022 11:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbiGKPu7 (ORCPT ); Mon, 11 Jul 2022 11:50:59 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0031B74E24 for ; Mon, 11 Jul 2022 08:50:39 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by xavier.telenet-ops.be with bizsmtp id trqe2700d4C55Sk01rqe4f; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgD-0036x0-N6; Mon, 11 Jul 2022 17:50:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgC-006shU-Tl; Mon, 11 Jul 2022 17:50:36 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 04/10] video: fbdev: atari: Fix ext_setcolreg() Date: Mon, 11 Jul 2022 17:50:28 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The red, green, and blue color values are 16-bit, while the external graphics hardware registers are 8-bit. Add the missing conversion from 16-bit to 8-bit. Signed-off-by: Geert Uytterhoeven --- Untested due to lack of hardware. --- drivers/video/fbdev/atafb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index 39c3b860a797d4bc..a36cd8f1f4200dd5 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -2206,6 +2206,10 @@ static int ext_setcolreg(unsigned int regno, unsigned int red, if (regno > 255) return 1; + red >>= 8; + green >>= 8; + blue >>= 8; + switch (external_card_type) { case IS_VGA: OUTB(0x3c8, regno); From patchwork Mon Jul 11 15:50:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2D83CCA47B for ; Mon, 11 Jul 2022 15:51:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231579AbiGKPvA (ORCPT ); Mon, 11 Jul 2022 11:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbiGKPus (ORCPT ); Mon, 11 Jul 2022 11:50:48 -0400 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5311677A42 for ; Mon, 11 Jul 2022 08:50:40 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by baptiste.telenet-ops.be with bizsmtp id trqe270064C55Sk01rqeeU; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgD-0036x1-Ny; Mon, 11 Jul 2022 17:50:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgC-006shc-UU; Mon, 11 Jul 2022 17:50:36 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 05/10] video: fbdev: atari: Remove unneeded casts from void * Date: Mon, 11 Jul 2022 17:50:29 +0200 Message-Id: <6347fe3212d34d6b50634ee967c0a4a2127610a8.1657554353.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org There is no need to cast fb_info.par to "struct atafb_par *", as the former has type "void *". Remove the casts, as they make it impossible to validate types. Signed-off-by: Geert Uytterhoeven --- drivers/video/fbdev/atafb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index a36cd8f1f4200dd5..f20535ea3e549384 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -1639,7 +1639,7 @@ static irqreturn_t falcon_vbl_switcher(int irq, void *dummy) static int falcon_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { - struct atafb_par *par = (struct atafb_par *)info->par; + struct atafb_par *par = info->par; int xoffset; int bpp = info->var.bits_per_pixel; @@ -2263,7 +2263,7 @@ static void set_screen_base(void *s_base) static int pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { - struct atafb_par *par = (struct atafb_par *)info->par; + struct atafb_par *par = info->par; if (!fbhw->set_screen_base || (!ATARIHW_PRESENT(EXTD_SHIFTER) && var->xoffset)) @@ -2432,7 +2432,7 @@ atafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) static void atafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) { - struct atafb_par *par = (struct atafb_par *)info->par; + struct atafb_par *par = info->par; int x2, y2; u32 width, height; @@ -2475,7 +2475,7 @@ static void atafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) static void atafb_copyarea(struct fb_info *info, const struct fb_copyarea *area) { - struct atafb_par *par = (struct atafb_par *)info->par; + struct atafb_par *par = info->par; int x2, y2; u32 dx, dy, sx, sy, width, height; int rev_copy = 0; @@ -2529,7 +2529,7 @@ static void atafb_copyarea(struct fb_info *info, const struct fb_copyarea *area) static void atafb_imageblit(struct fb_info *info, const struct fb_image *image) { - struct atafb_par *par = (struct atafb_par *)info->par; + struct atafb_par *par = info->par; int x2, y2; unsigned long *dst; int dst_idx; @@ -2672,7 +2672,7 @@ static int atafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) * hw par just decoded */ static int atafb_set_par(struct fb_info *info) { - struct atafb_par *par = (struct atafb_par *)info->par; + struct atafb_par *par = info->par; /* Decode wanted screen parameters */ fbhw->decode_var(&info->var, par); From patchwork Mon Jul 11 15:50:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589574 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A75BFC433EF for ; Mon, 11 Jul 2022 15:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbiGKPz4 (ORCPT ); Mon, 11 Jul 2022 11:55:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbiGKPzz (ORCPT ); Mon, 11 Jul 2022 11:55:55 -0400 X-Greylist: delayed 312 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 11 Jul 2022 08:55:54 PDT Received: from cantor.telenet-ops.be (cantor.telenet-ops.be [195.130.132.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2813C27CD2 for ; Mon, 11 Jul 2022 08:55:53 -0700 (PDT) Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by cantor.telenet-ops.be (Postfix) with ESMTPS id 4LhSyl2lF7z4x2YY for ; Mon, 11 Jul 2022 17:50:39 +0200 (CEST) Received: from ramsan.of.borg ([84.195.186.194]) by xavier.telenet-ops.be with bizsmtp id trqf270054C55Sk01rqf58; Mon, 11 Jul 2022 17:50:39 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgE-0036x2-H5; Mon, 11 Jul 2022 17:50:38 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgC-006shk-Vj; Mon, 11 Jul 2022 17:50:36 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 06/10] video: fbdev: atari: Remove unneeded casts to void * Date: Mon, 11 Jul 2022 17:50:30 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Arbitrary pointers can be passed to functions accepting "void *" without casting. Remove the casts, as they make it impossible to validate types. Signed-off-by: Geert Uytterhoeven --- drivers/video/fbdev/atafb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index f20535ea3e549384..fbc333d5615df5d5 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -2599,14 +2599,14 @@ atafb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) switch (cmd) { #ifdef FBCMD_GET_CURRENTPAR case FBCMD_GET_CURRENTPAR: - if (copy_to_user((void *)arg, (void *)¤t_par, + if (copy_to_user((void *)arg, ¤t_par, sizeof(struct atafb_par))) return -EFAULT; return 0; #endif #ifdef FBCMD_SET_CURRENTPAR case FBCMD_SET_CURRENTPAR: - if (copy_from_user((void *)¤t_par, (void *)arg, + if (copy_from_user(¤t_par, (void *)arg, sizeof(struct atafb_par))) return -EFAULT; ata_set_par(¤t_par); From patchwork Mon Jul 11 15:50:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FEF2CCA481 for ; Mon, 11 Jul 2022 15:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231480AbiGKPvF (ORCPT ); Mon, 11 Jul 2022 11:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbiGKPu7 (ORCPT ); Mon, 11 Jul 2022 11:50:59 -0400 Received: from andre.telenet-ops.be (andre.telenet-ops.be [IPv6:2a02:1800:120:4::f00:15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23CED77A63 for ; Mon, 11 Jul 2022 08:50:40 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by andre.telenet-ops.be with bizsmtp id trqe2700R4C55Sk01rqe5a; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgE-0036x3-2b; Mon, 11 Jul 2022 17:50:38 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgD-006shq-13; Mon, 11 Jul 2022 17:50:37 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 07/10] video: fbdev: atari: Fix TT High video mode vertical refresh Date: Mon, 11 Jul 2022 17:50:31 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The vertical refresh rate for the TT High video mode (1280x960) is wrong. Fortunately this field is not really used. Signed-off-by: Geert Uytterhoeven --- drivers/video/fbdev/atafb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index fbc333d5615df5d5..528478f6f30857ef 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -484,7 +484,7 @@ static struct fb_videomode atafb_modedb[] __initdata = { 0, FB_VMODE_NONINTERLACED }, { /* 1280x960, 72 kHz, 72 Hz (TT high) */ - "tt-high", 57, 1280, 960, 7760, 260, 60, 36, 4, 192, 4, + "tt-high", 72, 1280, 960, 7760, 260, 60, 36, 4, 192, 4, 0, FB_VMODE_NONINTERLACED }, From patchwork Mon Jul 11 15:50:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30368CCA483 for ; Mon, 11 Jul 2022 15:51:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231223AbiGKPvA (ORCPT ); Mon, 11 Jul 2022 11:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231234AbiGKPut (ORCPT ); Mon, 11 Jul 2022 11:50:49 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A5D277A46 for ; Mon, 11 Jul 2022 08:50:40 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by xavier.telenet-ops.be with bizsmtp id trqe270124C55Sk01rqe4s; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgD-0036xD-Vl; Mon, 11 Jul 2022 17:50:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgD-006shx-2d; Mon, 11 Jul 2022 17:50:37 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 08/10] video: fbdev: atari: Fix VGA modes Date: Mon, 11 Jul 2022 17:50:32 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The pixclock values in the vga and vga70 modes are wrong, as they should use the 25.175 MHz clock instead of the 32 MHz clock. Swap the left and right margins to match f25.{right,left} (struct pixel_clock declares them in a different order), and update the hsync lengths to match what the driver programs by default. Correct the (wrong) floating-point vrefresh value for the vga mode. Signed-off-by: Geert Uytterhoeven --- drivers/video/fbdev/atafb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index 528478f6f30857ef..46a00e0ad5e785ac 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -494,11 +494,11 @@ static struct fb_videomode atafb_modedb[] __initdata = { { /* 640x480, 31 kHz, 60 Hz (VGA) */ - "vga", 63.5, 640, 480, 32000, 18, 42, 31, 11, 96, 3, + "vga", 60, 640, 480, 39721, 42, 18, 31, 11, 100, 3, 0, FB_VMODE_NONINTERLACED }, { /* 640x400, 31 kHz, 70 Hz (VGA) */ - "vga70", 70, 640, 400, 32000, 18, 42, 31, 11, 96, 3, + "vga70", 70, 640, 400, 39721, 42, 18, 31, 11, 100, 3, FB_SYNC_VERT_HIGH_ACT | FB_SYNC_COMP_HIGH_ACT, FB_VMODE_NONINTERLACED }, From patchwork Mon Jul 11 15:50:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6A55CCA47B for ; Mon, 11 Jul 2022 15:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231650AbiGKPvD (ORCPT ); Mon, 11 Jul 2022 11:51:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231277AbiGKPut (ORCPT ); Mon, 11 Jul 2022 11:50:49 -0400 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C51EC77A5F for ; Mon, 11 Jul 2022 08:50:40 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by baptiste.telenet-ops.be with bizsmtp id trqe2700s4C55Sk01rqeem; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgE-0036xE-7d; Mon, 11 Jul 2022 17:50:38 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgD-006si5-4H; Mon, 11 Jul 2022 17:50:37 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 09/10] video: fbdev: atari: Remove unused definitions and variables Date: Mon, 11 Jul 2022 17:50:33 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Several definitions and variables are unused. Some variables are set but further unused. Remove them. Signed-off-by: Geert Uytterhoeven --- drivers/video/fbdev/atafb.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index 46a00e0ad5e785ac..e8b178e732e2c785 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -1070,8 +1070,6 @@ static int falcon_decode_var(struct fb_var_screeninfo *var, xstretch = 2; /* Double pixel width only for hicolor */ /* Default values are used for vert./hor. timing if no pixelclock given. */ if (var->pixclock == 0) { - int linesize; - /* Choose master pixelclock depending on hor. timing */ plen = 1 * xstretch; if ((plen * xres + f25.right + f25.hsync + f25.left) * @@ -1090,7 +1088,6 @@ static int falcon_decode_var(struct fb_var_screeninfo *var, left_margin = pclock->left / plen; right_margin = pclock->right / plen; hsync_len = pclock->hsync / plen; - linesize = left_margin + xres + right_margin + hsync_len; upper_margin = 31; lower_margin = 11; vsync_len = 3; @@ -2419,17 +2416,6 @@ atafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) * generic drawing routines; imageblit needs updating for image depth > 1 */ -#if BITS_PER_LONG == 32 -#define BYTES_PER_LONG 4 -#define SHIFT_PER_LONG 5 -#elif BITS_PER_LONG == 64 -#define BYTES_PER_LONG 8 -#define SHIFT_PER_LONG 6 -#else -#define Please update me -#endif - - static void atafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) { struct atafb_par *par = info->par; @@ -2531,8 +2517,6 @@ static void atafb_imageblit(struct fb_info *info, const struct fb_image *image) { struct atafb_par *par = info->par; int x2, y2; - unsigned long *dst; - int dst_idx; const char *src; u32 dx, dy, width, height, pitch; @@ -2559,10 +2543,6 @@ static void atafb_imageblit(struct fb_info *info, const struct fb_image *image) if (image->depth == 1) { // used for font data - dst = (unsigned long *) - ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1)); - dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8; - dst_idx += dy * par->next_line * 8 + dx; src = image->data; pitch = (image->width + 7) / 8; while (height--) { From patchwork Mon Jul 11 15:50:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589890 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29085CCA480 for ; Mon, 11 Jul 2022 15:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231744AbiGKPvH (ORCPT ); Mon, 11 Jul 2022 11:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231529AbiGKPu7 (ORCPT ); Mon, 11 Jul 2022 11:50:59 -0400 Received: from andre.telenet-ops.be (andre.telenet-ops.be [IPv6:2a02:1800:120:4::f00:15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6AE077A51 for ; Mon, 11 Jul 2022 08:50:40 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by andre.telenet-ops.be with bizsmtp id trqe2700J4C55Sk01rqe5Y; Mon, 11 Jul 2022 17:50:38 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvgD-0036xI-Rt; Mon, 11 Jul 2022 17:50:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvgD-006siC-6A; Mon, 11 Jul 2022 17:50:37 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: Michael Schmitz , Jonathan Corbet , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 10/10] [RFC] video: fbdev: atari: Remove backward bug-compatibility Date: Mon, 11 Jul 2022 17:50:34 +0200 Message-Id: <52d52566a80bfd00acdcfc28a24799d3fbf638f6.1657554353.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org As of v2.1.0, falcon_decode_var() contains a quirk to fix a rounding error, as explained by Günther Kelleter on Fri, 30 Aug 1996: This diff removes the now obsolete Falcon video option "pwrsave", and fixes a rounding error that is triggered by the resolution switching X server (those who use the pixel clock value 39722 in their /etc/fb.modes should change it to 39721). However, this causes the modified video mode returned by falcon_decode_var() to not match the video mode returned by falcon_encode_var(). Fix this by dropping the quirk. Unfortunately /etc/fb.modes in fbset was never updated, so the "640x480-60" mode still contains the wrong pixclock. Hence this change may introduce a regression. Signed-off-by: Geert Uytterhoeven --- Any comments? --- drivers/video/fbdev/atafb.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index e8b178e732e2c785..2bc4089865e60ac2 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -1008,10 +1008,6 @@ static int falcon_decode_var(struct fb_var_screeninfo *var, else if (yres_virtual < yres) yres_virtual = yres; - /* backward bug-compatibility */ - if (var->pixclock > 1) - var->pixclock -= 1; - par->hw.falcon.line_width = bpp * xres / 16; par->hw.falcon.line_offset = bpp * (xres_virtual - xres) / 16;