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: 322905 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp657499ils; Tue, 10 Nov 2020 15:47:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQLycVbH3nWOXOMfRxY8iRhoR09WuOiWdjbVwakXKwA5E0grT4fo85yLz8PtfzKZiTm3yK X-Received: by 2002:aa7:95a6:0:b029:155:336c:3494 with SMTP id a6-20020aa795a60000b0290155336c3494mr19667882pfk.17.1605052026776; Tue, 10 Nov 2020 15:47:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605052026; cv=none; d=google.com; s=arc-20160816; b=YjODleFsaW0Mg6roRRZbLc4XTomqtJaXuK7HfmhAzuv4NEA+ciMmB1Z5MZQdaE5LHp 03CVTXpZyUVOqO4GvVWDBNcwk/1DWUj/gY/zksWsn5TeCHirhFQ3QM/YTJdAk6P+TcwR TC5g1CR5sjDGKxXhIyDAwcqvAWcA3uzdwiZiTctEbKSEZagvd6xJDidv0j/x2gnHoMSD WT64GaDCMoeHLutawBog6VkhCk/xdhelHVsEEih71VpmasIp5fIKuCRrR9VmSE0Wtpw+ 0QZEhjeZDIvb2NcJGxiqq0ZxS9LoH1eC0k477yidg4IWiGl8EsrT+8nnPybC0O62z3Em MUxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to; bh=TdUxTWeZtMjkoLJhHgUUln1V6tGXQUy0SbJddC7MikQ=; b=alQgm3IHwKjnYCPE0bRpT3X16ruOCqVpqa3IRdleJF1t0NhEG4cnuKLPULH7ik5uRd Pm9K8VmEFe7FvQWq5sflGyaFDyX0gEZIbO0HpeEJZVI249LAZPszpdw9wtNYdlm8o4dd gM9cp83FYIsmLKeHooYIdE8Yy6qmElmfntYCYv8DzyYbHFqZCVawq3GpWWomldJOumEI sx0buPkhOfwcNGWW+010oJEsq5LE7Dfk5WrJGKGONCPb15ogUJwyjxpC0AMKdRQcx4Th 7uxNaaz5aNsdzYWdcIoGRYwCCpKWb3sEwo3PQQhDzGkS1IIlsw4Tg9dJcCJ/hE91q5VI hP5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ois9Ru3J; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id k6si71797pgq.205.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) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ois9Ru3J; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org 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-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)