From patchwork Thu Dec 3 09:12:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1410209 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=sPSNVt7I; 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 4CmqrZ5wCPz9sPB for ; Thu, 3 Dec 2020 20:13:34 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3FCA8825C6; Thu, 3 Dec 2020 10:13:13 +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="sPSNVt7I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E20D0825D5; Thu, 3 Dec 2020 10:13:10 +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-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) (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 67AB5825D5 for ; Thu, 3 Dec 2020 10:13:08 +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-x644.google.com with SMTP id jx16so2324799ejb.10 for ; Thu, 03 Dec 2020 01:13:08 -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=bSSGRF3xxXFkygxd9f6i0IgqliTlrNZBWhEpaJRIWhU=; b=sPSNVt7Ig0PuTKo8Wg9b6sIHipinBIiAymhGHtAFX1sQohyVmjMMSAz4Jj0Jr9uxcw hCKNpppWoGHDhT0T+kOwTf+uPpuy/p7F4950H9GFAcO2+528CrsJC5VdTeJMSJNwQXfd Oy35/rcNLX2SIfeo4iHid+3pXEGq4xsAZTDK812IC4qt9NfnNsH/kNvk0EzapWbBQnDe vrVbWwVLB42ZcdGtnGQR+bzpIFr2dy7VP+WDbzkCtoxyl/cgSjh2zDMKSyuqnn9Nt5CZ 5hPfYKhtyXKZGt6AlZwzDBTVfd4W5f85j/19w7VUFKf9tAQqabns47FelzhxsZqY/ab8 d0Lw== 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=bSSGRF3xxXFkygxd9f6i0IgqliTlrNZBWhEpaJRIWhU=; b=GMtEECAuN/xzpKxMFYmnWdMokAUk6OC4zaRcCjG//29KqhgfYYyPOgSaR9ETcLso8s nItGuUzhInYSGxmofCAqHUV+zxYJaZ9IhGHdMzwTDNkGB9pDFWmSfoTMStDYGbuJdXF0 yda4R+AyyN0EEbsin6ETqYTbN1h2hzG86Qnl2fHGmiIemDYonsHfcW1Xbi4SJRrd5fNb 1oUlGLKGHn/uwCgY9+ZMddLMLLaqeBylmu9kytt5SnncGcenvT27YJdX/kN6k3S1MLEt 64L6OUlxXU3OD90wfgmnNL4KpwWTCcF6I0uDapFQRE0lco7jHdEwPzc10kgVDwk2PmqM /wHw== X-Gm-Message-State: AOAM533m361KFrxhzaf7e3YrCIU5MiVur2xt/GHhitGe6HCrRYBvu1bI gEEiAjX4FDLBQ+nXa+s4bYTpz4rBBhL/DuBm X-Google-Smtp-Source: ABdhPJyTENmK+BumDdF4ippXfc9d5RiZJdVdtk5NrhddZIZ6etW6JCIV8EgSemXgVMR3ukuq6vLh0A== X-Received: by 2002:a17:907:373:: with SMTP id rs19mr163392ejb.298.1606986787706; Thu, 03 Dec 2020 01:13:07 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id ld3sm379955ejb.112.2020.12.03.01.13.06 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Dec 2020 01:13:07 -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 1/3] video: Introduce video_sync call Date: Thu, 3 Dec 2020 10:12:59 +0100 Message-Id: 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 --- 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 | 5 +++++ include/video.h | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 650891e49dd0..ba52a6c7125b 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -174,6 +174,11 @@ void video_set_default_colors(struct udevice *dev, bool invert) /* Flush video activity to the caches */ void video_sync(struct udevice *vid, bool force) { + struct video_ops *ops = video_get_ops(vid); + + if (ops && ops->video_sync) + (void)ops->video_sync(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 diff --git a/include/video.h b/include/video.h index 9d09d2409af6..acac3f6b3c8d 100644 --- a/include/video.h +++ b/include/video.h @@ -115,7 +115,20 @@ struct video_priv { }; /* Placeholder - there are no video operations at present */ +/** + * struct video_ops - structure for keeping video operations + */ struct video_ops { + /** + * 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: Video device udevice structure + */ + int (*video_sync)(struct udevice *vid); }; #define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops) From patchwork Thu Dec 3 09:13:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1410210 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=85.214.62.61; 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=2QSyggSV; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4Cmqrh3Cn6z9sRK for ; Thu, 3 Dec 2020 20:13:40 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 54E7982758; Thu, 3 Dec 2020 10:13:15 +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="2QSyggSV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2866682744; Thu, 3 Dec 2020 10:13:13 +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-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) (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 2AEC2825C6 for ; Thu, 3 Dec 2020 10:13:10 +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-x644.google.com with SMTP id x16so2348203ejj.7 for ; Thu, 03 Dec 2020 01:13:10 -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=D8sdbIF0bAVPiTgp4XD0x753G4d6RxcUXctVxEi1V9Y=; b=2QSyggSVzQgO0s4Cyq1nDoUMw3h9+z0JcO06G1FZPoiy1Dx3SLYr5MIZrHmdiJaIhB FubE7kzXlbgEO2XV9MQSlMpLPKFGmV4O0zDshnhHj/XiMYb2uZtltmqXD18+slGmUDoY +s1w7YvN9FI3h8DvV5GOIXv/z7kjP+Z03jyka0Z51do+pmJJRMJ5M0WyY91D4NRu/o17 J+7i+FfVZHkjZ46FcCiNkXh+bJaS6pwO6/13PR6DHzmpuB1czgyBjAR1EAWWzalNy7nv TKkuFXbvUzlSUISZevhdIsbYEX1KJRtak00nrgtnYvLxMfF5OLJ7DWM2lNEcRW0cbCgg euHQ== 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=D8sdbIF0bAVPiTgp4XD0x753G4d6RxcUXctVxEi1V9Y=; b=DLs7nFwARy33j1+MagIqW7Ui5z5DHEg/+u1TDn00rJcSIOy8eKtL31c7JQkJ2AU2kv xYoNMkNK5CGeeAWMTslGM8Xzi1y9g5xsQii6H8xEObjm0IhUAs8MWnAVuxspmZ4ttqI+ Y+GAEy02rRkkNebHBiz6Wk3b2qWcEtXbaBFnmd03tYDwQc54e0E8ykNrrplfZvvODn/w OqhpDvOVI/mhCN5QKVrcDBp7j7QAve2Lc2jX/CX+a98tKUehC8mbkBDsxRuZgX8nXFSE eX4WKXMxilG3GFw92ezptncK9HSZmSRa8eRqumC5RslMQ49NpS4Fz6UdhRyMeIVRR8VZ uzSg== X-Gm-Message-State: AOAM533dM7AeVHG4mSwR4u/567Rq1H+zKLW4RbD/ObNilD+XCyxXa/1R WJi8g6Ks3djNNWCT1fx+qcEVWn8OQszPQRvP X-Google-Smtp-Source: ABdhPJxe6eDlVktJC6QqGFhnTmO6m68UeGjQFVWC8SSzLebn0fQ2ZSirhuryEaAOiLUSUzWj/VvgjQ== X-Received: by 2002:a17:906:38c8:: with SMTP id r8mr1673703ejd.39.1606986789567; Thu, 03 Dec 2020 01:13:09 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id op24sm385687ejb.56.2020.12.03.01.13.08 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Dec 2020 01:13:08 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, vikhyat.goyal@xilinx.com, Simon Glass Cc: Alex Nemirovsky , Anastasiia Lukianenko , Anatolij Gustschin , Andre Przywara , Heinrich Schuchardt , Lokesh Vutla , Masahiro Yamada , Michal Simek , Rayagonda Kokatanur , Robert Marko , Sam Protsenko , Sean Anderson , Stefan Bosch Subject: [PATCH 2/3] video: seps525: Add dt binding description Date: Thu, 3 Dec 2020 10:13:00 +0100 Message-Id: <928720035e1c68f2a70e56aec2f089cc243e9279.1606986778.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 From: Vikhyat Goyal Added dt binding for seps525 display driver. Signed-off-by: Vikhyat Goyal Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- MAINTAINERS | 1 + .../video/syncoam,seps525.txt | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 doc/device-tree-bindings/video/syncoam,seps525.txt diff --git a/MAINTAINERS b/MAINTAINERS index 874cf2c0e576..2f908843da72 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -547,6 +547,7 @@ S: Maintained T: git https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze.git F: arch/arm/mach-zynq/ F: doc/board/xilinx/ +F: doc/device-tree-bindings/video/syncoam,seps525.txt F: drivers/clk/clk_zynq.c F: drivers/fpga/zynqpl.c F: drivers/gpio/zynq_gpio.c diff --git a/doc/device-tree-bindings/video/syncoam,seps525.txt b/doc/device-tree-bindings/video/syncoam,seps525.txt new file mode 100644 index 000000000000..e1e0db9d71fb --- /dev/null +++ b/doc/device-tree-bindings/video/syncoam,seps525.txt @@ -0,0 +1,24 @@ +spi based seps525 framebuffer display driver + +Driver for seps525 display controller (in spi mode), This binding supports selection +of spi chipselect, spi max frequency, gpio to drive dc and reset pin of seps525 +controller and spi transaction bit length. + +Required properties: +- compatible: "syncoam,seps525" +- reg: Specifies the chip-select the seps525 is connected to on the spi bus +- reset-gpios: gpio connected to reset pin of seps525 controller. +- dc-gpios: gpio connected to dc pin of seps525 controller: +- buswidth: bitlength of each spi transaction + +Example: + displayspi@0 { + compatible = "syncoam,seps525"; + reg = <0>; + spi-max-frequency = <10000000>; + spi-cpol; + spi-cpha; + buswidth = <8>; + reset-gpios = <&gpio 0x1c GPIO_ACTIVE_LOW>; + dc-gpios = <&gpio 0x1b GPIO_ACTIVE_HIGH>; + }; From patchwork Thu Dec 3 09:13:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1410211 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=TTxNicsH; 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 4Cmqrt2lGrz9sPB for ; Thu, 3 Dec 2020 20:13:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 01F4882773; Thu, 3 Dec 2020 10:13:18 +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="TTxNicsH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A9B8382769; Thu, 3 Dec 2020 10:13:16 +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-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) (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 5BF2C8271E for ; Thu, 3 Dec 2020 10:13:12 +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-ed1-x542.google.com with SMTP id cm17so1308808edb.4 for ; Thu, 03 Dec 2020 01:13:12 -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=RUMIlUUB9zvUHvzC+hrL/mU+JaYGq7zPBpqM2pvsDQw=; b=TTxNicsHo3WU393kVbevXz/FbLwws8PNzdHUnUfe+08O14r/XjMOaX50izOyuqiI+F Y2rVxEPUsJZO9w33WFQR9FMBFEShKWWe9a7lBbOETiEw7Zl71U5RfWyEn+YNjGP+tLFU N5L8p8UhcNQX6sMhCUJ4BcAUa4RUrfHEw/HI4Q8mr/ir9k8OEmFXqDidD8QtIZYa6bGi ReEffBuEHcpVEJXZQtbiEZgOXo55qN13jHxC1xM5kAlOEPpD/tdvAkJiUYpbrqe8oNON aDj6zECysrWac5jvD4psmbNWQH6H0A76VBO6KT1muhjtRMpUINLkhWYCLheH5jMUS/po egxg== 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=RUMIlUUB9zvUHvzC+hrL/mU+JaYGq7zPBpqM2pvsDQw=; b=t0MsrMQg/2PujNB/mEbFYmZePYDJCSQ928FhBVWtHsffPeMa+n4WbRyVyhDufPfRnw rTysc6M79CxRqk6aTintLUczrt4R4nM7TqUc4eey5Rm+SqAHSm1FOMyFpdEmRlpxgBsE i6DxuERsOB4Hsc1QCNS6qqLoch0cV71GWYpOt7jYnnthmtRPbDweuqK4d8lxT9rqJZAS 8HghdpxrgRxMs0eT+hRC5hWiZsKIsjEysP7/LKdIMBW62QHal82OiRJkZN+h5CI1L49D PJkx9/kSUiJAo6H766YmrklxcrRmne9z7SDGZznflLWg1eDPVRs9b06iY9I6hDcs6X+r dk+g== X-Gm-Message-State: AOAM531zh2i+Jppswto3wLBc5jhJJWZC05CIzoREvRtBo0tr/5UXMQ62 vmkxx79eisTMzv19ZgjPjE5yFnrPH6Tswn3C X-Google-Smtp-Source: ABdhPJz+D/qfexCjfg9ASt/17pWdLCmeSfOe/5K61514O8sPWoK4AmITFL3a2/ji1kQ71pfEckki5Q== X-Received: by 2002:a50:8004:: with SMTP id 4mr1893321eda.329.1606986791389; Thu, 03 Dec 2020 01:13:11 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id k17sm384240ejh.103.2020.12.03.01.13.10 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Dec 2020 01:13:10 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, vikhyat.goyal@xilinx.com, Simon Glass Cc: Alex Nemirovsky , Anastasiia Lukianenko , Anatolij Gustschin , Andre Przywara , Christophe Leroy , Heinrich Schuchardt , Lokesh Vutla , Masahiro Yamada , Rayagonda Kokatanur , Robert Marko , Sam Protsenko , Sean Anderson , Stefan Bosch Subject: [PATCH 3/3] video: seps525: Add seps525 SPI driver Date: Thu, 3 Dec 2020 10:13:01 +0100 Message-Id: <28cbf7bfdc6bfcb95bb31563c8e136ccfb51b0b2.1606986778.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 Add support for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display using the SEPS525 (Syncoam) LCD Controller. Syncoam Seps525 PM-Oled is RGB 160x128 display. This driver has been tested through zynq-spi driver. ZynqMP> load mmc 1 100000 rainbow.bmp 61562 bytes read in 20 ms (2.9 MiB/s) ZynqMP> bmp info 100000 Image size : 160 x 128 Bits per pixel: 24 Compression : 0 ZynqMP> bmp display 100000 ZynqMP> setenv stdout vidconsole Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- MAINTAINERS | 1 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/seps525.c | 327 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+) create mode 100644 drivers/video/seps525.c diff --git a/MAINTAINERS b/MAINTAINERS index 2f908843da72..178a43f2b46e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -589,6 +589,7 @@ F: drivers/spi/zynq_qspi.c F: drivers/spi/zynq_spi.c F: drivers/timer/cadence-ttc.c F: drivers/usb/host/ehci-zynq.c +F: drivers/video/seps525.c F: drivers/watchdog/cdns_wdt.c F: include/zynqmppl.h F: include/zynqmp_firmware.h diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 998271b9b628..b354709890b6 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -979,4 +979,10 @@ config VIDEO_VCXK This enables VCXK driver which can be used with VC2K, VC4K and VC8K devices on various boards from BuS Elektronik GmbH. +config SEPS525 + bool "SEPS525" + help + Enable support for the Syncoam PM-OLED display driver (RGB 160x128). + Currently driver is supporting only SPI interface. + endmenu diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 67a492a2d60d..6e4e35c58de7 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa.o +obj-$(CONFIG_SEPS525) += seps525.o obj-y += bridge/ obj-y += sunxi/ diff --git a/drivers/video/seps525.c b/drivers/video/seps525.c new file mode 100644 index 000000000000..b4b99b61fb2f --- /dev/null +++ b/drivers/video/seps525.c @@ -0,0 +1,327 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * FB driver for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display + * using the SEPS525 (Syncoam) LCD Controller + * + * Copyright (C) 2020 Xilinx Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define WIDTH 160 +#define HEIGHT 128 + +#define SEPS525_INDEX 0x00 +#define SEPS525_STATUS_RD 0x01 +#define SEPS525_OSC_CTL 0x02 +#define SEPS525_IREF 0x80 +#define SEPS525_CLOCK_DIV 0x03 +#define SEPS525_REDUCE_CURRENT 0x04 +#define SEPS525_SOFT_RST 0x05 +#define SEPS525_DISP_ONOFF 0x06 +#define SEPS525_PRECHARGE_TIME_R 0x08 +#define SEPS525_PRECHARGE_TIME_G 0x09 +#define SEPS525_PRECHARGE_TIME_B 0x0A +#define SEPS525_PRECHARGE_CURRENT_R 0x0B +#define SEPS525_PRECHARGE_CURRENT_G 0x0C +#define SEPS525_PRECHARGE_CURRENT_B 0x0D +#define SEPS525_DRIVING_CURRENT_R 0x10 +#define SEPS525_DRIVING_CURRENT_G 0x11 +#define SEPS525_DRIVING_CURRENT_B 0x12 +#define SEPS525_DISPLAYMODE_SET 0x13 +#define SEPS525_RGBIF 0x14 +#define SEPS525_RGB_POL 0x15 +#define SEPS525_MEMORY_WRITEMODE 0x16 +#define SEPS525_MX1_ADDR 0x17 +#define SEPS525_MX2_ADDR 0x18 +#define SEPS525_MY1_ADDR 0x19 +#define SEPS525_MY2_ADDR 0x1A +#define SEPS525_MEMORY_ACCESS_POINTER_X 0x20 +#define SEPS525_MEMORY_ACCESS_POINTER_Y 0x21 +#define SEPS525_DDRAM_DATA_ACCESS_PORT 0x22 +#define SEPS525_GRAY_SCALE_TABLE_INDEX 0x50 +#define SEPS525_GRAY_SCALE_TABLE_DATA 0x51 +#define SEPS525_DUTY 0x28 +#define SEPS525_DSL 0x29 +#define SEPS525_D1_DDRAM_FAC 0x2E +#define SEPS525_D1_DDRAM_FAR 0x2F +#define SEPS525_D2_DDRAM_SAC 0x31 +#define SEPS525_D2_DDRAM_SAR 0x32 +#define SEPS525_SCR1_FX1 0x33 +#define SEPS525_SCR1_FX2 0x34 +#define SEPS525_SCR1_FY1 0x35 +#define SEPS525_SCR1_FY2 0x36 +#define SEPS525_SCR2_SX1 0x37 +#define SEPS525_SCR2_SX2 0x38 +#define SEPS525_SCR2_SY1 0x39 +#define SEPS525_SCR2_SY2 0x3A +#define SEPS525_SCREEN_SAVER_CONTEROL 0x3B +#define SEPS525_SS_SLEEP_TIMER 0x3C +#define SEPS525_SCREEN_SAVER_MODE 0x3D +#define SEPS525_SS_SCR1_FU 0x3E +#define SEPS525_SS_SCR1_MXY 0x3F +#define SEPS525_SS_SCR2_FU 0x40 +#define SEPS525_SS_SCR2_MXY 0x41 +#define SEPS525_MOVING_DIRECTION 0x42 +#define SEPS525_SS_SCR2_SX1 0x47 +#define SEPS525_SS_SCR2_SX2 0x48 +#define SEPS525_SS_SCR2_SY1 0x49 +#define SEPS525_SS_SCR2_SY2 0x4A + +/* SEPS525_DISPLAYMODE_SET */ +#define MODE_SWAP_BGR BIT(7) +#define MODE_SM BIT(6) +#define MODE_RD BIT(5) +#define MODE_CD BIT(4) + +struct seps525_priv { + struct gpio_desc reset_gpio; + struct gpio_desc dc_gpio; + struct udevice *dev; +}; + +static int seps525_spi_write_cmd(struct udevice *dev, u8 reg) +{ + struct seps525_priv *priv = dev_get_priv(dev); + unsigned long flags = SPI_XFER_BEGIN; + u8 buf8 = reg; + int ret; + + ret = dm_gpio_set_value(&priv->dc_gpio, 0); + if (ret) { + dev_dbg(dev, "Failed to handle dc\n"); + return ret; + } + + flags |= SPI_XFER_END; + + ret = dm_spi_xfer(dev, 8, &buf8, NULL, flags); + if (ret) + dev_dbg(dev, "Failed to write command\n"); + + return ret; +} + +static int seps525_spi_write_data(struct udevice *dev, u8 val) +{ + struct seps525_priv *priv = dev_get_priv(dev); + unsigned long flags = SPI_XFER_BEGIN; + u8 buf8 = val; + int ret; + + ret = dm_gpio_set_value(&priv->dc_gpio, 1); + if (ret) { + dev_dbg(dev, "Failed to handle dc\n"); + return ret; + } + + flags |= SPI_XFER_END; + + ret = dm_spi_xfer(dev, 8, &buf8, NULL, flags); + if (ret) + dev_dbg(dev, "Failed to write data\n"); + + return ret; +} + +static void seps525_spi_write(struct udevice *dev, u8 reg, u8 val) +{ + (void)seps525_spi_write_cmd(dev, reg); + (void)seps525_spi_write_data(dev, val); +} + +static int seps525_display_init(struct udevice *dev) +{ + /* Disable Oscillator Power Down */ + seps525_spi_write(dev, SEPS525_REDUCE_CURRENT, 0x03); + mdelay(5); + + /* Set Normal Driving Current */ + seps525_spi_write(dev, SEPS525_REDUCE_CURRENT, 0x00); + mdelay(5); + + seps525_spi_write(dev, SEPS525_SCREEN_SAVER_CONTEROL, 0x00); + /* Set EXPORT1 Pin at Internal Clock */ + seps525_spi_write(dev, SEPS525_OSC_CTL, 0x01); + /* Set Clock as 120 Frames/Sec */ + seps525_spi_write(dev, SEPS525_CLOCK_DIV, 0x90); + /* Set Reference Voltage Controlled by External Resister */ + seps525_spi_write(dev, SEPS525_IREF, 0x01); + + /* precharge time R G B */ + seps525_spi_write(dev, SEPS525_PRECHARGE_TIME_R, 0x04); + seps525_spi_write(dev, SEPS525_PRECHARGE_TIME_G, 0x05); + seps525_spi_write(dev, SEPS525_PRECHARGE_TIME_B, 0x05); + + /* precharge current R G B (uA) */ + seps525_spi_write(dev, SEPS525_PRECHARGE_CURRENT_R, 0x9D); + seps525_spi_write(dev, SEPS525_PRECHARGE_CURRENT_G, 0x8C); + seps525_spi_write(dev, SEPS525_PRECHARGE_CURRENT_B, 0x57); + + /* driving current R G B (uA) */ + seps525_spi_write(dev, SEPS525_DRIVING_CURRENT_R, 0x56); + seps525_spi_write(dev, SEPS525_DRIVING_CURRENT_G, 0x4D); + seps525_spi_write(dev, SEPS525_DRIVING_CURRENT_B, 0x46); + /* Set Color Sequence */ + seps525_spi_write(dev, SEPS525_DISPLAYMODE_SET, 0x00); + /* Set MCU Interface Mode */ + seps525_spi_write(dev, SEPS525_RGBIF, 0x01); + /* Set Memory Write Mode */ + seps525_spi_write(dev, SEPS525_MEMORY_WRITEMODE, 0x66); + /* 1/128 Duty (0x0F~0x7F) */ + seps525_spi_write(dev, SEPS525_DUTY, 0x7F); + /* Set Mapping RAM Display Start Line (0x00~0x7F) */ + seps525_spi_write(dev, SEPS525_DSL, 0x00); + /* Display On (0x00/0x01) */ + seps525_spi_write(dev, SEPS525_DISP_ONOFF, 0x01); + /* Set All Internal Register Value as Normal Mode */ + seps525_spi_write(dev, SEPS525_SOFT_RST, 0x00); + /* Set RGB Interface Polarity as Active Low */ + seps525_spi_write(dev, SEPS525_RGB_POL, 0x00); + + /* Enable access for data */ + (void)seps525_spi_write_cmd(dev, SEPS525_DDRAM_DATA_ACCESS_PORT); + + return 0; +} + +static int seps525_spi_startup(struct udevice *dev) +{ + struct seps525_priv *priv = dev_get_priv(dev); + int ret; + + ret = dm_gpio_set_value(&priv->reset_gpio, 1); + if (ret) + return ret; + + ret = dm_gpio_set_value(&priv->reset_gpio, 0); + if (ret) + return ret; + + ret = dm_spi_claim_bus(dev); + if (ret) { + dev_err(dev, "Failed to claim SPI bus: %d\n", ret); + return ret; + } + + ret = seps525_display_init(dev); + if (ret) + return ret; + + dm_spi_release_bus(dev); + + return 0; +} + +static int seps525_sync(struct udevice *vid) +{ + struct video_priv *uc_priv = dev_get_uclass_priv(vid); + struct seps525_priv *priv = dev_get_priv(vid); + struct udevice *dev = priv->dev; + int i, ret; + u8 data1, data2; + u8 *start = uc_priv->fb; + + ret = dm_spi_claim_bus(dev); + if (ret) { + dev_err(dev, "Failed to claim SPI bus: %d\n", ret); + return ret; + } + + /* start position X,Y */ + seps525_spi_write(dev, SEPS525_MEMORY_ACCESS_POINTER_X, 0); + seps525_spi_write(dev, SEPS525_MEMORY_ACCESS_POINTER_Y, 0); + + /* Enable access for data */ + (void)seps525_spi_write_cmd(dev, SEPS525_DDRAM_DATA_ACCESS_PORT); + + for (i = 0; i < (uc_priv->xsize * uc_priv->ysize); i++) { + data2 = *start++; + data1 = *start++; + (void)seps525_spi_write_data(dev, data1); + (void)seps525_spi_write_data(dev, data2); + } + + dm_spi_release_bus(dev); + + return 0; +} + +static int seps525_probe(struct udevice *dev) +{ + struct video_priv *uc_priv = dev_get_uclass_priv(dev); + struct seps525_priv *priv = dev_get_priv(dev); + u32 buswidth; + int ret; + + buswidth = dev_read_u32_default(dev, "buswidth", 0); + if (buswidth != 8) { + dev_err(dev, "Only 8bit buswidth is supported now"); + return -EINVAL; + } + + ret = gpio_request_by_name(dev, "reset-gpios", 0, + &priv->reset_gpio, GPIOD_IS_OUT); + if (ret) { + dev_err(dev, "missing reset GPIO\n"); + return ret; + } + + ret = gpio_request_by_name(dev, "dc-gpios", 0, + &priv->dc_gpio, GPIOD_IS_OUT); + if (ret) { + dev_err(dev, "missing dc GPIO\n"); + return ret; + } + + uc_priv->bpix = VIDEO_BPP16; + uc_priv->xsize = WIDTH; + uc_priv->ysize = HEIGHT; + uc_priv->rot = 0; + + priv->dev = dev; + + ret = seps525_spi_startup(dev); + if (ret) + return ret; + + return 0; +} + +static int seps525_bind(struct udevice *dev) +{ + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + + plat->size = WIDTH * HEIGHT * 16; + + return 0; +} + +static const struct video_ops seps525_ops = { + .video_sync = seps525_sync, +}; + +static const struct udevice_id seps525_ids[] = { + { .compatible = "syncoam,seps525" }, + { } +}; + +U_BOOT_DRIVER(seps525_video) = { + .name = "seps525_video", + .id = UCLASS_VIDEO, + .of_match = seps525_ids, + .ops = &seps525_ops, + .platdata_auto_alloc_size = sizeof(struct video_uc_platdata), + .bind = seps525_bind, + .probe = seps525_probe, + .priv_auto_alloc_size = sizeof(struct seps525_priv), +};