From patchwork Tue Nov 10 23:46:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11895843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58710C388F7 for ; Tue, 10 Nov 2020 23:47:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBFF420825 for ; Tue, 10 Nov 2020 23:47:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="u/ORs0QN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBFF420825 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F08D89D58; Tue, 10 Nov 2020 23:47:01 +0000 (UTC) Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 217F589D58 for ; Tue, 10 Nov 2020 23:47:00 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id h23so12355185ljg.13 for ; Tue, 10 Nov 2020 15:47:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=khCnrGcki9o8mKzcd5bCbIg16yUPV4xc/WhNkEV8Tok=; b=u/ORs0QN5/8GNcc5WPRtlACFGXVsKVFbYuGsrzCv1yjHxcPy/iM5a/i+6vMUP6AKjN zSHk/ZYl8qUWVCssuNs9diEHlqZ4Py5b5EqAo7jLgpwAddN/m2FV9P7oyjsd2QxhzXRz l+6ua64z7QgON4W1QW+UOSGw3txS1ESYHK9IfLUs6k8RLIImNiWIUt/sSPfpSP55FQi0 cyqgQId3rGQ1p8BbtMwSDfUHV57QQE5+iSRp7zPcMOKdx6Q1Is+CQYGV3VtbmHWgrsMQ 5QFsV8pJxfrZi04clbXYEzKmGfR1dY/++THEnKwL/mwp785/k2SEfBwdo7Y4SelB+pF5 7HSQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=khCnrGcki9o8mKzcd5bCbIg16yUPV4xc/WhNkEV8Tok=; b=JVfUwI4F9sLuEq1fpHXBnhxiMXRvQQBJWfJK22BiKnxZm69B4tbUDS1Suz/Zz8kI8q 0ns+miPGG9k1KAICC9+oZlZ7yYKZGa5ec00kOPxoXTsHIF7MnXANdiM8pKnWxDsvsWUe sL8OKtZfbE34Y9Oi4GZLB5BwRz4BTMdid75ja/+/QAm446s17qwAEs7e6yhtOsKWu8Yu VgPftK3rm1w2ZItN38EsmL7xgUrde5zKgcx0frqjbfD7mBYiFzraSBhIknFWBXcp97c+ 1EGbQZNjFILJW3HbHoR9oUJkffRgL+clhD3RYgblPuIFbZz3Eo/RBPDoHnO8WwVwk1NU RVbw== X-Gm-Message-State: AOAM533WbC5QfwazGPnwuv6HN/4M9+ULs59CYAxmw/7kSfAki75fi3Qz 4ZANJ8yLcoq5LUBdt/KhRBhNwQ== X-Google-Smtp-Source: ABdhPJzu4zhI7ATvz2cS3ifaqpbPNdcj+FCldCfQgZdOFlyA1OLSbRWf/zHRc4w+ZEKaQQ/wAABacg== X-Received: by 2002:a2e:9083:: with SMTP id l3mr3274847ljg.118.1605052018573; Tue, 10 Nov 2020 15:46:58 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id y65sm39883lff.73.2020.11.10.15.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 15:46:57 -0800 (PST) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , Stephan Gerhold , =?utf-8?q?Pawe=C5=82_Chmiel?= Subject: [PATCH 1/5] drm/panel: s6e63m0: Simplify SPI writing Date: Wed, 11 Nov 2020 00:46:49 +0100 Message-Id: <20201110234653.2248594-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201110234653.2248594-1-linus.walleij@linaro.org> References: <20201110234653.2248594-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This writing code is equivalent to the spi_write() helper in the SPI framework. Insert a comment that this will always work fine since SPI buffers are in native endianness. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c index d298d780220d..75f00ed4810b 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c @@ -25,16 +25,9 @@ static int s6e63m0_spi_dcs_read(struct device *dev, const u8 cmd, u8 *data) static int s6e63m0_spi_write_word(struct device *dev, u16 data) { struct spi_device *spi = to_spi_device(dev); - struct spi_transfer xfer = { - .len = 2, - .tx_buf = &data, - }; - struct spi_message msg; - spi_message_init(&msg); - spi_message_add_tail(&xfer, &msg); - - return spi_sync(spi, &msg); + /* SPI buffers are always in CPU order */ + return spi_write(spi, &data, 2); } static int s6e63m0_spi_dcs_write(struct device *dev, const u8 *data, size_t len) From patchwork Tue Nov 10 23:46:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11895841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FD8EC56202 for ; Tue, 10 Nov 2020 23:47:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B24D8207E8 for ; Tue, 10 Nov 2020 23:47:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ois9Ru3J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B24D8207E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 02C6089D5C; Tue, 10 Nov 2020 23:47:04 +0000 (UTC) Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34CC189D5C for ; Tue, 10 Nov 2020 23:47:03 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id l2so689308lfk.0 for ; Tue, 10 Nov 2020 15:47:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BZwpBjCKFkPFg4D+5kgmDyInAjRNL4hw/D5g9alUegs=; b=Ois9Ru3JLPsyJ899x+z10htmSkwf6Ku6x2+jtneNn/D8cLDHx5Uz2jl1BNQ/M/HKXU T3fAd+t0cE8Ao1I73wOHHT/x/mpk0A93IPjf7mCcsyGHdKZRpBWFUf2GMLvA+RYJMBx0 IKXzMXbrzOpC8GSyLxccCbgjeAnTmWGED935igkBFuP2wYNadB2/rHpc/2yAN1mLIH2Q hjnB3khYHaEXeayRKJWwtaaY4fmsHU2Ae4lDGm5+OnxYii7AEsCcRO5JW+/L3+ZH1UQF w9BaWuhLYMrsQ4h2VnQddNVs130Nbpd/ywjqEJOxH5p8dMoJQMTO2IHXUYxFaTrXYNBe Z32g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=BZwpBjCKFkPFg4D+5kgmDyInAjRNL4hw/D5g9alUegs=; b=AB4WV+oDDhzgH4h8BCrNWvAfVpWbhO5eDYW0O+j4Z2gIG/GCQePlmf8Ovm9otwMEkb nanilejOUrJHoVS2u/C8yex1D2ohs7L6HTwTIcppjkZP44sZQUL0oJqfUHXik6EVHxfH f4+Gjjmht4c+7QuFl3fgVFaHLEusdvRz9Pqf/vnP/nQvetdlc0I6eT0/DbSVRH+4iw2B b7jjy8oxsnX1zld61iK03K702zl5vE1aQ5OD+ymDi6nyDjAS+wjALprxFMc3lroJH8+O /PcERLBJGxGHdpiYp2mXWqKSmfABKJCyZ24JnITBVbW5NMXqYAO32Q2PFXTNG6E+3Yu+ wvig== X-Gm-Message-State: AOAM532z/XlRi2WD8EVED++xQHnI1ibYey2eFPVz75pypw5L0uB+RK8O QusJXChFO19RU3xuolqxSUf0mA== X-Google-Smtp-Source: ABdhPJxrIf45hk096T37XeKGU/4ge9gAffDTeWkM91ls8F9VWtneZ3CE1oS00zLtaQ8ivc3Z/JmB/A== X-Received: by 2002:a19:5052:: with SMTP id z18mr8104346lfj.574.1605052021569; Tue, 10 Nov 2020 15:47:01 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id y65sm39883lff.73.2020.11.10.15.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 15:47:00 -0800 (PST) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , Stephan Gerhold , =?utf-8?q?Pawe=C5=82_Chmiel?= Subject: [PATCH 2/5] drm/panel: s6e63m0: Implement reading from panel Date: Wed, 11 Nov 2020 00:46:50 +0100 Message-Id: <20201110234653.2248594-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201110234653.2248594-1-linus.walleij@linaro.org> References: <20201110234653.2248594-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This code was found in the Samsung vendor tree for the Samsung GT-I9070 mobile phone. Let's support reading before we implement the 3WIRE protocol for both reading and writing. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- .../gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c index 75f00ed4810b..9e1552a7ccc7 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c @@ -13,13 +13,20 @@ static int s6e63m0_spi_dcs_read(struct device *dev, const u8 cmd, u8 *data) { - /* - * FIXME: implement reading DCS commands over SPI so we can - * properly identify which physical panel is connected. - */ - *data = 0; + struct spi_device *spi = to_spi_device(dev); + u16 buf[1]; + u16 rbuf[1]; + int ret; - return 0; + /* SPI buffers are always in CPU order */ + buf[0] = (u16) cmd; + ret = spi_write_then_read(spi, buf, 2, rbuf, 2); + dev_dbg(dev, "READ CMD: %04x RET: %04x\n", buf[0], rbuf[0]); + if (!ret) + /* These high 8 bits of the 9 contains the readout */ + *data = (rbuf[0] & 0x1ff) >> 1; + + return ret; } static int s6e63m0_spi_write_word(struct device *dev, u16 data) From patchwork Tue Nov 10 23:46:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11895847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C6B8C55ABD for ; Tue, 10 Nov 2020 23:47:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C10B520809 for ; Tue, 10 Nov 2020 23:47:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="U9ihdXyD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C10B520809 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BBD5689D61; Tue, 10 Nov 2020 23:47:06 +0000 (UTC) Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id EFB3D89D60 for ; Tue, 10 Nov 2020 23:47:04 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id o24so10135782ljj.6 for ; Tue, 10 Nov 2020 15:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E1gRUn+R+klQwSA/hEFGmAtJ4OnicYEWs/eLK/JMuQY=; b=U9ihdXyD1urh+RHMp9iS7+yRg5oU1dA1y2MstjcSTXJ/aqTwr7ziS1Bfr9pmwaGQ4r 88uJuihEMFiDn0RNYkbZp585ls0glQXr3FPPC4Cqo4uKvehn4d4/kxIX4+goPiPV860a SLu7/fEeVaJ7q1Gp/wzZhzjoesA7nKt0QYPBPV9Yz6bzQ7kk/xit3DFfDz0/nN4aNAxR 8mXYseGVARTmwrSkzZgmu/7iqcN7jodaH3bVR8/Y01uL1EbpwNJBnHRp5clYuBkHaxf5 9qSeHCPvYCFpIBmh3EZD0rrZuEpCVQcPqTo2bxRjV4M1o+JUK3XZ43dmA43n5WlUd8Q+ bNIQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=E1gRUn+R+klQwSA/hEFGmAtJ4OnicYEWs/eLK/JMuQY=; b=im9CRrSeABrtW+rTTEM5vnjF+HlsflvWWzG7h+akNjp2I4R8eYtpcaBsNVeXFXt0IX K47EQ5CqsyXTcPruNCZfc6ZxEAt/W8hKyVVue11UC0qLfJ1mHmjQ6jYsvIGZo0dPwpfc DePahqS7k8/EvslJkVuyEn5DS/4kbf+mQ688EhcVVPpjzRrhOTjnFlKjGSqmztI6FOYW W/zd3eNC/m9QCGV9+QehZnxpVscj8fxQTv9y7dLQNdwG8xVTE8xP7ICn+tM5n+todKOP SPFi5v8y7HthWOCu04g5iff4jvwd6MiacY6w766t8JiRa8uwcRBGw/cuwwt3gxyAKcXE HKxw== X-Gm-Message-State: AOAM530OYxy5NkRYBWSoXmkovcOJv0auv7g1BtEcOhgAUrnXCQcDEY/i uAK4LG9bWz8N0S1escyNBQ1l2w== X-Google-Smtp-Source: ABdhPJxIJrO5fByuVcFYiXbVUCNS8ERYFbme3PDojsduwGAs4jamuSEibsdODjf4WOe7N6BG8x8Yug== X-Received: by 2002:a2e:b536:: with SMTP id z22mr9602614ljm.177.1605052023412; Tue, 10 Nov 2020 15:47:03 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id y65sm39883lff.73.2020.11.10.15.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 15:47:02 -0800 (PST) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , Stephan Gerhold , =?utf-8?q?Pawe=C5=82_Chmiel?= Subject: [PATCH 3/5] drm/panel: s6e63m0: Add some explanations Date: Wed, 11 Nov 2020 00:46:51 +0100 Message-Id: <20201110234653.2248594-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201110234653.2248594-1-linus.walleij@linaro.org> References: <20201110234653.2248594-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The SPI DCS code was a bit hard to understand as the device accepts 9-bit transfers packed into 16-bit words with the most significant bit in bit 9 of the 16-bit word. Add some clarifying comments. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c index 9e1552a7ccc7..e47647f418ff 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c @@ -42,10 +42,17 @@ static int s6e63m0_spi_dcs_write(struct device *dev, const u8 *data, size_t len) int ret = 0; dev_dbg(dev, "SPI writing dcs seq: %*ph\n", (int)len, data); + + /* + * This sends 9 bits with the first bit (bit 8) set to 0 + * This indicates that this is a command. Anything after the + * command is data. + */ ret = s6e63m0_spi_write_word(dev, *data); while (!ret && --len) { ++data; + /* This sends 9 bits with the first bit (bit 8) set to 1 */ ret = s6e63m0_spi_write_word(dev, *data | DATA_MASK); } From patchwork Tue Nov 10 23:46:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11895849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 862D3C388F7 for ; Tue, 10 Nov 2020 23:47:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 28CC3207E8 for ; Tue, 10 Nov 2020 23:47:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YC3lkdEJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28CC3207E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30F1089D64; Tue, 10 Nov 2020 23:47:09 +0000 (UTC) Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id C626389D63 for ; Tue, 10 Nov 2020 23:47:06 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id b17so4197283ljf.12 for ; Tue, 10 Nov 2020 15:47:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GSgt/pPBiOJZ6llJdG2JMoW9+H1DFAY+cbBM7SnOX6s=; b=YC3lkdEJ3jzc+Wi6dNJdRwwt0CgK2Ay+vzqMAyNvVymYQu5s5jL/Xf2/5+16rxfAF8 7OHX3EAwWqMgrU6MGDtPx/z3icV8zckmYbUivHsWGu4LsOKHnR5dCqJYAiVVpX5lpa4j pY9tjHJoTs2KtmeGJzhpuMG3BdREhQ0nnMUct7GT+Mx0TQEF69OHpD++QQePuXgrxGsM edb6Ng8x/WK13sgBapkwT4uElVBJ+D1ci1nZwVSTfZ10tMiu+VjGgMbvdngYqKVWeVZp TYmIofOZI6LndFHOkGBgo2hl+TanJnDtchqILKrWYq3s8Fox/8cxc1Av3jUxjzOQyEvu 55IA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=GSgt/pPBiOJZ6llJdG2JMoW9+H1DFAY+cbBM7SnOX6s=; b=jFsixtZmLg58XP+rrHexf2FANAtAuGCGHbv49eYYVG7ZwY6upGJAMoi57tJYcd062t /pKf7wPyFNDpgApcyKegu3rIk4B8nFgJt/sJS8jVew0DWQdrdb3fIwRSG9PgdtwtYIJ3 UusDuAZ8HK89IO1ZN10C1lAzCI9a1q6riFa8+ULCrQ8XZV1S9PM2hwq9QUrkjmwY+efR ApnNHmV3XrTTgyN2Ent0YoVmWqkRawqzDxeP/T5/+tpJ5MV9+007ovnHg47Yqo7jPX7M 6XWeA1WIm1F4OHsqUygDLePrfR0oBNGUAA0+NqX6YQIm00EGj45P7uRouGM4dssKnFw+ ussQ== X-Gm-Message-State: AOAM531QlyEHAvEbXmQUfNHiMb8BuuTP2Ms9+CGeJ2mzsS29jvCaS9Nt 0LRGLy6tl4YCS+PRVfUpfEI9G6Se+qPGtpKX X-Google-Smtp-Source: ABdhPJxsgdAc7zos0+Bo9IFM/D2bfc33il0pXf61SW91nFotffpQKHyw3bhTsjmetpaRJIEQS0IdrA== X-Received: by 2002:a2e:9798:: with SMTP id y24mr8619126lji.341.1605052025204; Tue, 10 Nov 2020 15:47:05 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id y65sm39883lff.73.2020.11.10.15.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 15:47:04 -0800 (PST) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , Stephan Gerhold , =?utf-8?q?Pawe=C5=82_Chmiel?= Subject: [PATCH 4/5] drm/panel: s6e63m0: Support 3WIRE protocol Date: Wed, 11 Nov 2020 00:46:52 +0100 Message-Id: <20201110234653.2248594-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201110234653.2248594-1-linus.walleij@linaro.org> References: <20201110234653.2248594-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The panel can be connected using 3WIRE, then it is however necessary that the flag SPI_3WIRE is preserved on the device, as we set this from generic device tree parsing code (or similar). Just |= the SPI mode. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c index e47647f418ff..b1adf8f89c62 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c @@ -72,7 +72,8 @@ static int s6e63m0_spi_probe(struct spi_device *spi) int ret; spi->bits_per_word = 9; - spi->mode = SPI_MODE_3; + /* Preserve e.g. SPI_3WIRE setting */ + spi->mode |= SPI_MODE_3; ret = spi_setup(spi); if (ret < 0) { dev_err(dev, "spi setup failed.\n"); From patchwork Tue Nov 10 23:46:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11895851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2261BC388F7 for ; Tue, 10 Nov 2020 23:47:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4C8C207E8 for ; Tue, 10 Nov 2020 23:47:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SVOdJook" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4C8C207E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E377089D66; Tue, 10 Nov 2020 23:47:12 +0000 (UTC) Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67D0A89D60 for ; Tue, 10 Nov 2020 23:47:08 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id s30so660446lfc.4 for ; Tue, 10 Nov 2020 15:47:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CFh/nhcwrF/c3LgZHhdLXiie2alaqfhVgce5eQpdRHk=; b=SVOdJook6lyRlymtqkNVft9OI32xfV6qDjHZroYCvEw6pjPKgNrxqKJ15DKV0Xf9Hw 223YRkoekys/xGVZEnW5jp7eNTI70Yobtnm2XbC3vbU22lCEcWhfi0WP6w/R05xjPIHe jV4Awr0fhMD2V+2ytKr8stPRzDaM5/i9hyA5+nwc5MnMa2Rv57UoHFoGbdVLDoFE6UCE IpaOCoXhTVL07fjtivvTpfojiFk9HBKI3s+VpD37/RVcDbaGQz2QgBI6gnVfxRW4Bm/5 kEYbcZtNE2UkPc8SLvvaBgl2MuAY/KoS6W9DLTn1Bd8zEu7vnReTC7O1HWQ/Qj7m66Wd sasg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=CFh/nhcwrF/c3LgZHhdLXiie2alaqfhVgce5eQpdRHk=; b=uby/IIhqBcWvPRTGF6kbkmCv/LFmN5F3CZcnYcxNhwCbJ9b3D2cm7x2nYAIOIOFlnS qTvU5nWuoqINCfctQzzG/2F0QsSmzXVS4LHu3ygVOhJYgK8sjFlphGDF9Bo/HoujO/Sx sTeqcYE9Pe/usJ3DxKw/x+ICvKuuq3IbW7e/ZRJdvQK96EdTnEjfLJKL8yMgFr6D8/uy DTsgSJWGGz9/z5gj1sHlRE8VjrLniZtN4VPazoAWhKqBFQvZYiBKdp2UGZnfPexsgHrc q1osTiLwbEvLu4Hw0pTODKoAJQeWU9NnMBci/IC3mDHuYrtTIrwjkKt6764XXilco2Yl 6Mtw== X-Gm-Message-State: AOAM532/ot84SI4+IS6xrZp2JleW9a8reuhnw0TY0qp8AIS5/WfZ/hfq ceq6kzBfs7AIK3k5ydfs6YZQEQ== X-Google-Smtp-Source: ABdhPJzfo5AkE8LkBZ3fFazuUZ1IBl9VUHKaBvUJJ5qjsl3/Rji2qIKp4UeMewI4Pryg5Ahlz/ve+Q== X-Received: by 2002:ac2:568b:: with SMTP id 11mr7560047lfr.397.1605052026854; Tue, 10 Nov 2020 15:47:06 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id y65sm39883lff.73.2020.11.10.15.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 15:47:06 -0800 (PST) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , Stephan Gerhold , =?utf-8?q?Pawe=C5=82_Chmiel?= Subject: [PATCH 5/5] drm/panel: s6e63m0: Set up some display info Date: Wed, 11 Nov 2020 00:46:53 +0100 Message-Id: <20201110234653.2248594-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201110234653.2248594-1-linus.walleij@linaro.org> References: <20201110234653.2248594-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Copy over the width/height in millimeters to the (somewhat redundant) display info, and set up the bus format and bus flags for the display. When used as DPI this display requires DE to be active low and pixel data to be output on the negative edge. It might be that it was previously used with a display controller that either does not support these settings or was hardcoded to use these as default. This information comes from the source code of the Samsung GT-I9070 mobile phone. Cc: Stephan Gerhold Cc: Paweł Chmiel Signed-off-by: Linus Walleij --- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c index 3eee67e2d86a..210e70da3a15 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -16,6 +16,7 @@ #include #include #include +#include #include