From patchwork Thu Aug 20 15:31:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederik Aalund X-Patchwork-Id: 1348726 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=sbtinstruments.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sbtinstruments.com header.i=@sbtinstruments.com header.a=rsa-sha256 header.s=google header.b=NcIZMLwu; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXhMd4wSBz9sTF for ; Fri, 21 Aug 2020 09:54:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4FF1882365; Fri, 21 Aug 2020 01:54:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sbtinstruments.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sbtinstruments.com header.i=@sbtinstruments.com header.b="NcIZMLwu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8609482360; Thu, 20 Aug 2020 17:32:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x663.google.com (mail-ej1-x663.google.com [IPv6:2a00:1450:4864:20::663]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EA1C182354 for ; Thu, 20 Aug 2020 17:32:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sbtinstruments.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=fpa@sbtinstruments.com Received: by mail-ej1-x663.google.com with SMTP id bo3so2987558ejb.11 for ; Thu, 20 Aug 2020 08:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbtinstruments.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SOMzyziMNDOZYOVCuDPVHoElHZhbjo+Ve6h0ZyQdfgE=; b=NcIZMLwu1aWEXoWqMi2dgWuJfUlb8vFODmDyqEhPWC0WRNbzsZqSyDhQpGGTRekngT 0W6b1tW342x7O5dU9YSlhfNfU7d/5vc0hzP0yXOfRV6HbXuQLIjAmdq8NVGcJJ6EcT6w yN3dhp0DMI6ZgkrnxfJHyHuzSMoxhVA6+cwvO4K5zZJCcfivLhdQeaJ8F6LKUA4ko/+Z NGOVcmIg38wv7t+e/81JlJCaUyQFzTY9wO7EBr2Aloun1bqMth/gamGgh9noBI4oWSNX pukD+3gdCB9fq8/v+HVfdl+sK+bYY/cuU6lJBuqPh/vwish+K+Cd0ys6Fg0g3ACqrLcx Fktw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SOMzyziMNDOZYOVCuDPVHoElHZhbjo+Ve6h0ZyQdfgE=; b=oRXPHm8iVvyt/fv6WPUQGbcQ79H0cL9V95A+YXp9RffKG/b3h1+BmdiHu6/cmaH0dV eWLKqQEItXqwNI0v07ENT6UOdvok3fTpUVv7AncIZt4yCoEIYBmfHxc4DwANDCzY/88p ft47aq1+8nmhVpIyO70Yuo/j54aj0xPkXrKBHC/7VZoIs35qYPFDK7GY34qJwqFYC8me S4Kkxvkx/X0p8rVWH6Mie3atuiJud3DhVVDPDwJxg3sS/A0Q4ry2REKqhjuDy1N6k+9w xFzvXsu/J0pjrENR0lDKN/DFq70Egd89ekRmqgLvrnkdVagtn7Q7S3TBFfcpoFhDSEUX 2lsg== X-Gm-Message-State: AOAM533NNt4+YgpSyCmhHdxSH9jsBEnaoUA5yVVeMCdQb2VBRWzQs4fN D3+lp4Svl+rIZPj0rf3uqz+xRwbP0oETUOvx4NOAi3/9DP+kTA== X-Google-Smtp-Source: ABdhPJw9RLBzMJwrisD+u65+Q8FhTX14HqTpOrwMjXAkvKQV/PU7QPOMbOFP4D/K2HC704jWj24YEizppwi0 X-Received: by 2002:a17:906:2b44:: with SMTP id b4mr3766650ejg.406.1597937549394; Thu, 20 Aug 2020 08:32:29 -0700 (PDT) Received: from sbt-fpa-desktop1-ubuntu.lan ([62.242.179.138]) by smtp-relay.gmail.com with ESMTPS id j7sm29743ejm.133.2020.08.20.08.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 08:32:29 -0700 (PDT) X-Relaying-Domain: sbtinstruments.com From: Frederik Aalund To: u-boot@lists.denx.de Cc: Frederik Aalund , agust@denx.de Subject: [PATCH] video: Add copy_fb_to_hw op Date: Thu, 20 Aug 2020 17:31:49 +0200 Message-Id: <20200820153149.1732198-1-fpa@sbtinstruments.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 21 Aug 2020 01:54:23 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Some devices have their own framebuffer memory that is not shared directly with the CPU. For said devices, we need to copy U-boot's framebuffer (priv->fb) to the device's own framebuffer memory. E.g., via SPI. To support these devices, I've added the copy_fb_to_hw op. It's optional, so existing drivers do not need to define this op. I've used this new op to add support for the SSD2119 display panel driver over 4-wire SPI. I'll add this video driver in a subsequent patch. Signed-off-by: Frederik Aalund Cc: agust@denx.de --- drivers/video/video-uclass.c | 14 ++++++++++++++ include/video.h | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 12057c8a5b..6921f1ec2b 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -147,6 +147,8 @@ void video_set_default_colors(struct udevice *dev, bool invert) /* Flush video activity to the caches */ void video_sync(struct udevice *vid, bool force) { + int ret; + struct video_ops *ops = video_get_ops(vid); /* * flush_dcache_range() is declared in common.h but it seems that some * architectures do not actually implement it. Is there a way to find @@ -169,6 +171,18 @@ void video_sync(struct udevice *vid, bool force) last_sync = get_timer(0); } #endif + /* + * Some devices have their own framebuffer memory that is not + * shared directly with the CPU. For said devices, we need to + * copy U-boot's framebuffer (priv->fb) to the device's own + * framebuffer memory. E.g., via SPI. + */ + if (ops->copy_fb_to_hw) { + ret = ops->copy_fb_to_hw(vid); + if (ret) { + dev_err(vid, "Could not copy frame buffer to hardware: %d\n", ret); + } + } } void video_sync_all(void) diff --git a/include/video.h b/include/video.h index 485071d072..a72807e3cb 100644 --- a/include/video.h +++ b/include/video.h @@ -96,8 +96,14 @@ struct video_priv { u8 bg_col_idx; }; -/* Placeholder - there are no video operations at present */ struct video_ops { + /** + * copy_fb_to_hw() - Copy the current frame buffer to the hardware + * + * @dev: Video device + * @return 0 if OK, -ve on error + */ + int (*copy_fb_to_hw)(struct udevice *dev); }; #define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops)