From patchwork Thu Jul 1 22:25:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 469114 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp803177jao; Thu, 1 Jul 2021 15:27:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+/NTsPISZflJln5JZByzCGdenomREDlPVIShed1tM4spS8PSXh1QJy2YjiWA3c+AmxfCI X-Received: by 2002:a17:90b:a0c:: with SMTP id gg12mr1720566pjb.138.1625178445601; Thu, 01 Jul 2021 15:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625178445; cv=none; d=google.com; s=arc-20160816; b=E/LG66gCCLwa6psGNSpylYLnzA7aWQu+59Jh2Tl1c0uOlSadTwirISJJeQDfeSzI9m +FauOIy+PijwMTLhStSfxtcqHpcbzGqh/lAzzAJnVyQX3SV7fps3JK4cBN8AIsIwT8ge VGfwD58fh83gj9XTzfG/M2aCoqsmZyeC5OBeQz46q9QTRYpFkBcWW46vMnknm5wS+Zrb mgHfL9Y9YreI2iRCgVoPJ98eVS3hOEs4P+LetK0HNLwEVujlsmZCcIkgRCajIW7dH6g+ C7AtQ1EZwHPqgB6biSYjOufLqDnIi6G4VuG1Q31OlAthLQJCGSNXZZKvc5wAgi7Py345 66+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :delivered-to; bh=nYq5B2eCjHaLj+NviWCnlDjQJJ2Evn2WlQpXkMJEiog=; b=KVt36mfZXJ2Tc/kHj3rqC4SPnLu+dBeNgyY1IeTh82QGuqgIwYFZrW7lFY2/Yy2BHb XZjP63uEtMtXchnasZP/tNqKXbEgW0d/VvP10CHOCr4i638S5NlS2tXpsRpt1IRlNbH3 8zeE6LATMw3lseRtvIcEI5VX6pni0pmUuezJFaSpFY3s8scEdLW4iXPhABYcdpN0EiLK IUDNdLOc19XHdpz0czzppg/scGzRlFn5VUnHt2oBjF9j0vSRu7CS2mMHc1ylA5CDmuiH ScUcU9IMV7pvxfR7oQxRWHcuijgysrnA3Hr6O+sjuXY0RW5jzVgFLkd957yCtSP5y4z5 BK3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SIt34orS; 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 s3si1153293pgl.80.2021.07.01.15.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 15:27:25 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=SIt34orS; 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 086046EC6D; Thu, 1 Jul 2021 22:27:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9590D6EC6D for ; Thu, 1 Jul 2021 22:27:22 +0000 (UTC) Received: by mail-lf1-x12b.google.com with SMTP id a11so14541549lfg.11 for ; Thu, 01 Jul 2021 15:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nYq5B2eCjHaLj+NviWCnlDjQJJ2Evn2WlQpXkMJEiog=; b=SIt34orSu2HmTfN+acJyw7AUW/E3pZIIJ+idzW64FXXjqQJ4JRhtHwQmeHwnisgxqQ djrWumQVoDXjAIEMv3QAyewsy1zZqvTC5WGaCetB5FJpNIoltk+/ArWXwitFwhYASKuf YBQk1aqzmOHMCmx4IIKnv7lhbXj7Ig6798/c9GwB38+IyAuWunSzgvqNf7lhvIL9VEDT AzHEOuOHnlMC9sM5hIdmP9D67b5o7BTtPx9acIAuFeFL6ibmti7qtB0J1zxP9SoRcLLK lBpoyunFFiipVM0o3xb4YncKDwhExd1xbgLzJpTRWFP2OrDc7s6kWZjsTu+Ewd+5c+Kt h/ow== 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=nYq5B2eCjHaLj+NviWCnlDjQJJ2Evn2WlQpXkMJEiog=; b=mJI1pceuUX4iqdOSBm81WKHAITp/zZumJDH3SrpMRM2Rft2xgfqW1WZrXyxONEo3MZ oAJYC7C4B54P01/bP+4VUpLvUg1UqPZFDcKjh7aBoVaFQUrdvh+r8x9PxUxX1jcBp0DP dq2GpP28TPsnIdkeZS7hn5bzN7bat5A/RxrK8vCPYP42X8+7ycEfXasx4xHvFEtlH/8k 7Mb/Il58b3In2gamOCssfnl9oELWahsrVgqs/x0RrtUIaIDU+IIKIBlE3gnSqRjf2srT qcnUf9jqvsYdx7EOWBO9VKq1TnQ2TGTx/KcyVx5suQd8uv2m5Q04KhpV556qRSYf0GV/ hXHQ== X-Gm-Message-State: AOAM533F92tQ0/fU2uSqbsL0TcuqENo5v7hOeQlY9nIDu2LWzBKF2w5Z /H3bsn3Wk7hqeJuZ9Qf9AET6Gw== X-Received: by 2002:a05:6512:3b8c:: with SMTP id g12mr1383492lfv.551.1625178440891; Thu, 01 Jul 2021 15:27:20 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i1sm95719ljn.40.2021.07.01.15.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 15:27:20 -0700 (PDT) From: Linus Walleij To: Thierry Reding , Sam Ravnborg , dri-devel@lists.freedesktop.org Subject: [PATCH] drm/dbi: Print errors for mipi_dbi_command() Date: Fri, 2 Jul 2021 00:25:18 +0200 Message-Id: <20210701222518.3895552-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 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: =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Douglas Anderson Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The macro mipi_dbi_command() does not report errors unless you wrap it in another macro to do the error reporting. Report a rate-limited error so we know what is going on. Drop the only user in DRM using mipi_dbi_command() and actually checking the error explicitly, let it use mipi_dbi_command_buf() directly instead. After this any code wishing to send command arrays can rely on mipi_dbi_command() providing an appropriate error message if something goes wrong. Suggested-by: Noralf Trønnes Suggested-by: Douglas Anderson Signed-off-by: Linus Walleij --- drivers/gpu/drm/drm_mipi_dbi.c | 2 +- include/drm/drm_mipi_dbi.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) -- 2.31.1 diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c index 3854fb9798e9..c7c1b75df190 100644 --- a/drivers/gpu/drm/drm_mipi_dbi.c +++ b/drivers/gpu/drm/drm_mipi_dbi.c @@ -645,7 +645,7 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool return 1; mipi_dbi_hw_reset(dbi); - ret = mipi_dbi_command(dbi, MIPI_DCS_SOFT_RESET); + ret = mipi_dbi_command_buf(dbi, MIPI_DCS_SOFT_RESET, NULL, 0); if (ret) { DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret); if (dbidev->regulator) diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h index f543d6e3e822..2057ad32760c 100644 --- a/include/drm/drm_mipi_dbi.h +++ b/include/drm/drm_mipi_dbi.h @@ -183,7 +183,10 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, #define mipi_dbi_command(dbi, cmd, seq...) \ ({ \ const u8 d[] = { seq }; \ - mipi_dbi_command_stackbuf(dbi, cmd, d, ARRAY_SIZE(d)); \ + int ret; \ + ret = mipi_dbi_command_stackbuf(dbi, cmd, d, ARRAY_SIZE(d)); \ + if (ret) \ + pr_err_ratelimited("MIPI DBI: error %d when sending command\n", ret); \ }) #ifdef CONFIG_DEBUG_FS