From patchwork Thu Apr 17 07:01:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 882133 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C453619F13B for ; Thu, 17 Apr 2025 07:01:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873312; cv=none; b=WUG/ddJGnoLr3W0KXSHRDRa7J0dPkFn9Yk6O1Zc9Qyh/M+DFwpZ5uzmuwGEbRNtZr6zbX5lZCa76ronyr+wAeUvu/kxF2tp974c8SZdEqWZg1WUTHn6W6K6lzKj30pUhCLz+/V5x7SdjXPGu6i2fZqu8bGQDiktyJuvBkaxI0rA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873312; c=relaxed/simple; bh=xMBFXODT0+G5/Cpby5US+ddx58p7eyZBYshVnynS/fw=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cBkQcZwLrEr7z7cVOctOhHBFywbcKj1lvd8DmyA1rP8OOOBj0Ie4XcPwOxHTzqg6RnWrxFk8BqCOMLhqkHSruC0PAdXfoMUx+u6tEV6CPEKXPNuPCgcyCfA0TkGulssHXWuE1G74VXvg05oX1q53mVFbVVFkM/8Hw6h9j9QcbYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lvxMGdh9; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lvxMGdh9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744873311; x=1776409311; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=xMBFXODT0+G5/Cpby5US+ddx58p7eyZBYshVnynS/fw=; b=lvxMGdh9/6/9qqJ/mBD/1qkOMY1TrG+f3HEjnHwNCYtEUai0TDlQ/hTO 0UfQRAR8NFbIL5tqTWRB9AOHlPZSLlB2AR9zm7CjAOssIN7x//EQkU59g vIoaw0nVYkPKPxozldYGlK/0vXYDDdFLik1V0U1PqC2/CpAwvYwJlVFKZ z3gif0k3fLEgdyU8IqVweGFUlpLc0avvfALPpKyyq6aHOdME6TOMLo7R4 nQLvSSZSnIXoP5NrUmLNkZS1EzDKtY9PRXvXTTMwLjccoDlpHz1Ce9Uf6 h5ph3Yxf5qj903M5Vcs3RSW6FZSey91u6g+xsC1xDwR8RJaU2BxsBlby4 w==; X-CSE-ConnectionGUID: 4+yEEVjyTMmIjulhlOI0xQ== X-CSE-MsgGUID: 9SVtxd2/RN+dke4HFxLLbw== X-IronPort-AV: E=McAfee;i="6700,10204,11405"; a="45580980" X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="45580980" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:49 -0700 X-CSE-ConnectionGUID: jYXyEN0ESKq55VSppm7qeQ== X-CSE-MsgGUID: WhU8itroSv6XCcB1CBxzFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="135883743" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:48 -0700 Received: from svinhufvud.lan (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id CDC7C11F9D0 for ; Thu, 17 Apr 2025 10:01:45 +0300 (EEST) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Subject: [PATCH 1/5] media: ccs: Don't complain about missing "clock-frequency" property Date: Thu, 17 Apr 2025 10:01:40 +0300 Message-Id: <20250417070144.130199-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250417070144.130199-1-sakari.ailus@linux.intel.com> References: <20250417070144.130199-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The clock frequency is often available via the clock itself and not read by the driver from the "clock-frequency" property. Don't complain if the property doesn't exist. Signed-off-by: Sakari Ailus --- drivers/media/i2c/ccs/ccs-core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index 004d28c33287..32ebc4477fc7 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -3131,8 +3131,6 @@ static int ccs_get_hwconfig(struct ccs_sensor *sensor, struct device *dev) rval = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", &hwcfg->ext_clk); - if (rval) - dev_info(dev, "can't get clock-frequency\n"); dev_dbg(dev, "clk %u, mode %u\n", hwcfg->ext_clk, hwcfg->csi_signalling_mode); From patchwork Thu Apr 17 07:01:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 882509 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 349F92153DA for ; Thu, 17 Apr 2025 07:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873312; cv=none; b=QjmyVKSqcUuDu0YOtqG+3fDJXV9s2eTWQsU2yX9Qs3yQYdqHq9Yn0V+Vljxo2xQoUGbLzBxkNsQbpxVoq97H3StCB87NrVN3SHGd88DRtapDj9M6NpeHW3kOORyQgw0gM7p7mzEQPTTiDxNWXLVaQ1z6U9xatDuIZicum+Y4060= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873312; c=relaxed/simple; bh=cmgUhxWvsEmZMKyVkXWYbOw23A81V6zybyGzeaoH1Pg=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pI+IJonW/Pc618008Ro/9xOnXSG4d2ZDeh70wkiwhDpE+CDwEUtIIIAQmKXsaktY4TwOYhL8k4nET7xsyUVPnX4j7kKYyjTFZfygcLUmQ4DNPxZ9MKSMGQ1LTMAiU/sMiwPZ45WsIgmyOSO6xHb9Ovcx1ic1jKsswPf+N5B+lfk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EtmVsBwQ; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EtmVsBwQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744873311; x=1776409311; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=cmgUhxWvsEmZMKyVkXWYbOw23A81V6zybyGzeaoH1Pg=; b=EtmVsBwQdCY+VF3ZTh8F3uawQXA9VH4sk+qZAq1K7u/Qk7v6IGtB1S/o 6HaUiEbjN+vtyQWuKrkvUeJQTFNA/IAYy495mFBf5cu8GYI/56oau2zEB Hdscrn09LA7sDkPHNPz0/YnOiO0w7uubwiQ6hshoIRuCvL9CEYG2Q1hUG 5rMYVWEd86zr3cjYueyntlKImG8dnrSjUN8XFFRSAOd16xgj5beDlJkfl ED3tF0siFmUgG9+ynF57+p4FO395HSFt8N4VCTuCSM01473cjVOgmDlR5 YA1aEL7lUsUGH7qHZ3jCjmC4uPPfH6J3bfuxaZu4f+s5JoywGIIZmXf9t A==; X-CSE-ConnectionGUID: hSIb4JvORSCa/yijUkiQnQ== X-CSE-MsgGUID: fKL3cd4fTZq24CEXP1lRgA== X-IronPort-AV: E=McAfee;i="6700,10204,11405"; a="45580982" X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="45580982" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:50 -0700 X-CSE-ConnectionGUID: SXogawnPQZ2yOJkZn2dV4A== X-CSE-MsgGUID: 0HFFgWAVQ0eZ9rFBeur/Dw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="135883746" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:49 -0700 Received: from svinhufvud.lan (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 83D9A1202AB for ; Thu, 17 Apr 2025 10:01:46 +0300 (EEST) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Subject: [PATCH 2/5] media: ccs: Try a little longer to access the sensor before giving up Date: Thu, 17 Apr 2025 10:01:41 +0300 Message-Id: <20250417070144.130199-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250417070144.130199-1-sakari.ailus@linux.intel.com> References: <20250417070144.130199-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some sensors take longer to respond after reset than the spec-required time. Try up to 1 s for the sensor to become accessible. Signed-off-by: Sakari Ailus --- drivers/media/i2c/ccs/ccs-core.c | 26 +++++++++++++------------- drivers/media/i2c/ccs/ccs.h | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index 32ebc4477fc7..aeda286a7607 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -1354,8 +1354,10 @@ static int ccs_change_cci_addr(struct ccs_sensor *sensor) client->addr = sensor->hwcfg.i2c_addr_dfl; - rval = ccs_write(sensor, CCI_ADDRESS_CTRL, - sensor->hwcfg.i2c_addr_alt << 1); + rval = read_poll_timeout(ccs_write, rval, !rval, CCS_RESET_DELAY_US, + CCS_RESET_TIMEOUT_US, false, sensor, + CCI_ADDRESS_CTRL, + sensor->hwcfg.i2c_addr_alt << 1); if (rval) return rval; @@ -1575,27 +1577,25 @@ static int ccs_power_on(struct device *dev) if (ccsdev->flags & CCS_DEVICE_FLAG_IS_SMIA) sleep = SMIAPP_RESET_DELAY(sensor->hwcfg.ext_clk); else - sleep = 5000; + sleep = CCS_RESET_DELAY_US; usleep_range(sleep, sleep); } /* - * Failures to respond to the address change command have been noticed. - * Those failures seem to be caused by the sensor requiring a longer - * boot time than advertised. An additional 10ms delay seems to work - * around the issue, but the SMIA++ I2C write retry hack makes the delay - * unnecessary. The failures need to be investigated to find a proper - * fix, and a delay will likely need to be added here if the I2C write - * retry hack is reverted before the root cause of the boot time issue - * is found. + * Some devices take longer than the spec-defined time to respond + * after reset. Try until some time has passed before flagging it + * an error. */ - if (!sensor->reset && !sensor->xshutdown) { u8 retry = 100; u32 reset; - rval = ccs_write(sensor, SOFTWARE_RESET, CCS_SOFTWARE_RESET_ON); + rval = read_poll_timeout(ccs_write, rval, !rval, + CCS_RESET_DELAY_US, + CCS_RESET_TIMEOUT_US, + false, sensor, SOFTWARE_RESET, + CCS_SOFTWARE_RESET_ON); if (rval < 0) { dev_err(dev, "software reset failed\n"); goto out_cci_addr_fail; diff --git a/drivers/media/i2c/ccs/ccs.h b/drivers/media/i2c/ccs/ccs.h index 096573845a10..0726c4687f0f 100644 --- a/drivers/media/i2c/ccs/ccs.h +++ b/drivers/media/i2c/ccs/ccs.h @@ -43,6 +43,8 @@ #define SMIAPP_RESET_DELAY(clk) \ (1000 + (SMIAPP_RESET_DELAY_CLOCKS * 1000 \ + (clk) / 1000 - 1) / ((clk) / 1000)) +#define CCS_RESET_DELAY_US 5000 +#define CCS_RESET_TIMEOUT_US 1000000 #define CCS_COLOUR_COMPONENTS 4 From patchwork Thu Apr 17 07:01:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 882130 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90E4521ABC2 for ; Thu, 17 Apr 2025 07:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873316; cv=none; b=Cf0qCiFe5n2mm57oRh0NYSHme4GMRNOKUdyK4Vwm7LoC6UfNr2lxcT4Onxfgn7/Ho9T1ZbxXdqGWwK3vq2lcb+HAaW4CpZk5rCdMvcTVuhtVyeKI6PqwJYKX388MItLueGD+IIL6xCVpkhE9SUUP6CVKnPT1Vi4zQzEx1p/GiQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873316; c=relaxed/simple; bh=8L8cybTbeEl2m2JRovyt7ZIU6E49n2ugAkmtKxaYWfw=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F1WL/MTsEl9CzriYY2JH+/QwEcpsucL82V91I+NC7E8XYbvmYcNiZQZxelEc3APpKWIqSQvhTIPRi3nuQYRYCnQuMvozyRUvlekvrTtNTK7HzdHuRE61/QQSqV8oLLDRCRuuoPe7mwwZTj72XRiPu83AtIdTdHE0FFEfpm37u1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UCZXUkBt; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UCZXUkBt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744873315; x=1776409315; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=8L8cybTbeEl2m2JRovyt7ZIU6E49n2ugAkmtKxaYWfw=; b=UCZXUkBtVH1qT5AxsSlsVYaS69J03q+xtpr9SSTC3/611i7fSbvotUK8 sfFuSbFKsvpHpuX6Poy9B3Pqpwlx7BG+FAZ61xm862Q9vH+zhtJiwsWXH 56lNVqtbUkiAzOZ7IP+4OmxXFTCaEaugbhY5r5iZf2ViqQ/5MlUlnyyDI sfhLc3YS9zy/WDOLCcKkNncyhibPA83z6CGPtgddpKn/Wb/CbMTdx+B9d r05PtyXKzvsTxPtvTmladUtM0axKDZeu/f4cXUNg6v5wOUCIZpceWJfQ/ IQ05i9JMKzmtds+n4F5sxXBEPxs1rCZkl8P7kl+mfxhj2mIxKxZxSTuJI w==; X-CSE-ConnectionGUID: hH3mBGz3RtWL0Bafd2R1Ww== X-CSE-MsgGUID: Z9RURf2uTu65F5zOM91geQ== X-IronPort-AV: E=McAfee;i="6700,10204,11405"; a="45580983" X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="45580983" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:50 -0700 X-CSE-ConnectionGUID: MF/iEYyNSU6GXkSugLdK5g== X-CSE-MsgGUID: YnXKIQDRReGMN8E++T9h1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="135883747" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:49 -0700 Received: from svinhufvud.lan (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 0E3131203B9 for ; Thu, 17 Apr 2025 10:01:46 +0300 (EEST) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Subject: [PATCH 3/5] media: ccs: Use read_poll_timeout() in reset polling Date: Thu, 17 Apr 2025 10:01:42 +0300 Message-Id: <20250417070144.130199-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250417070144.130199-1-sakari.ailus@linux.intel.com> References: <20250417070144.130199-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use read_poll_timeout() in polling the device after a reset, either hard or soft. While at it, improve the related error message. Signed-off-by: Sakari Ailus --- drivers/media/i2c/ccs/ccs-core.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index aeda286a7607..d5c369bbb1b6 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -1588,7 +1588,6 @@ static int ccs_power_on(struct device *dev) * an error. */ if (!sensor->reset && !sensor->xshutdown) { - u8 retry = 100; u32 reset; rval = read_poll_timeout(ccs_write, rval, !rval, @@ -1601,18 +1600,15 @@ static int ccs_power_on(struct device *dev) goto out_cci_addr_fail; } - do { - rval = ccs_read(sensor, SOFTWARE_RESET, &reset); - reset = !rval && reset == CCS_SOFTWARE_RESET_OFF; - if (reset) - break; - - usleep_range(1000, 2000); - } while (--retry); - - if (!reset) { - dev_err(dev, "software reset failed\n"); - rval = -EIO; + rval = read_poll_timeout(ccs_read, rval, + !rval && + reset == CCS_SOFTWARE_RESET_OFF, + CCS_RESET_DELAY_US, + CCS_RESET_TIMEOUT_US, false, sensor, + SOFTWARE_RESET, &reset); + if (rval < 0) { + dev_err_probe(dev, rval, + "failed to respond after reset\n"); goto out_cci_addr_fail; } } From patchwork Thu Apr 17 07:01:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 882131 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A6412185BE for ; Thu, 17 Apr 2025 07:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873313; cv=none; b=pIjRfLxkm/i+nEbE3CGIot5HoT23RomnXUrrJ/fzfiDoRp06IQOQoF9SO/NZSTqO8wRGDZ1bIuIpYVURE8cvtKLWvjYyw7kD9qGIl/ROoy0+ETziEZrz+h3XDmJZTtpqo16rK9GYuLDFRGAy2GQ7M/ItQCnUj1XIEwlsejERvg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873313; c=relaxed/simple; bh=uV9xtJ5sBM40CU/YXcWZBk7jQdhenEQ4GHd3+QbypWA=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=lRmx9/UYlgwzUhFpFFjhfSV6UkoqQyenfb7YNg/uLqwEL3YgSGvMiqRuqkGDUsszsGAkfa49aQrwAI7EcSs/jUq2h57KfnjTsqa3hE827qvZjl7ofZ0FmQerDd3KEaliXoQMqFKLGB+fktKENMFajtDbWpchWhtE5sjhZyBPNV8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=j3tExCs4; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="j3tExCs4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744873312; x=1776409312; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=uV9xtJ5sBM40CU/YXcWZBk7jQdhenEQ4GHd3+QbypWA=; b=j3tExCs4lIGvbLpp1Y8ZecmZ0B3IzNUAzT/s5arjY03onfNscBQfPLFG 93v6J27wuihO0Ca+VhBCjrGUI8Atvx125XcyEXV1LgUDV4twQxbW7T8lf g9irc9CnA2hb7T68szKRKbpIMWgZqeTU2hot2gZETbkI4lxD3E9+bqAus 5ZYda/uDMvOzmBSnXMQ6FD3n4v0GDPup28wQPK/EcR4d+gY4qteNFY0hx NnpeSVoarHrDEnzyH99U9k6Zul3ClqzWX7Y1V7r+rO3yWBsDojr6XNUER ILrbM0FAxI7kF15q9bTN/cWLkQJHArDW08SIztqhvK+N2wvewAT+cqj7D Q==; X-CSE-ConnectionGUID: HDiBFJ+eTD6A3AbbE863ew== X-CSE-MsgGUID: M4OF7I5IRC+fQGN8H1+BTw== X-IronPort-AV: E=McAfee;i="6700,10204,11405"; a="45580985" X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="45580985" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:51 -0700 X-CSE-ConnectionGUID: 8uJXmOKjRc27tuZBulYxwA== X-CSE-MsgGUID: vvr1FnYaRL2DlZfZ/y7ZKg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="135883749" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:50 -0700 Received: from svinhufvud.lan (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 9862C1203F8 for ; Thu, 17 Apr 2025 10:01:47 +0300 (EEST) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Subject: [PATCH 4/5] =?utf-8?q?media=3A_ccs=3A_Remove_I=C2=B2C_write_retry_h?= =?utf-8?q?ack?= Date: Thu, 17 Apr 2025 10:01:43 +0300 Message-Id: <20250417070144.130199-5-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250417070144.130199-1-sakari.ailus@linux.intel.com> References: <20250417070144.130199-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The I²C retry hack has been there in order to address transient I²C register write access issues on a few very old sensors and possibly it has addressed also first I²C access problems (device not responding until a certain amount of time has passed) but that is now separately handled. The retry hack has a good potential for introducing hard to debug problems in updating sensor settings while streaming. Remove it and instead pass those rare errors to the user space -- which is also what virtually all other drivers do. Signed-off-by: Sakari Ailus --- drivers/media/i2c/ccs/ccs-reg-access.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/media/i2c/ccs/ccs-reg-access.c b/drivers/media/i2c/ccs/ccs-reg-access.c index a696a0ec8ff5..fd36889ccc1d 100644 --- a/drivers/media/i2c/ccs/ccs-reg-access.c +++ b/drivers/media/i2c/ccs/ccs-reg-access.c @@ -210,7 +210,6 @@ int ccs_read_addr_noconv(struct ccs_sensor *sensor, u32 reg, u32 *val) */ int ccs_write_addr(struct ccs_sensor *sensor, u32 reg, u32 val) { - unsigned int retries = 10; int rval; rval = ccs_call_quirk(sensor, reg_access, true, ®, &val); @@ -219,13 +218,7 @@ int ccs_write_addr(struct ccs_sensor *sensor, u32 reg, u32 val) if (rval < 0) return rval; - rval = 0; - do { - if (cci_write(sensor->regmap, reg, val, &rval)) - fsleep(1000); - } while (rval && --retries); - - return rval; + return cci_write(sensor->regmap, reg, val, NULL); } #define MAX_WRITE_LEN 32U From patchwork Thu Apr 17 07:01:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 882508 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5028218EBF for ; Thu, 17 Apr 2025 07:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873314; cv=none; b=VCaIXFabtd6y1z8/1j2c1WA10HNNIXCppjHuJVwtdNcK1CD3Emv4qgYU4so5c2UbAzB7XFZnWzOqmi4USPcatGcr057agmcKCNcdWsLFqLzenxdaQ1BFWFeICPcSy1D52wQmhSlRv5OJVaOBdMozuibZJoSxLER7pmUrM3rLdHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744873314; c=relaxed/simple; bh=/CwgvFAPc3Fp/Ke7HXxooCRhHk8Opl9HiU7HfATjmu4=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SS5qVu8iBcBk4Y1B7q80p+N/lNSHc0Zd7Y8hBbqZXbCEdfL3z60SyCD7n51Z7Sg7cvs019vmjmG1AQoVBPaLTNQNblo8dJyWb5R4LaMeueZd0oILuB9owQTMtP0LYTTzG1wWqDVmXF11t77iHCsH61x7K2S26FEAd5Gf9JOEpzc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Q+cv0PQj; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Q+cv0PQj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744873313; x=1776409313; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=/CwgvFAPc3Fp/Ke7HXxooCRhHk8Opl9HiU7HfATjmu4=; b=Q+cv0PQjtIOm0iva50HXoWzF1GcAdY07dNNsmMYq/VkqSm52UQQpKo7J hkiBnEfkBTTfooAgs/OnqKYvx4XeKhGhDoeDV9iOEaD5llyqQzGZ3W9tL 0WUvcZtAmz6dzyxBmHHOCi5ArQJHyfulIJADeb3djfZLX4h4JdQc4Io1w mRLLZxR52a3KCGusR4Tbnjyg6aJhr70pGXQZw9UufSQ9Vbt+Pafr6NqSZ TsOFM8sPzbOJsPgHm+Twd6Bjlb2/8AXmoJzMo5AJj2UBpoehok6I2IQGp 9Y9JWoUFcrB9TjYtFxBaWjsGv3z79CgXVQvqkF+OHa+P3DQNmHXJvB51w Q==; X-CSE-ConnectionGUID: llWqysI1TfKL2WHWMu4XNQ== X-CSE-MsgGUID: POtJ8qLKQJ+07j1ySdjQxQ== X-IronPort-AV: E=McAfee;i="6700,10204,11405"; a="45580987" X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="45580987" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:52 -0700 X-CSE-ConnectionGUID: TM1jjJ33SjmXM1nNUeyTrg== X-CSE-MsgGUID: P2zNPkd6QoGgvH1U6BaDZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,218,1739865600"; d="scan'208";a="135883753" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 00:01:51 -0700 Received: from svinhufvud.lan (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 52C791205A3 for ; Thu, 17 Apr 2025 10:01:48 +0300 (EEST) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Subject: [PATCH 5/5] media: ccs: Don't complain about lack of quirks Date: Thu, 17 Apr 2025 10:01:44 +0300 Message-Id: <20250417070144.130199-6-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250417070144.130199-1-sakari.ailus@linux.intel.com> References: <20250417070144.130199-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Generally any deviance from the standard is handled via CCS static data nowadays and so not having quirks is expected. Don't warn about it. Signed-off-by: Sakari Ailus --- drivers/media/i2c/ccs/ccs-core.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index d5c369bbb1b6..89416afea26e 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -2853,10 +2853,6 @@ static int ccs_identify_module(struct ccs_sensor *sensor) break; } - if (i >= ARRAY_SIZE(ccs_module_idents)) - dev_warn(&client->dev, - "no quirks for this module; let's hope it's fully compliant\n"); - dev_dbg(&client->dev, "the sensor is called %s\n", minfo->name); return 0;