From patchwork Thu Apr 25 14:26:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13643444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 614F3C4345F for ; Thu, 25 Apr 2024 14:27:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 984AA11A4A6; Thu, 25 Apr 2024 14:27:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="aUk8p6uN"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id E963711A4A7 for ; Thu, 25 Apr 2024 14:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714055232; x=1745591232; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yCTUM4VsZP0XLCbKY2nqBkSXSRXgEYSN4aDZAwo5Ukk=; b=aUk8p6uNGVnWvjaAqga0S5kioG1/JbNdq+F743C0WFdO+3GFYr4z/hyc Qv+xYcbS4IVzOYE0YkKE5gkry9MpnfXqRn+S+t85PFTUD8l6oCP4YktjS ceBaV+oGM1i1rix78Io5okhH/n5FpKmC06uEimVj/WWcFdUOQ4IRJw/Qq o6LtkvKdTZ78ioQZVyqyqjtitk2NTRHCkUXW2niFOTJiY7uAE2q3m3OGc KAAHoOA0nltaaVA6Y0zfISLod8Z2BoYivFHpYU2mKKvnyaj1fqwy6S8Mo gupSMaPGeJPMLfCyT7jzLeEooxriFu0sqhUlqSp4EBzjEctYfXwVzotOw g==; X-CSE-ConnectionGUID: +0LKAg28SgGYetd9vWwfIQ== X-CSE-MsgGUID: kRjPJ1hESDKVfm6dVG2kYg== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="10281355" X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="10281355" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 07:27:11 -0700 X-CSE-ConnectionGUID: TtSjRNFfSuaq2PIeMrhhNA== X-CSE-MsgGUID: QIpqLtBDQr+fLUQUN0w7mw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="29555176" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa003.fm.intel.com with ESMTP; 25 Apr 2024 07:27:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0BCD3F4; Thu, 25 Apr 2024 17:27:06 +0300 (EEST) From: Andy Shevchenko To: Neil Armstrong , Randy Dunlap , Andy Shevchenko , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Subject: [PATCH v1 1/3] drm/panel: ili9341: Correct use of device property APIs Date: Thu, 25 Apr 2024 17:26:17 +0300 Message-ID: <20240425142706.2440113-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240425142706.2440113-1-andriy.shevchenko@linux.intel.com> References: <20240425142706.2440113-1-andriy.shevchenko@linux.intel.com> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It seems driver missed the point of proper use of device property APIs. Correct this by updating headers and calls respectively. Fixes: 5a04227326b0 ("drm/panel: Add ilitek ili9341 panel driver") Signed-off-by: Andy Shevchenko Reviewed-by: Neil Armstrong Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/Kconfig | 2 +- drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index e54f6f5604ed..2d4515555820 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -177,7 +177,7 @@ config DRM_PANEL_ILITEK_IL9322 config DRM_PANEL_ILITEK_ILI9341 tristate "Ilitek ILI9341 240x320 QVGA panels" - depends on OF && SPI + depends on SPI select DRM_KMS_HELPER select DRM_GEM_DMA_HELPER depends on BACKLIGHT_CLASS_DEVICE diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c index 3574681891e8..7584ddb0e441 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c @@ -22,8 +22,9 @@ #include #include #include +#include #include -#include +#include #include #include @@ -691,7 +692,7 @@ static int ili9341_dpi_probe(struct spi_device *spi, struct gpio_desc *dc, * Every new incarnation of this display must have a unique * data entry for the system in this driver. */ - ili->conf = of_device_get_match_data(dev); + ili->conf = device_get_match_data(dev); if (!ili->conf) { dev_err(dev, "missing device configuration\n"); return -ENODEV; From patchwork Thu Apr 25 14:26:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13643447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F084FC4345F for ; Thu, 25 Apr 2024 14:27:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B184C11A4A9; Thu, 25 Apr 2024 14:27:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="GMgLITST"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF0EE11A4A6 for ; Thu, 25 Apr 2024 14:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714055232; x=1745591232; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gxYu0C20vsruH6KE+KGqY9pjeOljO8yEKIpRfI6XilA=; b=GMgLITSTkyShaM7vETLq8V40CCgrj4bTEvcG41TibxWbA9e2coxAuKKG fsdLXX0ISnPxSJK5CXzwHRn7cqIRHO6KBHhArOyUerQSytvJEIqvm5nQe T4Pi/VHqnG/WwwunQw7a/mhB9Q9LKBeP9jH9gMrvhyzJECQR68NVHrRl9 nzNwlaoUAsK9eYuqvcVPuc91JNhegtjzHdeggz3f4ipXSoBf9XMran0SB aqke3/0tUIhE+1sTb4BuS9emAQg10JOrBtXkl/cGLMGj8haefXo/tSCAv Rg6dzFtuQf6thxC182AhBF+to0EcEkMC5Vd/+mvVNJMY4wkEVbjYX6V0k Q==; X-CSE-ConnectionGUID: UtLsl3ZPS4+mEIhtFGJ8Lg== X-CSE-MsgGUID: ivT2XGwATi6Fjs+tXRhQxg== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="10281345" X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="10281345" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 07:27:11 -0700 X-CSE-ConnectionGUID: csIbbWLGSHKzrTne17MmPg== X-CSE-MsgGUID: UEcpJTBwQpqCWYq4MAO2JQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="29555175" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa003.fm.intel.com with ESMTP; 25 Apr 2024 07:27:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 11A04586; Thu, 25 Apr 2024 17:27:07 +0300 (EEST) From: Andy Shevchenko To: Neil Armstrong , Randy Dunlap , Andy Shevchenko , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Subject: [PATCH v1 2/3] drm/panel: ili9341: Respect deferred probe Date: Thu, 25 Apr 2024 17:26:18 +0300 Message-ID: <20240425142706.2440113-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240425142706.2440113-1-andriy.shevchenko@linux.intel.com> References: <20240425142706.2440113-1-andriy.shevchenko@linux.intel.com> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" GPIO controller might not be available when driver is being probed. There are plenty of reasons why, one of which is deferred probe. Since GPIOs are optional, return any error code we got to the upper layer, including deferred probe. With that in mind, use dev_err_probe() in order to avoid spamming the logs. Fixes: 5a04227326b0 ("drm/panel: Add ilitek ili9341 panel driver") Signed-off-by: Andy Shevchenko Reviewed-by: Neil Armstrong Reviewed-by: Dmitry Baryshkov Reviewed-by: Sui Jingfeng --- drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c index 7584ddb0e441..24c74c56e564 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c @@ -715,11 +715,11 @@ static int ili9341_probe(struct spi_device *spi) reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(reset)) - dev_err(dev, "Failed to get gpio 'reset'\n"); + return dev_err_probe(dev, PTR_ERR(reset), "Failed to get gpio 'reset'\n"); dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW); if (IS_ERR(dc)) - dev_err(dev, "Failed to get gpio 'dc'\n"); + return dev_err_probe(dev, PTR_ERR(dc), "Failed to get gpio 'dc'\n"); if (!strcmp(id->name, "sf-tc240t-9370-t")) return ili9341_dpi_probe(spi, dc, reset); From patchwork Thu Apr 25 14:26:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13643445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C002FC19F4F for ; Thu, 25 Apr 2024 14:27:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6184311A4A8; Thu, 25 Apr 2024 14:27:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="M57j0m8w"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1563511A4A6 for ; Thu, 25 Apr 2024 14:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714055232; x=1745591232; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Wqkixd+I8NnZZhvtO5vNvN0lkMlJWXalpNMQ17i+pvY=; b=M57j0m8wkPxG2rhpgM7kh6Fel3UX9OaQiqwSFD15VLrZumrkJziJfJBv 0832vmr6PAeVsj5YADxnSp0mDYk5f/TC0wk93jHjpOYMRVwsgRi85JZQZ bppUoLTJQjIFBSn0prl9xChwdwuwYKzgGP/0GtlAPLdGp142MRBGtbNEP FKyNfPUmlFbffHnnxhNZSUfwhJnVkQXDs3tl9aw8zITjtqX7ddz+F9Kfa RIURuVTGpt72Cidd2oFNeyVdk7s3pDSdCerpz6aV+16LV/OwjjHMMOIK1 zXq7pKpnZ20si8qVJ0UpZrSNpHYgnQUHzjmEAFEKrV/7zOjj7F7d7ojQT Q==; X-CSE-ConnectionGUID: BaN4YJQlSUu4gpIdfmcrkg== X-CSE-MsgGUID: xQpC8TW1Sa2mMlPsbY0B5Q== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="10281360" X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="10281360" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 07:27:11 -0700 X-CSE-ConnectionGUID: l5RaI+T3Q36ko0vgLIA/hA== X-CSE-MsgGUID: b22RoA9cQ1CL9Ir+2tJIjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="56027430" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa002.jf.intel.com with ESMTP; 25 Apr 2024 07:27:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1C3E079F; Thu, 25 Apr 2024 17:27:07 +0300 (EEST) From: Andy Shevchenko To: Neil Armstrong , Randy Dunlap , Andy Shevchenko , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Subject: [PATCH v1 3/3] drm/panel: ili9341: Use predefined error codes Date: Thu, 25 Apr 2024 17:26:19 +0300 Message-ID: <20240425142706.2440113-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240425142706.2440113-1-andriy.shevchenko@linux.intel.com> References: <20240425142706.2440113-1-andriy.shevchenko@linux.intel.com> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In one case the -1 is returned which is quite confusing code for the wrong device ID, in another the ret is returning instead of plain 0 that also confusing as readed may ask the possible meaning of positive codes, which are never the case there. Convert both to use explicit predefined error codes to make it clear what's going on there. Fixes: 5a04227326b0 ("drm/panel: Add ilitek ili9341 panel driver") Signed-off-by: Andy Shevchenko Reviewed-by: Neil Armstrong Reviewed-by: Sui Jingfeng --- drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c index 24c74c56e564..b933380b7eb7 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c @@ -422,7 +422,7 @@ static int ili9341_dpi_prepare(struct drm_panel *panel) ili9341_dpi_init(ili); - return ret; + return 0; } static int ili9341_dpi_enable(struct drm_panel *panel) @@ -726,7 +726,7 @@ static int ili9341_probe(struct spi_device *spi) else if (!strcmp(id->name, "yx240qv29")) return ili9341_dbi_probe(spi, dc, reset); - return -1; + return -ENODEV; } static void ili9341_remove(struct spi_device *spi)