From patchwork Tue Mar 24 13:45:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 11455451 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 E0BF092A for ; Tue, 24 Mar 2020 13:45:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C25CA20753 for ; Tue, 24 Mar 2020 13:45:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="neABOikZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728298AbgCXNpV (ORCPT ); Tue, 24 Mar 2020 09:45:21 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40745 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727612AbgCXNpU (ORCPT ); Tue, 24 Mar 2020 09:45:20 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200324134519euoutp01ac45721561807f7072f3864f3dcc98df~-QWpxJGWt0072900729euoutp01m for ; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200324134519euoutp01ac45721561807f7072f3864f3dcc98df~-QWpxJGWt0072900729euoutp01m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585057519; bh=yXh2RcsZrYf2EbSKBQkmhmg+sHAmDch+gTjfbijzcbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=neABOikZ4nqsjyc3v6hvgQtqmQ2T7Pn78RypvHTWVVwjUAvxGDZLNXV8t58n49P8H Wg9nZwftKX1VBfeCnc+qk1rBPCy73yrKhD+7j302fhWOJIkmuz5CBt8shrZjcsXF2j qIJXH8PVM/uuPdQliVV4SC0hGJmYuZmb4y2cePTw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200324134518eucas1p186a71391f432238701705559ec0af916~-QWpdBeby1322113221eucas1p1X; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id C3.05.61286.EEE0A7E5; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200324134518eucas1p16e1a39c14dfd101f5a6d86218a9e19af~-QWpKax371592915929eucas1p1R; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200324134518eusmtrp1d4ce6f0970fcaf01bbce7bfa205456c3~-QWpJuYsM2608326083eusmtrp1k; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) X-AuditID: cbfec7f2-ef1ff7000001ef66-48-5e7a0eeedb29 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F8.56.07950.EEE0A7E5; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) Received: from AMDC3058.digital.local (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200324134518eusmtip2036fcadcccc7c972512ce3d33fbd27af~-QWo2jwJP2918929189eusmtip2h; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) From: Bartlomiej Zolnierkiewicz To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Sam Ravnborg , b.zolnierkie@samsung.com Subject: [PATCH v2 1/6] video: fbdev: controlfb: fix sparse warning about using incorrect type Date: Tue, 24 Mar 2020 14:45:03 +0100 Message-Id: <20200324134508.25120-2-b.zolnierkie@samsung.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200324134508.25120-1-b.zolnierkie@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCKsWRmVeSWpSXmKPExsWy7djP87rv+KriDP4cMra4te4cq8XGGetZ La58fc9mcaLvA6vF5V1z2CxW/NzK6MDmcb/7OJPHkmlX2Tz6tqxi9Pi8SS6AJYrLJiU1J7Ms tUjfLoEr48/E2ILdXBW3LvSzNzC+5uhi5OSQEDCR6JrXyt7FyMUhJLCCUaL/ViMLhPOFUWL+ 20+sEM5nRom/n6YzwrQ0/JrODJFYziixeco7hJaXC9YxgVSxCVhJTGxfBdYhIpAgsWL6DDCb WSBF4sOW/2A1wkDxXTNvs4LYLAKqEl2T3wMdwsHBK2ArsWBVOMQyeYmt3z6BlXAK2En0TjvE DGLzCghKnJz5hAVipLxE89bZYAdJCPxnk7h5ZCkzRLOLxJs3V5kgbGGJV8e3sEPYMhKnJ/ew QDSsA3qt4wVU93ZGieWT/7FBVFlL3Dn3iw3kImYBTYn1u/Qhwo4SxybNYQUJSwjwSdx4Kwhx BJ/EpG2gUAEJ80p0tAlBVKtJbFi2gQ1mbdfOlVCneUj8vjCBfQKj4iwk78xC8s4shL0LGJlX MYqnlhbnpqcWG+allusVJ+YWl+al6yXn525iBKaV0/+Of9rB+PVS0iFGAQ5GJR5ejYeVcUKs iWXFlbmHGCU4mJVEeDenVsQJ8aYkVlalFuXHF5XmpBYfYpTmYFES5zVe9DJWSCA9sSQ1OzW1 ILUIJsvEwSnVwFiQk7ntVrlbz/ddR35I/7r7fcFM4XW738jsFEx0ufTJjL8+QmmfnMLRNr+Z zMHp5VHrZaJdlq4KZJUT8l2Vesx6gk2ezzIGlr0rt3zexF90uvdrg8dDdbv2RZ1KOqurTpyT dudck9sy3/igpr+Xd+DSKyerVtqbbeSZFTOpYWP+HZVt4tr765RYijMSDbWYi4oTAZkCy+An AwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRmVeSWpSXmKPExsVy+t/xe7rv+KriDN4cULG4te4cq8XGGetZ La58fc9mcaLvA6vF5V1z2CxW/NzK6MDmcb/7OJPHkmlX2Tz6tqxi9Pi8SS6AJUrPpii/tCRV ISO/uMRWKdrQwkjP0NJCz8jEUs/Q2DzWyshUSd/OJiU1J7MstUjfLkEv48/E2ILdXBW3LvSz NzC+5uhi5OSQEDCRaPg1nRnEFhJYyiix76xDFyMHUFxG4vj6MogSYYk/17rYuhi5gEo+MUpM P/sIrJ5NwEpiYvsqRhBbRCBJorPhJFicWSBNYtLZu0wgtrBAnMTaTYfZQWwWAVWJrsnv2UHm 8wrYSixYFQ4xX15i67dPrCA2p4CdRO+0Q1Dn2Eq8W38cbDyvgKDEyZlPWCDGy0s0b53NPIFR YBaS1CwkqQWMTKsYRVJLi3PTc4uN9IoTc4tL89L1kvNzNzECA3/bsZ9bdjB2vQs+xCjAwajE w6vxsDJOiDWxrLgy9xCjBAezkgjv5tSKOCHelMTKqtSi/Pii0pzU4kOMpkA/TGSWEk3OB0Zl Xkm8oamhuYWlobmxubGZhZI4b4fAwRghgfTEktTs1NSC1CKYPiYOTqkGRq2KNUWX/bKZL4uf KWwPL1q3hUUlP7dz3qPMWVPKXn4p9XGOddJb/yeotYc763uVFXOLqcXPQ+3FixcdUi871W15 YlnqcoOYNMPdS7q/1Kuxi1pff3o8YSVbQ1Z89pmTettkfO5oaSTdytcqCI4uPS0hfynRxaBE cd6B6jXr98m9eRSSMXGJEktxRqKhFnNRcSIAlQpAI5ICAAA= X-CMS-MailID: 20200324134518eucas1p16e1a39c14dfd101f5a6d86218a9e19af X-Msg-Generator: CA X-RootMTR: 20200324134518eucas1p16e1a39c14dfd101f5a6d86218a9e19af X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200324134518eucas1p16e1a39c14dfd101f5a6d86218a9e19af References: <20200324134508.25120-1-b.zolnierkie@samsung.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Use in_le32() instead of le32_to_cpup() to fix sparse warning about improper type of the argument. Also add missing inline keyword to control_par_to_var() definition (to match function prototype). Acked-by: Sam Ravnborg Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/controlfb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index 38b61cdb5ca4..9625792f4413 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -313,7 +313,7 @@ static int controlfb_blank(int blank_mode, struct fb_info *info) container_of(info, struct fb_info_control, info); unsigned ctrl; - ctrl = le32_to_cpup(CNTRL_REG(p,ctrl)); + ctrl = in_le32(CNTRL_REG(p, ctrl)); if (blank_mode > 0) switch (blank_mode) { case FB_BLANK_VSYNC_SUSPEND: @@ -952,7 +952,8 @@ static int control_var_to_par(struct fb_var_screeninfo *var, * Convert hardware data in par to an fb_var_screeninfo */ -static void control_par_to_var(struct fb_par_control *par, struct fb_var_screeninfo *var) +static inline void control_par_to_var(struct fb_par_control *par, + struct fb_var_screeninfo *var) { struct control_regints *rv; From patchwork Tue Mar 24 13:45:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 11455429 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 CB83F1667 for ; Tue, 24 Mar 2020 13:45:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7843C2073E for ; Tue, 24 Mar 2020 13:45:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="d5jUFdTK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728348AbgCXNpW (ORCPT ); Tue, 24 Mar 2020 09:45:22 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35962 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728129AbgCXNpV (ORCPT ); Tue, 24 Mar 2020 09:45:21 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200324134519euoutp020ab16fe796033ac058ee40954ba5a4c9~-QWqFsZpQ3077430774euoutp02k for ; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200324134519euoutp020ab16fe796033ac058ee40954ba5a4c9~-QWqFsZpQ3077430774euoutp02k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585057519; bh=SajSZrgSCmkiA3SOS/mxic5vQrlN9IelcIMWcE8/GLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d5jUFdTKQaVFPWpAf0uipwEun6bC3mIFdbwYT2aaQXRhrlXv0ylqWUVS0LKDMAAXY /CuyuQ/tuyr/jIH5975jyyiZPEbTM2OHyFEp7k/mlBeYhZSLQZiPDLj3kZAGq5EdM9 HCqZuoEQx1BPk1iTGaA3FekP7TTM59M8IcoaTQvM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200324134519eucas1p2344c54ba5a04d90fe5361359c66b0040~-QWp2_HGz3229632296eucas1p2J; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 76.48.60679.FEE0A7E5; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200324134518eucas1p2441fc1b4d095d4320afe5e8a86e3430f~-QWpegDiz0141301413eucas1p2A; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200324134518eusmtrp137ac898f6d27c7cdcc3e13dfaeb80009~-QWpd7sUb2619426194eusmtrp1p; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-c3-5e7a0eef31a1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EB.E6.08375.EEE0A7E5; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) Received: from AMDC3058.digital.local (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200324134518eusmtip20667bf1fa79e19ce481678e76e0bad2d~-QWpJt6Ht2961629616eusmtip2_; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) From: Bartlomiej Zolnierkiewicz To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Sam Ravnborg , b.zolnierkie@samsung.com Subject: [PATCH v2 2/6] video: fbdev: controlfb: add COMPILE_TEST support Date: Tue, 24 Mar 2020 14:45:04 +0100 Message-Id: <20200324134508.25120-3-b.zolnierkie@samsung.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200324134508.25120-1-b.zolnierkie@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCKsWRmVeSWpSXmKPExsWy7djP87rv+ariDA5sELW4te4cq8XGGetZ La58fc9mcaLvA6vF5V1z2CxW/NzK6MDmcb/7OJ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OSQEDCROH7zCFMXIxeHkMBSRolrP84ydzFyACVkJI6vL4OoEZb4c62LDaLmE6PE ox9b2UESbAJWEhPbVzGC2CICSRKdDSeZQWxmgTSJSWfvMoHYwgKeErPav4PVsAioSnw+9okd ZD6vgK3EzLeBEPPlJbZ++8QKYnMK2En0TjsENkYIqOTd+uNgrbwCghInZz5hgRgvL9G8dTbz BEaBWUhSs5CkFjAyrWIUSS0tzk3PLTbUK07MLS7NS9dLzs/dxAgM/W3Hfm7ewXhpY/AhRgEO RiUeXo2HlXFCrIllxZW5hxglOJiVRHg3p1bECfGmJFZWpRblxxeV5qQWH2I0BfphIrOUaHI+ MC7zSuINTQ3NLSwNzY3Njc0slMR5OwQOxggJpCeWpGanphakFsH0MXFwSjUwKr8pWMjyadvD pXxGS/g/lvpJ6m1aZHOi9MXf0vLjyRyTOs81vTpYJsfqfNHvkqn+5lV3L9zL/GiUPaMsrUC7 rnOL7aMpPXXnszeXTRPbPeV8+vF05Tu7g01u2L25uvjwqsoaX1G/TQndX+t3OX5S3Zwaryw+ Z/ET7+DLL8RdDVZO/uuc2f8oTImlOCPRUIu5qDgRAKNwfZeTAgAA X-CMS-MailID: 20200324134518eucas1p2441fc1b4d095d4320afe5e8a86e3430f X-Msg-Generator: CA X-RootMTR: 20200324134518eucas1p2441fc1b4d095d4320afe5e8a86e3430f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200324134518eucas1p2441fc1b4d095d4320afe5e8a86e3430f References: <20200324134508.25120-1-b.zolnierkie@samsung.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Add COMPILE_TEST support to controlfb driver for better compile testing coverage. While at it: - convert driver to use eieio() and dcbf() helpers instead of open-coding them - add invalid_vram_cache() helper to avoid code duplication Acked-by: Sam Ravnborg Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/Kconfig | 2 +- drivers/video/fbdev/controlfb.c | 41 ++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 91b0a719d221..fa88e8b9a83d 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -472,7 +472,7 @@ config FB_OF config FB_CONTROL bool "Apple \"control\" display support" - depends on (FB = y) && PPC_PMAC && PPC32 + depends on (FB = y) && ((PPC_PMAC && PPC32) || COMPILE_TEST) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index 9625792f4413..b347bc78bc4a 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -48,12 +48,37 @@ #include #include #include +#ifdef CONFIG_PPC_PMAC #include #include +#endif #include "macmodes.h" #include "controlfb.h" +#ifndef CONFIG_PPC_PMAC +#define invalid_vram_cache(addr) +#undef in_8 +#undef out_8 +#undef in_le32 +#undef out_le32 +#define in_8(addr) 0 +#define out_8(addr, val) +#define in_le32(addr) 0 +#define out_le32(addr, val) +#define pgprot_cached_wthru(prot) (prot) +#else +static void invalid_vram_cache(void __force *addr) +{ + eieio(); + dcbf(addr); + mb(); + eieio(); + dcbf(addr); + mb(); +} +#endif + struct fb_par_control { int vmode, cmode; int xres, yres; @@ -309,7 +334,7 @@ static int controlfb_mmap(struct fb_info *info, static int controlfb_blank(int blank_mode, struct fb_info *info) { - struct fb_info_control *p = + struct fb_info_control __maybe_unused *p = container_of(info, struct fb_info_control, info); unsigned ctrl; @@ -605,12 +630,7 @@ static void __init find_vram_size(struct fb_info_control *p) out_8(&p->frame_buffer[0x600000], 0xb3); out_8(&p->frame_buffer[0x600001], 0x71); - asm volatile("eieio; dcbf 0,%0" : : "r" (&p->frame_buffer[0x600000]) - : "memory" ); - mb(); - asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x600000]) - : "memory" ); - mb(); + invalid_vram_cache(&p->frame_buffer[0x600000]); bank2 = (in_8(&p->frame_buffer[0x600000]) == 0xb3) && (in_8(&p->frame_buffer[0x600001]) == 0x71); @@ -624,12 +644,7 @@ static void __init find_vram_size(struct fb_info_control *p) out_8(&p->frame_buffer[0], 0x5a); out_8(&p->frame_buffer[1], 0xc7); - asm volatile("eieio; dcbf 0,%0" : : "r" (&p->frame_buffer[0]) - : "memory" ); - mb(); - asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0]) - : "memory" ); - mb(); + invalid_vram_cache(&p->frame_buffer[0]); bank1 = (in_8(&p->frame_buffer[0]) == 0x5a) && (in_8(&p->frame_buffer[1]) == 0xc7); From patchwork Tue Mar 24 13:45:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 11455449 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 D807717EF for ; Tue, 24 Mar 2020 13:45:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9C922076E for ; Tue, 24 Mar 2020 13:45:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="WuSaNB+L" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728845AbgCXNpW (ORCPT ); Tue, 24 Mar 2020 09:45:22 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35964 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728196AbgCXNpV (ORCPT ); Tue, 24 Mar 2020 09:45:21 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200324134519euoutp020de950b2c9923e833dfa831983e2e0bf~-QWqMvoqo3014530145euoutp02N for ; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200324134519euoutp020de950b2c9923e833dfa831983e2e0bf~-QWqMvoqo3014530145euoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585057519; bh=TjreQCi8GcZdeFqEmL9FdXNVZv2wetsWfI3p3DJjO/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WuSaNB+LmG8uwpNLwpfGI0MUSOmtwdkUdYGSmOE52ALjT2ADqKdQFMc0+d/xgLZD4 fBZhwhrpGCWU6Zif9wRkI4B8eDp2Zg1DSy3DXpxQjX2byul069qYxDFXja4ijF6lSJ iH2YdCF0dgtwDFal02g6GygYKlKzKE5mZnMsRxIU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200324134519eucas1p10cae7f4aab3c350027d35040def34e58~-QWp-Hh7H0905809058eucas1p1i; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id FC.08.60698.FEE0A7E5; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200324134519eucas1p2d606db263a636433bf1545c836bed138~-QWpwJv6z3230032300eucas1p2-; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200324134519eusmtrp1900e7d86304abf94a785bccaaf113e69~-QWpvmFFf2619426194eusmtrp1s; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-62-5e7a0eef48bb Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5C.E6.08375.FEE0A7E5; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from AMDC3058.digital.local (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200324134518eusmtip2393f1a7de356a334a301a81a58cc9dbf~-QWpc9-Ku2918929189eusmtip2i; Tue, 24 Mar 2020 13:45:18 +0000 (GMT) From: Bartlomiej Zolnierkiewicz To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Sam Ravnborg , b.zolnierkie@samsung.com Subject: [PATCH v2 3/6] video: fbdev: controlfb: remove obsolete module support Date: Tue, 24 Mar 2020 14:45:05 +0100 Message-Id: <20200324134508.25120-4-b.zolnierkie@samsung.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200324134508.25120-1-b.zolnierkie@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGKsWRmVeSWpSXmKPExsWy7djPc7rv+ariDOYelrG4te4cq8XGGetZ La58fc9mcaLvA6vF5V1z2CxW/NzK6MDmcb/7OJPHkmlX2Tz6tqxi9Pi8SS6AJYrLJiU1J7Ms tUjfLoErY2HXS+aC6TwVE3+dYWlgbODqYuTkkBAwkfjw5QxzFyMXh5DACkaJH00b2SCcL4wS +04ch3I+M0pMfHuSEabl3KdfUInljBJ3Hj9hhWtZ/nYbO0gVm4CVxMT2VWAdIgIJEiumzwCz mQVSJD5s+c8EYgsLBEpc2dLJCmKzCKhK7Fm3lwXE5hWwlXhzu4EZYpu8xNZvn8BqOAXsJHqn HWKGqBGUODnzCQvETHmJ5q2zwZ6QEGhmlzj4dDcrRLOLxMt/m1ggbGGJV8e3sEPYMhKnJ/ew QDSsY5T42/ECqns70AuT/7FBVFlL3DkH8igH0ApNifW79CHCjhIPjz1mAQlLCP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CAmkJ5akZqemFqQWwfQxcXBKNTBmrT4/Y7fVbqmk 2Gnxp5tvLksTtMpgVLzLvPl9y+ODPDrJ53su9NndUnbyzdPWWHLjldOabX2/Chnn5J9/82G5 0h7rjobfgn+/2xXwbUs4nue/7ovoxXNKrNujQmZcaPNXzLraGLbmxu/zLXNmMu2y9+L9kZPh vGaFgiaLxty8zYsnZWYqd9sqsRRnJBpqMRcVJwIAgRlAp5UCAAA= X-CMS-MailID: 20200324134519eucas1p2d606db263a636433bf1545c836bed138 X-Msg-Generator: CA X-RootMTR: 20200324134519eucas1p2d606db263a636433bf1545c836bed138 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200324134519eucas1p2d606db263a636433bf1545c836bed138 References: <20200324134508.25120-1-b.zolnierkie@samsung.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org CONFIG_FB_CONTROL is bool, hence the Apple "control" frame buffer driver cannot be built as a module. Replace module_init() by device_initcall(). Acked-by: Sam Ravnborg Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/controlfb.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index b347bc78bc4a..92cffd2d0219 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -31,7 +31,6 @@ * more details. */ -#include #include #include #include @@ -198,28 +197,6 @@ static const struct fb_ops controlfb_ops = { /******************** The functions for controlfb_ops ********************/ -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) -{ - struct device_node *dp; - int ret = -ENXIO; - - dp = of_find_node_by_name(NULL, "control"); - if (dp && !control_of_init(dp)) - ret = 0; - of_node_put(dp); - - return ret; -} - -void cleanup_module(void) -{ - control_cleanup(); -} -#endif - /* * Checks a var structure */ @@ -612,7 +589,7 @@ static int __init control_init(void) return ret; } -module_init(control_init); +device_initcall(control_init); /* Work out which banks of VRAM we have installed. */ /* danj: I guess the card just ignores writes to nonexistant VRAM... */ From patchwork Tue Mar 24 13:45:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 11455453 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 52D001667 for ; Tue, 24 Mar 2020 13:45:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C25220753 for ; Tue, 24 Mar 2020 13:45:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="PTYXRyFa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726188AbgCXNpm (ORCPT ); Tue, 24 Mar 2020 09:45:42 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35971 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728220AbgCXNpV (ORCPT ); Tue, 24 Mar 2020 09:45:21 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200324134520euoutp02e6ac15b53852b77c0e56da5cc432c165~-QWqwb0FR3077330773euoutp02l for ; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200324134520euoutp02e6ac15b53852b77c0e56da5cc432c165~-QWqwb0FR3077330773euoutp02l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585057520; bh=wFMPPf1qHbV7MTxhfuXNX7PXRiVGUv9YYpv782+nToo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTYXRyFaySZUptWT+tR0t0BB7oU73t5mQiFjq9rDwrNx9xaohCGotr5OK0H8pR8L6 wF7QFqihwrKMlnsW9qEsYJ1NE9VPRxZxk8YiaJE8CAqGRpapyoeiKx6ZS9TH5ax1w1 jwrO/pAa2V41yuUl4NsdVqR/Jb33hP2mbcK0YTPM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200324134519eucas1p1b9fc55b0edf478a002bd8b298cef4979~-QWqas9sN1323313233eucas1p1Y; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 17.48.60679.FEE0A7E5; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200324134519eucas1p1e9b54c01e452330425f49c442e4c1b4e~-QWqE3-R61592815928eucas1p1P; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200324134519eusmtrp1dd9cdb988859cad042f02179a80bcdec~-QWqEVdbE2619426194eusmtrp1v; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) X-AuditID: cbfec7f4-0cbff7000001ed07-c6-5e7a0eefbf14 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2D.E6.08375.FEE0A7E5; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from AMDC3058.digital.local (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200324134519eusmtip267142118e3f73b5b45472bd472540e3a~-QWpwIps-2735827358eusmtip2n; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) From: Bartlomiej Zolnierkiewicz To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Sam Ravnborg , b.zolnierkie@samsung.com Subject: [PATCH v2 4/6] video: fbdev: controlfb: remove function prototypes part #1 Date: Tue, 24 Mar 2020 14:45:06 +0100 Message-Id: <20200324134508.25120-5-b.zolnierkie@samsung.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200324134508.25120-1-b.zolnierkie@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKKsWRmVeSWpSXmKPExsWy7djP87rv+ariDBbPtLS4te4cq8XGGetZ La58fc9mcaLvA6vF5V1z2CxW/NzK6MDmcb/7OJPHkmlX2Tz6tqxi9Pi8SS6AJYrLJiU1J7Ms tUjfLoEro2XZHJaCMyIVi3b+ZGtg3C/YxcjJISFgIvF131z2LkYuDiGBFYwSDZtnMkI4Xxgl pmy8C5X5zCjxsusQUIYDrGXlP0GI+HJGiW27TrHCdXw5eoUJZC6bgJXExPZVjCC2iECCxIrp M8BsZoEUiQ9b/oPVCAuESrT3v2IHsVkEVCUmdX1gA7F5BWwlTi64wQJxn7zE1m+fWEFsTgE7 id5ph5ghagQlTs58wgIxU16ieetsZpAjJAT+s0l0n98D1ewi8fPuJEYIW1ji1fEt7BC2jMTp yT0sEA3rGCX+dryA6t7OKLF88j82iCpriTvnfrGB/MwsoCmxfpc+RNhRonsDSDMoKPgkbrwV hDiCT2LStunMEGFeiY42IYhqNYkNyzawwazt2rmSGcL2kDjQ9pV5AqPiLCTvzELyziyEvQsY mVcxiqeWFuempxYb5aWW6xUn5haX5qXrJefnbmIEJpbT/45/2cG460/SIUYBDkYlHl6Nh5Vx QqyJZcWVuYcYJTiYlUR4N6dWxAnxpiRWVqUW5ccXleakFh9ilOZgURLnNV70MlZIID2xJDU7 NbUgtQgmy8TBKdXAyGVgaM1dzly26sFErwXOH9LTV9j8O/9/oXyz64QJfEzx+l+cEzrcJI/U L0xLP1cb5c9xK8Zx9+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134519eucas1p1e9b54c01e452330425f49c442e4c1b4e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200324134519eucas1p1e9b54c01e452330425f49c442e4c1b4e References: <20200324134508.25120-1-b.zolnierkie@samsung.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Reorder code a bit and then remove no longer needed function prototypes. Acked-by: Sam Ravnborg Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/controlfb.c | 41 +++++++++++---------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index 92cffd2d0219..83b7a219f557 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -141,20 +141,6 @@ struct fb_info_control { #define CNTRL_REG(INFO,REG) (&(((INFO)->control_regs->REG).r)) -/******************** Prototypes for exported functions ********************/ -/* - * struct fb_ops - */ -static int controlfb_pan_display(struct fb_var_screeninfo *var, - struct fb_info *info); -static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, - u_int transp, struct fb_info *info); -static int controlfb_blank(int blank_mode, struct fb_info *info); -static int controlfb_mmap(struct fb_info *info, - struct vm_area_struct *vma); -static int controlfb_set_par (struct fb_info *info); -static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); - /******************** Prototypes for internal functions **********************/ static void set_control_clock(unsigned char *params); @@ -181,20 +167,6 @@ static int default_vmode __initdata = VMODE_NVRAM; static int default_cmode __initdata = CMODE_NVRAM; -static const struct fb_ops controlfb_ops = { - .owner = THIS_MODULE, - .fb_check_var = controlfb_check_var, - .fb_set_par = controlfb_set_par, - .fb_setcolreg = controlfb_setcolreg, - .fb_pan_display = controlfb_pan_display, - .fb_blank = controlfb_blank, - .fb_mmap = controlfb_mmap, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, -}; - - /******************** The functions for controlfb_ops ********************/ /* @@ -1012,6 +984,19 @@ static inline void control_par_to_var(struct fb_par_control *par, var->pixclock >>= par->regvals.clock_params[2]; } +static const struct fb_ops controlfb_ops = { + .owner = THIS_MODULE, + .fb_check_var = controlfb_check_var, + .fb_set_par = controlfb_set_par, + .fb_setcolreg = controlfb_setcolreg, + .fb_pan_display = controlfb_pan_display, + .fb_blank = controlfb_blank, + .fb_mmap = controlfb_mmap, + .fb_fillrect = cfb_fillrect, + .fb_copyarea = cfb_copyarea, + .fb_imageblit = cfb_imageblit, +}; + /* * Set misc info vars for this driver */ From patchwork Tue Mar 24 13:45:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 11455437 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 9A3AF1667 for ; Tue, 24 Mar 2020 13:45:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56055208CA for ; Tue, 24 Mar 2020 13:45:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="O7+oeOkm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728274AbgCXNpX (ORCPT ); Tue, 24 Mar 2020 09:45:23 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40775 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728271AbgCXNpW (ORCPT ); Tue, 24 Mar 2020 09:45:22 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200324134520euoutp01c99ee0c6c5afacdf1d67e767b686b445~-QWrCJdPu3230632306euoutp01Y for ; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200324134520euoutp01c99ee0c6c5afacdf1d67e767b686b445~-QWrCJdPu3230632306euoutp01Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585057520; bh=YpuSFFNTd09+x2wYLvuiiWZ9nAKKYzilhyZjtSoZBG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O7+oeOkmK1XV6nnzGiE3QqWUQ6D3qDd7YT9GTj/NSsnV1Y1GCIkgSij8MJxc984cz 1mVHAroxVVYK3+KNt63mJ3aCGTVS9mZdsqqgyImCugJh/4+Xlbpf3w2y5xMQNMovzo ZcWWe4wdINQ4YeMTztynWjj8zBJUtowvE8IdYJe4= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200324134520eucas1p1641d6cc7bf9958c250b74f1c34a6b028~-QWqw8qst1323313233eucas1p1a; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 05.05.61286.0FE0A7E5; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200324134519eucas1p24bc9d0be4182b2f0046c002920bf7cc3~-QWqYhydm0464404644eucas1p20; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200324134519eusmtrp1cbc95761c80a1be4ee5239a3b4f5f7cb~-QWqX8xfY2619426194eusmtrp1y; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-4d-5e7a0ef0c48a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AA.56.07950.FEE0A7E5; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) Received: from AMDC3058.digital.local (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200324134519eusmtip245b355f16b1b671a6192b6108133df4f~-QWqEQsVH3226032260eusmtip20; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) From: Bartlomiej Zolnierkiewicz To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Sam Ravnborg , b.zolnierkie@samsung.com Subject: [PATCH v2 5/6] video: fbdev: controlfb: remove function prototypes part #2 Date: Tue, 24 Mar 2020 14:45:07 +0100 Message-Id: <20200324134508.25120-6-b.zolnierkie@samsung.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200324134508.25120-1-b.zolnierkie@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCKsWRmVeSWpSXmKPExsWy7djPc7of+KriDPacFbK4te4cq8XGGetZ La58fc9mcaLvA6vF5V1z2CxW/NzK6MDmcb/7OJPHkmlX2Tz6tqxi9Pi8SS6AJYrLJiU1J7Ms tUjfLoEro3HZPbaCyRkVC995NzDuC+5i5OSQEDCR2H/zLFsXIxeHkMAKRonzG98yQjhfGCXW TfsMlfnMKDH57hdWmJb3j68xQySWM0pca33DBpIAa5k92QTEZhOwkpjYvooRxBYRSJBYMX0G mM0skCLxYct/JhBbWCBU4sKbBrBeFgFViUtr+8BsXgFbiRUfz7BBLJOX2PrtE9hiTgE7id5p h5ghagQlTs58wgIxU16ieetssIMkBJrZJXq7O6GaXSTON5yHsoUlXh3fwg5hy0icntzDAtGw jlHib8cLqO7tjBLLJ/+D6rCWuHPuF5DNAbRCU2L9Ln2IsKPE3ucnWEDCEgJ8EjfeCkIcwScx adt0Zogwr0RHmxBEtZrEhmUb2GDWdu1cy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Hpw7bCIw+WmJ0WqdOeXqDyYdH7vxqJp79N279+Zd+72sJ0u7iytdkHptk/MQ/d c3H3/lv+J9R1Tl8p+vfwrMOdU90SNSqikrPC63LeHPPjMvk4R93Z7qXo/CP7UlO/vXyQ2RPM w9j79cN8nSU8neIThYOul61XYinOSDTUYi4qTgQAH32bmZQCAAA= X-CMS-MailID: 20200324134519eucas1p24bc9d0be4182b2f0046c002920bf7cc3 X-Msg-Generator: CA X-RootMTR: 20200324134519eucas1p24bc9d0be4182b2f0046c002920bf7cc3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200324134519eucas1p24bc9d0be4182b2f0046c002920bf7cc3 References: <20200324134508.25120-1-b.zolnierkie@samsung.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Reorder code a bit and then remove no longer needed function prototypes. Acked-by: Sam Ravnborg Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/controlfb.c | 410 +++++++++++++++----------------- 1 file changed, 198 insertions(+), 212 deletions(-) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index 83b7a219f557..c67d37103705 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -143,20 +143,12 @@ struct fb_info_control { /******************** Prototypes for internal functions **********************/ -static void set_control_clock(unsigned char *params); -static int init_control(struct fb_info_control *p); static void control_set_hardware(struct fb_info_control *p, struct fb_par_control *par); -static int control_of_init(struct device_node *dp); -static void find_vram_size(struct fb_info_control *p); -static int read_control_sense(struct fb_info_control *p); -static int calc_clock_params(unsigned long clk, unsigned char *param); static int control_var_to_par(struct fb_var_screeninfo *var, struct fb_par_control *par, const struct fb_info *fb_info); static inline void control_par_to_var(struct fb_par_control *par, struct fb_var_screeninfo *var); -static void control_init_info(struct fb_info *info, struct fb_info_control *p); -static void control_cleanup(void); /************************** Internal variables *******************************/ @@ -370,77 +362,6 @@ static void set_control_clock(unsigned char *params) #endif } - -/* - * finish off the driver initialization and register - */ -static int __init init_control(struct fb_info_control *p) -{ - int full, sense, vmode, cmode, vyres; - struct fb_var_screeninfo var; - int rc; - - printk(KERN_INFO "controlfb: "); - - full = p->total_vram == 0x400000; - - /* Try to pick a video mode out of NVRAM if we have one. */ - cmode = default_cmode; - if (IS_REACHABLE(CONFIG_NVRAM) && cmode == CMODE_NVRAM) - cmode = nvram_read_byte(NV_CMODE); - if (cmode < CMODE_8 || cmode > CMODE_32) - cmode = CMODE_8; - - vmode = default_vmode; - if (IS_REACHABLE(CONFIG_NVRAM) && vmode == VMODE_NVRAM) - vmode = nvram_read_byte(NV_VMODE); - if (vmode < 1 || vmode > VMODE_MAX || - control_mac_modes[vmode - 1].m[full] < cmode) { - sense = read_control_sense(p); - printk(KERN_CONT "Monitor sense value = 0x%x, ", sense); - vmode = mac_map_monitor_sense(sense); - if (control_mac_modes[vmode - 1].m[full] < 0) - vmode = VMODE_640_480_60; - cmode = min(cmode, control_mac_modes[vmode - 1].m[full]); - } - - /* Initialize info structure */ - control_init_info(&p->info, p); - - /* Setup default var */ - if (mac_vmode_to_var(vmode, cmode, &var) < 0) { - /* This shouldn't happen! */ - printk("mac_vmode_to_var(%d, %d,) failed\n", vmode, cmode); -try_again: - vmode = VMODE_640_480_60; - cmode = CMODE_8; - if (mac_vmode_to_var(vmode, cmode, &var) < 0) { - printk(KERN_ERR "controlfb: mac_vmode_to_var() failed\n"); - return -ENXIO; - } - printk(KERN_INFO "controlfb: "); - } - printk("using video mode %d and color mode %d.\n", vmode, cmode); - - vyres = (p->total_vram - CTRLFB_OFF) / (var.xres << cmode); - if (vyres > var.yres) - var.yres_virtual = vyres; - - /* Apply default var */ - var.activate = FB_ACTIVATE_NOW; - rc = fb_set_var(&p->info, &var); - if (rc && (vmode != VMODE_640_480_60 || cmode != CMODE_8)) - goto try_again; - - /* Register with fbdev layer */ - if (register_framebuffer(&p->info) < 0) - return -ENXIO; - - fb_info(&p->info, "control display adapter\n"); - - return 0; -} - #define RADACAL_WRITE(a,d) \ out_8(&p->cmap_regs->addr, (a)); \ out_8(&p->cmap_regs->dat, (d)) @@ -502,67 +423,6 @@ static void control_set_hardware(struct fb_info_control *p, struct fb_par_contro #endif /* CONFIG_BOOTX_TEXT */ } - -/* - * Parse user specified options (`video=controlfb:') - */ -static void __init control_setup(char *options) -{ - char *this_opt; - - if (!options || !*options) - return; - - while ((this_opt = strsep(&options, ",")) != NULL) { - if (!strncmp(this_opt, "vmode:", 6)) { - int vmode = simple_strtoul(this_opt+6, NULL, 0); - if (vmode > 0 && vmode <= VMODE_MAX && - control_mac_modes[vmode - 1].m[1] >= 0) - default_vmode = vmode; - } else if (!strncmp(this_opt, "cmode:", 6)) { - int depth = simple_strtoul(this_opt+6, NULL, 0); - switch (depth) { - case CMODE_8: - case CMODE_16: - case CMODE_32: - default_cmode = depth; - break; - case 8: - default_cmode = CMODE_8; - break; - case 15: - case 16: - default_cmode = CMODE_16; - break; - case 24: - case 32: - default_cmode = CMODE_32; - break; - } - } - } -} - -static int __init control_init(void) -{ - struct device_node *dp; - char *option = NULL; - int ret = -ENXIO; - - if (fb_get_options("controlfb", &option)) - return -ENODEV; - control_setup(option); - - dp = of_find_node_by_name(NULL, "control"); - if (dp && !control_of_init(dp)) - ret = 0; - of_node_put(dp); - - return ret; -} - -device_initcall(control_init); - /* Work out which banks of VRAM we have installed. */ /* danj: I guess the card just ignores writes to nonexistant VRAM... */ @@ -627,78 +487,6 @@ static void __init find_vram_size(struct fb_info_control *p) (bank1 + bank2) << 1, bank1 << 1, bank2 << 1); } - -/* - * find "control" and initialize - */ -static int __init control_of_init(struct device_node *dp) -{ - struct fb_info_control *p; - struct resource fb_res, reg_res; - - if (control_fb) { - printk(KERN_ERR "controlfb: only one control is supported\n"); - return -ENXIO; - } - - if (of_pci_address_to_resource(dp, 2, &fb_res) || - of_pci_address_to_resource(dp, 1, ®_res)) { - printk(KERN_ERR "can't get 2 addresses for control\n"); - return -ENXIO; - } - p = kzalloc(sizeof(*p), GFP_KERNEL); - if (!p) - return -ENOMEM; - control_fb = p; /* save it for cleanups */ - - /* Map in frame buffer and registers */ - p->fb_orig_base = fb_res.start; - p->fb_orig_size = resource_size(&fb_res); - /* use the big-endian aperture (??) */ - p->frame_buffer_phys = fb_res.start + 0x800000; - p->control_regs_phys = reg_res.start; - p->control_regs_size = resource_size(®_res); - - if (!p->fb_orig_base || - !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { - p->fb_orig_base = 0; - goto error_out; - } - /* map at most 8MB for the frame buffer */ - p->frame_buffer = ioremap_wt(p->frame_buffer_phys, 0x800000); - - if (!p->control_regs_phys || - !request_mem_region(p->control_regs_phys, p->control_regs_size, - "controlfb regs")) { - p->control_regs_phys = 0; - goto error_out; - } - p->control_regs = ioremap(p->control_regs_phys, p->control_regs_size); - - p->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ - if (!request_mem_region(p->cmap_regs_phys, 0x1000, "controlfb cmap")) { - p->cmap_regs_phys = 0; - goto error_out; - } - p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000); - - if (!p->cmap_regs || !p->control_regs || !p->frame_buffer) - goto error_out; - - find_vram_size(p); - if (!p->total_vram) - goto error_out; - - if (init_control(p) < 0) - goto error_out; - - return 0; - -error_out: - control_cleanup(); - return -ENXIO; -} - /* * Get the monitor sense value. * Note that this can be called before calibrate_delay, @@ -1023,6 +811,115 @@ static void __init control_init_info(struct fb_info *info, struct fb_info_contro info->fix.accel = FB_ACCEL_NONE; } +/* + * Parse user specified options (`video=controlfb:') + */ +static void __init control_setup(char *options) +{ + char *this_opt; + + if (!options || !*options) + return; + + while ((this_opt = strsep(&options, ",")) != NULL) { + if (!strncmp(this_opt, "vmode:", 6)) { + int vmode = simple_strtoul(this_opt+6, NULL, 0); + if (vmode > 0 && vmode <= VMODE_MAX && + control_mac_modes[vmode - 1].m[1] >= 0) + default_vmode = vmode; + } else if (!strncmp(this_opt, "cmode:", 6)) { + int depth = simple_strtoul(this_opt+6, NULL, 0); + switch (depth) { + case CMODE_8: + case CMODE_16: + case CMODE_32: + default_cmode = depth; + break; + case 8: + default_cmode = CMODE_8; + break; + case 15: + case 16: + default_cmode = CMODE_16; + break; + case 24: + case 32: + default_cmode = CMODE_32; + break; + } + } + } +} + +/* + * finish off the driver initialization and register + */ +static int __init init_control(struct fb_info_control *p) +{ + int full, sense, vmode, cmode, vyres; + struct fb_var_screeninfo var; + int rc; + + printk(KERN_INFO "controlfb: "); + + full = p->total_vram == 0x400000; + + /* Try to pick a video mode out of NVRAM if we have one. */ + cmode = default_cmode; + if (IS_REACHABLE(CONFIG_NVRAM) && cmode == CMODE_NVRAM) + cmode = nvram_read_byte(NV_CMODE); + if (cmode < CMODE_8 || cmode > CMODE_32) + cmode = CMODE_8; + + vmode = default_vmode; + if (IS_REACHABLE(CONFIG_NVRAM) && vmode == VMODE_NVRAM) + vmode = nvram_read_byte(NV_VMODE); + if (vmode < 1 || vmode > VMODE_MAX || + control_mac_modes[vmode - 1].m[full] < cmode) { + sense = read_control_sense(p); + printk(KERN_CONT "Monitor sense value = 0x%x, ", sense); + vmode = mac_map_monitor_sense(sense); + if (control_mac_modes[vmode - 1].m[full] < 0) + vmode = VMODE_640_480_60; + cmode = min(cmode, control_mac_modes[vmode - 1].m[full]); + } + + /* Initialize info structure */ + control_init_info(&p->info, p); + + /* Setup default var */ + if (mac_vmode_to_var(vmode, cmode, &var) < 0) { + /* This shouldn't happen! */ + printk("mac_vmode_to_var(%d, %d,) failed\n", vmode, cmode); +try_again: + vmode = VMODE_640_480_60; + cmode = CMODE_8; + if (mac_vmode_to_var(vmode, cmode, &var) < 0) { + printk(KERN_ERR "controlfb: mac_vmode_to_var() failed\n"); + return -ENXIO; + } + printk(KERN_INFO "controlfb: "); + } + printk("using video mode %d and color mode %d.\n", vmode, cmode); + + vyres = (p->total_vram - CTRLFB_OFF) / (var.xres << cmode); + if (vyres > var.yres) + var.yres_virtual = vyres; + + /* Apply default var */ + var.activate = FB_ACTIVATE_NOW; + rc = fb_set_var(&p->info, &var); + if (rc && (vmode != VMODE_640_480_60 || cmode != CMODE_8)) + goto try_again; + + /* Register with fbdev layer */ + if (register_framebuffer(&p->info) < 0) + return -ENXIO; + + fb_info(&p->info, "control display adapter\n"); + + return 0; +} static void control_cleanup(void) { @@ -1049,4 +946,93 @@ static void control_cleanup(void) kfree(p); } +/* + * find "control" and initialize + */ +static int __init control_of_init(struct device_node *dp) +{ + struct fb_info_control *p; + struct resource fb_res, reg_res; + + if (control_fb) { + printk(KERN_ERR "controlfb: only one control is supported\n"); + return -ENXIO; + } + + if (of_pci_address_to_resource(dp, 2, &fb_res) || + of_pci_address_to_resource(dp, 1, ®_res)) { + printk(KERN_ERR "can't get 2 addresses for control\n"); + return -ENXIO; + } + p = kzalloc(sizeof(*p), GFP_KERNEL); + if (!p) + return -ENOMEM; + control_fb = p; /* save it for cleanups */ + + /* Map in frame buffer and registers */ + p->fb_orig_base = fb_res.start; + p->fb_orig_size = resource_size(&fb_res); + /* use the big-endian aperture (??) */ + p->frame_buffer_phys = fb_res.start + 0x800000; + p->control_regs_phys = reg_res.start; + p->control_regs_size = resource_size(®_res); + + if (!p->fb_orig_base || + !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { + p->fb_orig_base = 0; + goto error_out; + } + /* map at most 8MB for the frame buffer */ + p->frame_buffer = ioremap_wt(p->frame_buffer_phys, 0x800000); + + if (!p->control_regs_phys || + !request_mem_region(p->control_regs_phys, p->control_regs_size, + "controlfb regs")) { + p->control_regs_phys = 0; + goto error_out; + } + p->control_regs = ioremap(p->control_regs_phys, p->control_regs_size); + + p->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ + if (!request_mem_region(p->cmap_regs_phys, 0x1000, "controlfb cmap")) { + p->cmap_regs_phys = 0; + goto error_out; + } + p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000); + + if (!p->cmap_regs || !p->control_regs || !p->frame_buffer) + goto error_out; + + find_vram_size(p); + if (!p->total_vram) + goto error_out; + + if (init_control(p) < 0) + goto error_out; + + return 0; + +error_out: + control_cleanup(); + return -ENXIO; +} + +static int __init control_init(void) +{ + struct device_node *dp; + char *option = NULL; + int ret = -ENXIO; + if (fb_get_options("controlfb", &option)) + return -ENODEV; + control_setup(option); + + dp = of_find_node_by_name(NULL, "control"); + if (dp && !control_of_init(dp)) + ret = 0; + of_node_put(dp); + + return ret; +} + +device_initcall(control_init); From patchwork Tue Mar 24 13:45:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 11455447 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 B02C117D4 for ; Tue, 24 Mar 2020 13:45:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8158520BED for ; Tue, 24 Mar 2020 13:45:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="bMEEtFEb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728848AbgCXNpW (ORCPT ); Tue, 24 Mar 2020 09:45:22 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40776 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbgCXNpW (ORCPT ); Tue, 24 Mar 2020 09:45:22 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200324134520euoutp0155f1bf66a4ab1c25e89f62fe8157ab45~-QWrT5F6O3230632306euoutp01a for ; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200324134520euoutp0155f1bf66a4ab1c25e89f62fe8157ab45~-QWrT5F6O3230632306euoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585057520; bh=y7WDft73AsF/tlQw5Gfp0YnETKJsrlEpFUULaVFBIVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMEEtFEbU9bobqwVbp4u7asFTm2hvc9RIZ0z27pbYRKR5iw7MPOqO1y+mYegbsg7b 3weqeEqr+Qq0tFjo1rcLGQwFrRjk6IvkTOKp6hMn02R0VYjkQs9lQ4GA96dZAtiZGX H9Ztz4hs2/Qk+HzvF8d373RU4RN0WlHFhGsqGD6U= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200324134520eucas1p2af62a5e61ebb15d644c96ae3eb6c58d2~-QWrBQsUw3230032300eucas1p2B; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 0E.08.60698.0FE0A7E5; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200324134520eucas1p2d95faa6d58939b45765ebca40d137f71~-QWqr5WhD0264102641eucas1p2F; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200324134520eusmtrp1afb9d0198278ce147399a04a57e17c82~-QWqrb9CJ2619426194eusmtrp11; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-68-5e7a0ef0f038 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2E.E6.08375.0FE0A7E5; Tue, 24 Mar 2020 13:45:20 +0000 (GMT) Received: from AMDC3058.digital.local (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200324134519eusmtip29e2fdb78cdf5e55bafde3df6cd79646a~-QWqYK3G_3273332733eusmtip2t; Tue, 24 Mar 2020 13:45:19 +0000 (GMT) From: Bartlomiej Zolnierkiewicz To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Sam Ravnborg , b.zolnierkie@samsung.com Subject: [PATCH v2 6/6] video: fbdev: controlfb: remove function prototypes part #3 Date: Tue, 24 Mar 2020 14:45:08 +0100 Message-Id: <20200324134508.25120-7-b.zolnierkie@samsung.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200324134508.25120-1-b.zolnierkie@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKKsWRmVeSWpSXmKPExsWy7djP87of+KriDN5fUbG4te4cq8XGGetZ La58fc9mcaLvA6vF5V1z2CxW/NzK6MDmcb/7OJPHkmlX2Tz6tqxi9Pi8SS6AJYrLJiU1J7Ms tUjfLoErY8WPtywFJ90rdh05ydLAeNayi5GTQ0LAROLzyjUsILaQwApGieuH7LoYuYDsL4wS P/5uY4NwPjNKLLk1lwWmo2vWGUaIxHJGiZ57F9ngWv7N2sUIUsUmYCUxsX0VmC0ikCCxYvoM MJtZIEXiw5b/TCC2sECoxLNjvWwgNouAqsSSK4/BNvAK2Eq0NTxjgtgmL7H12ydWEJtTwE6i d9ohZogaQYmTM5+wQMyUl2jeOpsZ5AgJgWZ2iRX9t6FOdZFYv6wbapCwxKvjW9ghbBmJ05N7 WCAa1jFK/O14AdW9nVFi+eR/bBBV1hJ3zv0CsjmAVmhKrN+lDxF2lDi6vp0FJCwhwCdx460g xBF8EpO2TWeGCPNKdLQJQVSrSWxYtoENZm3XzpXMELaHxO4JK1kmMCrOQvLOLCTvzELYu4CR eRWjeGppcW56arF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66nwoybowPl5VW6Wh3qmrKmBMT 8030SzNn8Z/X5xwuZIeuu8f5zC/rluMfoxn6T9P+P32dcvgw02FRlwnyt0RURUrdfWSeG55a 2nIwhtdJN237t8Vh7sqWqzSUWIozEg21mIuKEwFFP+sBlQIAAA== X-CMS-MailID: 20200324134520eucas1p2d95faa6d58939b45765ebca40d137f71 X-Msg-Generator: CA X-RootMTR: 20200324134520eucas1p2d95faa6d58939b45765ebca40d137f71 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200324134520eucas1p2d95faa6d58939b45765ebca40d137f71 References: <20200324134508.25120-1-b.zolnierkie@samsung.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Reorder code a bit and then remove no longer needed function prototypes. Acked-by: Sam Ravnborg Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/controlfb.c | 302 +++++++++++++++----------------- 1 file changed, 145 insertions(+), 157 deletions(-) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index c67d37103705..7f8f0081396e 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -141,16 +141,6 @@ struct fb_info_control { #define CNTRL_REG(INFO,REG) (&(((INFO)->control_regs->REG).r)) -/******************** Prototypes for internal functions **********************/ - -static void control_set_hardware(struct fb_info_control *p, - struct fb_par_control *par); -static int control_var_to_par(struct fb_var_screeninfo *var, - struct fb_par_control *par, const struct fb_info *fb_info); -static inline void control_par_to_var(struct fb_par_control *par, - struct fb_var_screeninfo *var); - - /************************** Internal variables *******************************/ static struct fb_info_control *control_fb; @@ -159,153 +149,6 @@ static int default_vmode __initdata = VMODE_NVRAM; static int default_cmode __initdata = CMODE_NVRAM; -/******************** The functions for controlfb_ops ********************/ - -/* - * Checks a var structure - */ -static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info) -{ - struct fb_par_control par; - int err; - - err = control_var_to_par(var, &par, info); - if (err) - return err; - control_par_to_var(&par, var); - - return 0; -} - -/* - * Applies current var to display - */ -static int controlfb_set_par (struct fb_info *info) -{ - struct fb_info_control *p = - container_of(info, struct fb_info_control, info); - struct fb_par_control par; - int err; - - if((err = control_var_to_par(&info->var, &par, info))) { - printk (KERN_ERR "controlfb_set_par: error calling" - " control_var_to_par: %d.\n", err); - return err; - } - - control_set_hardware(p, &par); - - info->fix.visual = (p->par.cmode == CMODE_8) ? - FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; - info->fix.line_length = p->par.pitch; - info->fix.xpanstep = 32 >> p->par.cmode; - info->fix.ypanstep = 1; - - return 0; -} - -/* - * Set screen start address according to var offset values - */ -static inline void set_screen_start(int xoffset, int yoffset, - struct fb_info_control *p) -{ - struct fb_par_control *par = &p->par; - - par->xoffset = xoffset; - par->yoffset = yoffset; - out_le32(CNTRL_REG(p,start_addr), - par->yoffset * par->pitch + (par->xoffset << par->cmode)); -} - - -static int controlfb_pan_display(struct fb_var_screeninfo *var, - struct fb_info *info) -{ - unsigned int xoffset, hstep; - struct fb_info_control *p = - container_of(info, struct fb_info_control, info); - struct fb_par_control *par = &p->par; - - /* - * make sure start addr will be 32-byte aligned - */ - hstep = 0x1f >> par->cmode; - xoffset = (var->xoffset + hstep) & ~hstep; - - if (xoffset+par->xres > par->vxres || - var->yoffset+par->yres > par->vyres) - return -EINVAL; - - set_screen_start(xoffset, var->yoffset, p); - - return 0; -} - - -/* - * Private mmap since we want to have a different caching on the framebuffer - * for controlfb. - * Note there's no locking in here; it's done in fb_mmap() in fbmem.c. - */ -static int controlfb_mmap(struct fb_info *info, - struct vm_area_struct *vma) -{ - unsigned long mmio_pgoff; - unsigned long start; - u32 len; - - start = info->fix.smem_start; - len = info->fix.smem_len; - mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT; - if (vma->vm_pgoff >= mmio_pgoff) { - if (info->var.accel_flags) - return -EINVAL; - vma->vm_pgoff -= mmio_pgoff; - start = info->fix.mmio_start; - len = info->fix.mmio_len; - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - } else { - /* framebuffer */ - vma->vm_page_prot = pgprot_cached_wthru(vma->vm_page_prot); - } - - return vm_iomap_memory(vma, start, len); -} - -static int controlfb_blank(int blank_mode, struct fb_info *info) -{ - struct fb_info_control __maybe_unused *p = - container_of(info, struct fb_info_control, info); - unsigned ctrl; - - ctrl = in_le32(CNTRL_REG(p, ctrl)); - if (blank_mode > 0) - switch (blank_mode) { - case FB_BLANK_VSYNC_SUSPEND: - ctrl &= ~3; - break; - case FB_BLANK_HSYNC_SUSPEND: - ctrl &= ~0x30; - break; - case FB_BLANK_POWERDOWN: - ctrl &= ~0x33; - /* fall through */ - case FB_BLANK_NORMAL: - ctrl |= 0x400; - break; - default: - break; - } - else { - ctrl &= ~0x400; - ctrl |= 0x33; - } - out_le32(CNTRL_REG(p,ctrl), ctrl); - - return 0; -} - static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) { @@ -362,6 +205,20 @@ static void set_control_clock(unsigned char *params) #endif } +/* + * Set screen start address according to var offset values + */ +static inline void set_screen_start(int xoffset, int yoffset, + struct fb_info_control *p) +{ + struct fb_par_control *par = &p->par; + + par->xoffset = xoffset; + par->yoffset = yoffset; + out_le32(CNTRL_REG(p,start_addr), + par->yoffset * par->pitch + (par->xoffset << par->cmode)); +} + #define RADACAL_WRITE(a,d) \ out_8(&p->cmap_regs->addr, (a)); \ out_8(&p->cmap_regs->dat, (d)) @@ -772,6 +629,137 @@ static inline void control_par_to_var(struct fb_par_control *par, var->pixclock >>= par->regvals.clock_params[2]; } +/******************** The functions for controlfb_ops ********************/ + +/* + * Checks a var structure + */ +static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info) +{ + struct fb_par_control par; + int err; + + err = control_var_to_par(var, &par, info); + if (err) + return err; + control_par_to_var(&par, var); + + return 0; +} + +/* + * Applies current var to display + */ +static int controlfb_set_par (struct fb_info *info) +{ + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); + struct fb_par_control par; + int err; + + if((err = control_var_to_par(&info->var, &par, info))) { + printk (KERN_ERR "controlfb_set_par: error calling" + " control_var_to_par: %d.\n", err); + return err; + } + + control_set_hardware(p, &par); + + info->fix.visual = (p->par.cmode == CMODE_8) ? + FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; + info->fix.line_length = p->par.pitch; + info->fix.xpanstep = 32 >> p->par.cmode; + info->fix.ypanstep = 1; + + return 0; +} + +static int controlfb_pan_display(struct fb_var_screeninfo *var, + struct fb_info *info) +{ + unsigned int xoffset, hstep; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); + struct fb_par_control *par = &p->par; + + /* + * make sure start addr will be 32-byte aligned + */ + hstep = 0x1f >> par->cmode; + xoffset = (var->xoffset + hstep) & ~hstep; + + if (xoffset+par->xres > par->vxres || + var->yoffset+par->yres > par->vyres) + return -EINVAL; + + set_screen_start(xoffset, var->yoffset, p); + + return 0; +} + +static int controlfb_blank(int blank_mode, struct fb_info *info) +{ + struct fb_info_control __maybe_unused *p = + container_of(info, struct fb_info_control, info); + unsigned ctrl; + + ctrl = in_le32(CNTRL_REG(p, ctrl)); + if (blank_mode > 0) + switch (blank_mode) { + case FB_BLANK_VSYNC_SUSPEND: + ctrl &= ~3; + break; + case FB_BLANK_HSYNC_SUSPEND: + ctrl &= ~0x30; + break; + case FB_BLANK_POWERDOWN: + ctrl &= ~0x33; + /* fall through */ + case FB_BLANK_NORMAL: + ctrl |= 0x400; + break; + default: + break; + } + else { + ctrl &= ~0x400; + ctrl |= 0x33; + } + out_le32(CNTRL_REG(p,ctrl), ctrl); + + return 0; +} + +/* + * Private mmap since we want to have a different caching on the framebuffer + * for controlfb. + * Note there's no locking in here; it's done in fb_mmap() in fbmem.c. + */ +static int controlfb_mmap(struct fb_info *info, + struct vm_area_struct *vma) +{ + unsigned long mmio_pgoff; + unsigned long start; + u32 len; + + start = info->fix.smem_start; + len = info->fix.smem_len; + mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT; + if (vma->vm_pgoff >= mmio_pgoff) { + if (info->var.accel_flags) + return -EINVAL; + vma->vm_pgoff -= mmio_pgoff; + start = info->fix.mmio_start; + len = info->fix.mmio_len; + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + } else { + /* framebuffer */ + vma->vm_page_prot = pgprot_cached_wthru(vma->vm_page_prot); + } + + return vm_iomap_memory(vma, start, len); +} + static const struct fb_ops controlfb_ops = { .owner = THIS_MODULE, .fb_check_var = controlfb_check_var,