From patchwork Wed Apr 5 22:23:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 747555 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3vz0xq1snKz9s9Y for ; Thu, 6 Apr 2017 08:34:07 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="JrPPd02i"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id 04FC8C21CAD; Wed, 5 Apr 2017 22:28:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A4138C21C91; Wed, 5 Apr 2017 22:25:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9CCA8C21C40; Wed, 5 Apr 2017 22:24:06 +0000 (UTC) Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by lists.denx.de (Postfix) with ESMTPS id 0687AC21C9D for ; Wed, 5 Apr 2017 22:24:03 +0000 (UTC) Received: by mail-oi0-f50.google.com with SMTP id r203so32361355oib.3 for ; Wed, 05 Apr 2017 15:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=zzecqa1iMCDncyCrnQYW9udqDhx/YVfqVai/nityC3I=; b=JrPPd02iROS4u7Ift02abMR5I9qkufAOF+CN/DrliG+8ZdJRf0XWpCEDGbwJkdUhWh kFDOt+ah4zu8wT85WIHDeY3rvsp6vIBjsU9p8djzFhENpKgnoaHcNlaLGg/7wSXdTXfz iWw7HqyLvKQAmg2cjwXI0KqDgsITh3nPQTbuTCQv0l2BjXA9t5Dkluk+JpFfkBkOrqOH Mfzv1ULnfNtvJ9XNQznaltNaJBhLBH4R/mMXekxGCoKvEtRRzhvBuqfA12FivpWvlkgs eQDaMCEJphtbenFXiB6QYU6WbD3T8rNjgLVW93GK5kLbwOrTlXGJ6hMj5yjWaC9T3jfd 7Gsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=zzecqa1iMCDncyCrnQYW9udqDhx/YVfqVai/nityC3I=; b=EKdAKgjGc3b5yGTHigmTDQuNnYcqdLwbpDWBM2HPB/ITWP65luJoAQofP4+86oy0rY SdptILYtZTpIKva9FeOZP0Xl+mmshFdfRhOZQ9ZpHf2EnSs7LLI6xkEZhqbLRsPeTWo2 /Mqm2Waf1Io83Wp7isIx9GDmvqxrrHXV8uTc91wuUvk2pJSjY29okKrhiGLO00ayJp4a S5FafogfcTTaTwijBiw0PrbCLsCJK0lWRfGLeghX6UV7dnigmG5hAA5LutraqNErVrbi lPUSJEIspVIEn6JdoBiFGjjZl/Mh3MsAyYMIY00ukD4mExUcnizD4a0HirzrOEuLPoyB YGxA== X-Gm-Message-State: AFeK/H044bsI9rNwrJu0HuU4nlsoolq1qEWd1Ymiw4FVr+nNEBy+wGzbHt09MbFmd/0M1lS1 X-Received: by 10.202.80.138 with SMTP id e132mr16698354oib.118.1491431041643; Wed, 05 Apr 2017 15:24:01 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:11:9091:72b:3bf5:c451]) by smtp.gmail.com with ESMTPSA id n58sm341836otd.43.2017.04.05.15.24.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 15:24:01 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 717DF40519; Wed, 5 Apr 2017 16:24:00 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 5 Apr 2017 16:23:40 -0600 Message-Id: <20170405222345.32288-14-sjg@chromium.org> X-Mailer: git-send-email 2.12.2.715.g7642488e1d-goog In-Reply-To: <20170405222345.32288-1-sjg@chromium.org> References: <20170405222345.32288-1-sjg@chromium.org> Cc: Stephen Warren , Joe Hershberger Subject: [U-Boot] [PATCH v6 13/18] video: arm: rpi: Move the video query out of the driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add a function to get the video size to the msg handler and remove it from the video driver. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None arch/arm/mach-bcm283x/include/mach/msg.h | 9 +++++++++ arch/arm/mach-bcm283x/msg.c | 26 ++++++++++++++++++++++++++ drivers/video/bcm2835.c | 20 +++----------------- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/arch/arm/mach-bcm283x/include/mach/msg.h b/arch/arm/mach-bcm283x/include/mach/msg.h index 8fd4ace124..c785c43a67 100644 --- a/arch/arm/mach-bcm283x/include/mach/msg.h +++ b/arch/arm/mach-bcm283x/include/mach/msg.h @@ -22,4 +22,13 @@ int bcm2835_power_on_module(u32 module); */ int bcm2835_get_mmc_clock(void); +/** + * bcm2835_get_video_size() - get the current display size + * + * @widthp: Returns the width in pixels + * @heightp: Returns the height in pixels + * @return 0 if OK, -ve on error + */ +int bcm2835_get_video_size(int *widthp, int *heightp); + #endif diff --git a/arch/arm/mach-bcm283x/msg.c b/arch/arm/mach-bcm283x/msg.c index facb916711..17266c01a6 100644 --- a/arch/arm/mach-bcm283x/msg.c +++ b/arch/arm/mach-bcm283x/msg.c @@ -6,6 +6,7 @@ #include #include +#include #include struct msg_set_power_state { @@ -20,6 +21,12 @@ struct msg_get_clock_rate { u32 end_tag; }; +struct msg_query { + struct bcm2835_mbox_hdr hdr; + struct bcm2835_mbox_tag_physical_w_h physical_w_h; + u32 end_tag; +}; + int bcm2835_power_on_module(u32 module) { ALLOC_CACHE_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1); @@ -65,3 +72,22 @@ int bcm2835_get_mmc_clock(void) return msg_clk->get_clock_rate.body.resp.rate_hz; } + +int bcm2835_get_video_size(int *widthp, int *heightp) +{ + ALLOC_CACHE_ALIGN_BUFFER(struct msg_query, msg_query, 1); + int ret; + + BCM2835_MBOX_INIT_HDR(msg_query); + BCM2835_MBOX_INIT_TAG_NO_REQ(&msg_query->physical_w_h, + GET_PHYSICAL_W_H); + ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_query->hdr); + if (ret) { + printf("bcm2835: Could not query display resolution\n"); + return ret; + } + *widthp = msg_query->physical_w_h.body.resp.width; + *heightp = msg_query->physical_w_h.body.resp.height; + + return 0; +} diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c index cc6454f10d..eb137be11c 100644 --- a/drivers/video/bcm2835.c +++ b/drivers/video/bcm2835.c @@ -9,6 +9,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -18,12 +19,6 @@ vidinfo_t panel_info; static u32 bcm2835_pitch; -struct msg_query { - struct bcm2835_mbox_hdr hdr; - struct bcm2835_mbox_tag_physical_w_h physical_w_h; - u32 end_tag; -}; - struct msg_setup { struct bcm2835_mbox_hdr hdr; struct bcm2835_mbox_tag_physical_w_h physical_w_h; @@ -40,27 +35,18 @@ struct msg_setup { void lcd_ctrl_init(void *lcdbase) { - ALLOC_CACHE_ALIGN_BUFFER(struct msg_query, msg_query, 1); ALLOC_CACHE_ALIGN_BUFFER(struct msg_setup, msg_setup, 1); int ret; - u32 w, h; + int w, h; u32 fb_start, fb_end; debug("bcm2835: Query resolution...\n"); - - BCM2835_MBOX_INIT_HDR(msg_query); - BCM2835_MBOX_INIT_TAG_NO_REQ(&msg_query->physical_w_h, - GET_PHYSICAL_W_H); - ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_query->hdr); + ret = bcm2835_get_video_size(&w, &h); if (ret) { - printf("bcm2835: Could not query display resolution\n"); /* FIXME: How to disable the LCD to prevent errors? hang()? */ return; } - w = msg_query->physical_w_h.body.resp.width; - h = msg_query->physical_w_h.body.resp.height; - debug("bcm2835: Setting up display for %d x %d\n", w, h); BCM2835_MBOX_INIT_HDR(msg_setup);