From patchwork Mon Dec 14 08:37:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1415849 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=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=csYiLfyX; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CvZYM0l3fz9sSC for ; Mon, 14 Dec 2020 19:38:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 784CE827F6; Mon, 14 Dec 2020 09:38:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="csYiLfyX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3373C827E3; Mon, 14 Dec 2020 09:38:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (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 A6D05827B2 for ; Mon, 14 Dec 2020 09:38:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x642.google.com with SMTP id g20so21415597ejb.1 for ; Mon, 14 Dec 2020 00:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lvviyf9Obdi3TtNqaL7prXTw6pA05VnryuvBzg4/Wqc=; b=csYiLfyXRC6/mZwTxhKUw2eCQqXFQoHDnV47hw7kxcBfgaUbV2nrbf8a1H12Q/ib03 hkai71F1wpWce5EA5lqk+a15yykzgP6gbJD4x0L+zMK7K4SQbmkMu5m455Tz0Z+sbjIM U8aVMVtR4EuXKH+x6BHf0UbmdMNnrOs3jEtFRdOegTRcqEqyly+WQEJZ/j6oqOxc89Y6 lOAmIDF4qw9UJznp7x4LFsWYkwNPP4eFdV6or9PJxmbRs0HIX1PKv3OSNCsf5P0nJvBX M65vEbu2YAu1apExKlgRvWcw3S0cgnJp41ziHboCV9huhIQOM3x9v9nyq1+U+pJ+8LdC xeDA== 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:mime-version:content-transfer-encoding; bh=lvviyf9Obdi3TtNqaL7prXTw6pA05VnryuvBzg4/Wqc=; b=rpcoOq50ReM4Wtxn1JmaE6I+RC+itzz9QDVm/SZvh/+ggttxsHvNMnvKQSK0ihLsA1 FvMaFxdUvgaN0rYz0KAE8oMh79hCpNuE7aCcy0RzGuas2E/Iq6AF0Rvvh1HrtSuoU9ae 6UtZYp9+GfnPLbnic/DNLCCla5fHCi4gst0g9YUfu9LXfV3c+JimH374zDegeunuVAb/ mYYAkjkfXiHNHvI+VO95qJpZ5BFBbJYf/0kEWtExQe8BANu6gWwmy8wor4FQAH0NITCE Z/N3WmbM+ZJMnvf3SAYErC9VKEM89+MOr1+xz5nZwmq2mY9MhoA0o+csge65aOHKPaGK L6IQ== X-Gm-Message-State: AOAM530DHhnRaBxUDBwHNRrxY3Va660xzQb/cuiWJkVkn98H0h0qq59d nsHBbXaBVLN0Ir/ARYXBtKgAoWb3qaGQb4jg X-Google-Smtp-Source: ABdhPJy/3A2+ksp0m9NMALzg1cOULwVXI+2NN/gm5KXbU0iW8NlNlgzISRAfb8IOFNOvQaRtfzPx7Q== X-Received: by 2002:a17:906:1197:: with SMTP id n23mr21648806eja.359.1607935083077; Mon, 14 Dec 2020 00:38:03 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id m24sm13099580ejo.52.2020.12.14.00.38.02 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Dec 2020 00:38:02 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, vikhyat.goyal@xilinx.com, Simon Glass Cc: Anatolij Gustschin Subject: [PATCH v2 3/5] video: Introduce video_sync operation Date: Mon, 14 Dec 2020 09:37:50 +0100 Message-Id: <04221731ad19461b6a6b9c1a3d84105167aebe47.1607935068.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 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 drivers like LCD connected via SPI requires explicit sync function which copy framebuffer content over SPI to controller to display. This hook doesn't exist yet that's why introduce it via video operations. Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- Changes in v2: - Add support for returning value - Update kernel-doc format to pass kernel-doc script - Update patch subject s/call/operation/ Simon: Please review this. I didn't find existing way how this can be done that's why I am introducing this hook. Also maybe name can be named a little bit differently. That's why waiting for better suggestion. --- drivers/video/video-uclass.c | 9 +++++++++ include/video.h | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 6fc412801714..938e7d371311 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -175,6 +175,15 @@ void video_set_default_colors(struct udevice *dev, bool invert) /* Flush video activity to the caches */ int video_sync(struct udevice *vid, bool force) { + struct video_ops *ops = video_get_ops(vid); + int ret; + + if (ops && ops->video_sync) { + ret = ops->video_sync(vid); + if (ret) + return ret; + } + /* * 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 diff --git a/include/video.h b/include/video.h index 1bfe6843a805..12fc525ab4ef 100644 --- a/include/video.h +++ b/include/video.h @@ -114,8 +114,16 @@ struct video_priv { u8 bg_col_idx; }; -/* Placeholder - there are no video operations at present */ +/** + * struct video_ops - structure for keeping video operations + * @video_sync: Synchronize FB with device. Some device like SPI based LCD + * displays needs synchronization when data in an FB is available. + * For these devices implement video_sync hook to call a sync + * function. vid is pointer to video device udevice. Function + * should return 0 on success video_sync and error code otherwise + */ struct video_ops { + int (*video_sync)(struct udevice *vid); }; #define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops) @@ -155,7 +163,7 @@ int video_clear(struct udevice *dev); * @force: True to force a sync even if there was one recently (this is * very expensive on sandbox) * - * @return: 0 always + * @return: 0 on success, error code otherwise * * Some frame buffers are cached or have a secondary frame buffer. This * function syncs these up so that the current contents of the U-Boot frame