From patchwork Wed Nov 22 02:54:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cao, Bingbu" X-Patchwork-Id: 13463874 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SMb97uD0" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1822195 for ; Tue, 21 Nov 2023 18:45:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700621102; x=1732157102; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4+nAuHu2jI7N8dNQ0tAVyaGkr6yner0X9krS38mIEY8=; b=SMb97uD0WN33QASKBfTQk2/2WmeYVqJuh6DvKq5OwsZEsC6hSgJSzu98 Ql850M0jkIWKVwXOBtJrDIrwXEmwZfIxPjKD4eVdShuMUEd5w4jT/HpfN Xa9mUVLYOrJRMU9Iu4bXNhTsaZw65aUvuMI1BxB8Wme4B6UeipXd5jYFh zsbld0XTBIyFtDVLgcwEq6TYORbSS8PK2o0zDCICbvtkHCaXrTuW5Fq4y fJjGuZbIVkb2yAJTKia4LmRFjXoDVkHU/rsScZJSGRVD7zvsVX7ZwXEpA 4/1M6G5irPNJ+ZP7aRpHi3YeuWxEqSSddQF0F6Q1O39VDcZminY0m4/bI g==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="371319997" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="371319997" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 18:45:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="857508570" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="857508570" Received: from icg-kernel3.bj.intel.com ([172.16.126.107]) by FMSMGA003.fm.intel.com with ESMTP; 21 Nov 2023 18:45:00 -0800 From: bingbu.cao@intel.com To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com Cc: hdegoede@redhat.com, bingbu.cao@intel.com, bingbu.cao@linux.intel.com Subject: [PATCH v2 1/4] media: imx355: Enable runtime PM before registering async sub-device Date: Wed, 22 Nov 2023 10:54:07 +0800 Message-ID: <20231122025411.2961572-2-bingbu.cao@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231122025411.2961572-1-bingbu.cao@intel.com> References: <20231122025411.2961572-1-bingbu.cao@intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bingbu Cao As the sensor device maybe accessible right after its async sub-device is registered, such as ipu-bridge will try to power up sensor by sensor's client device's runtime PM from the async notifier callback, if runtime PM is not enabled, it will fail. So runtime PM should be ready before its async sub-device is registered and accessible by others. Signed-off-by: Bingbu Cao --- drivers/media/i2c/imx355.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c index 9c79ae8dc842..059a41b7eefc 100644 --- a/drivers/media/i2c/imx355.c +++ b/drivers/media/i2c/imx355.c @@ -1788,10 +1788,6 @@ static int imx355_probe(struct i2c_client *client) goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor(&imx355->sd); - if (ret < 0) - goto error_media_entity; - /* * Device is already turned on by i2c-core with ACPI domain PM. * Enable runtime PM and turn off the device. @@ -1800,9 +1796,15 @@ static int imx355_probe(struct i2c_client *client) pm_runtime_enable(&client->dev); pm_runtime_idle(&client->dev); + ret = v4l2_async_register_subdev_sensor(&imx355->sd); + if (ret < 0) + goto error_media_entity_runtime_pm; + return 0; -error_media_entity: +error_media_entity_runtime_pm: + pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); media_entity_cleanup(&imx355->sd.entity); error_handler_free: From patchwork Wed Nov 22 02:54:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cao, Bingbu" X-Patchwork-Id: 13463875 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gtHxfubA" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D21DF90 for ; Tue, 21 Nov 2023 18:45:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700621105; x=1732157105; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1Z1ZptD0R5JmHv3gdZvzwl/MhD7h25FarYBaEar7mbk=; b=gtHxfubAfcZEUHc0aTRfhn8xNwEisiImqx4z5ZLAZbPf9xFl3e1KjzYe UM//caZHlxDycfj/1s0NyWOvhV8+2VGI9fp4NERSIZzeLxhUrj4SXYmVI w5akq4KCfNqeADaryReCVBpCvyNgF5W+wnFYKjtEjmSNuJrR1ArG1K9bE 3L/bKkw750/ilnJdBACKXRl4YVpUhFh1f8C7pqiB3KUSTOlPmYGSYXg+G zbBjW4aT1iPANj81iUMEYTo3MrYFa8baZnPEu2ReF72fYDmN70g2E8gKY GiOkIPv9w+kCvRZMZe78UZCR1oxlKRRTXbbicU4epigscU+3+jverwKAa g==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="371320002" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="371320002" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 18:45:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="857508578" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="857508578" Received: from icg-kernel3.bj.intel.com ([172.16.126.107]) by FMSMGA003.fm.intel.com with ESMTP; 21 Nov 2023 18:45:02 -0800 From: bingbu.cao@intel.com To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com Cc: hdegoede@redhat.com, bingbu.cao@intel.com, bingbu.cao@linux.intel.com Subject: [PATCH v2 2/4] media: ov01a10: Enable runtime PM before registering async sub-device Date: Wed, 22 Nov 2023 10:54:08 +0800 Message-ID: <20231122025411.2961572-3-bingbu.cao@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231122025411.2961572-1-bingbu.cao@intel.com> References: <20231122025411.2961572-1-bingbu.cao@intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bingbu Cao As the sensor device maybe accessible right after its async sub-device is registered, such as ipu-bridge will try to power up sensor by sensor's client device's runtime PM from the async notifier callback, if runtime PM is not enabled, it will fail. So runtime PM should be ready before its async sub-device is registered and accessible by others. Signed-off-by: Bingbu Cao --- drivers/media/i2c/ov01a10.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov01a10.c b/drivers/media/i2c/ov01a10.c index 2b9e1b3a3bf4..8e36f91913aa 100644 --- a/drivers/media/i2c/ov01a10.c +++ b/drivers/media/i2c/ov01a10.c @@ -953,17 +953,20 @@ static int ov01a10_probe(struct i2c_client *client) goto err_media_entity_cleanup; } + pm_runtime_enable(dev); + pm_runtime_idle(dev); + ret = v4l2_async_register_subdev_sensor(&ov01a10->sd); if (ret < 0) { dev_err(dev, "Failed to register subdev: %d\n", ret); - goto err_media_entity_cleanup; + goto err_pm_disable; } - pm_runtime_enable(dev); - pm_runtime_idle(dev); - return 0; +err_pm_disable: + pm_runtime_disable(dev); + err_media_entity_cleanup: media_entity_cleanup(&ov01a10->sd.entity); From patchwork Wed Nov 22 02:54:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cao, Bingbu" X-Patchwork-Id: 13463876 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Mfoy0qZO" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 729CECB for ; Tue, 21 Nov 2023 18:45:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700621106; x=1732157106; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FFN3MiIfyati8DoSkLLNj0Hw/egG4l+lyH8qkt+YioU=; b=Mfoy0qZOsCu4rDIYnwFtIotB/RGVwu0VtAHr2g52x169FY8ljDj8K7cu 4DevQYF/qQ0xTreoCwyDjilB5+9UfYv53sj/Xmf5N8XvBs4yvE/Pyr6db ZF1V6HCV3FunSTVp0Xrgs9xUF34sB1DmE7Q+GvEv17zNYKckysltNGvGF cl0M6tgLauRwFa2RrcW6PbPeQI2jwaFITRgxSMh7PStoylfhj+KZ49c4p pqjGNDZodliNP94u0gGjVlg22XYN6++fGOSFek0VyrAl7PbBV0hkB6p++ Q7X8MfTFu4xpiISSaVBGDk0uDFgGYmcLK9WNkbr8NgeWgVhq1ZgYfYN+x A==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="371320010" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="371320010" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 18:45:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="857508583" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="857508583" Received: from icg-kernel3.bj.intel.com ([172.16.126.107]) by FMSMGA003.fm.intel.com with ESMTP; 21 Nov 2023 18:45:04 -0800 From: bingbu.cao@intel.com To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com Cc: hdegoede@redhat.com, bingbu.cao@intel.com, bingbu.cao@linux.intel.com Subject: [PATCH v2 3/4] media: ov13b10: Enable runtime PM before registering async sub-device Date: Wed, 22 Nov 2023 10:54:09 +0800 Message-ID: <20231122025411.2961572-4-bingbu.cao@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231122025411.2961572-1-bingbu.cao@intel.com> References: <20231122025411.2961572-1-bingbu.cao@intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bingbu Cao As the sensor device maybe accessible right after its async sub-device is registered, such as ipu-bridge will try to power up sensor by sensor's client device's runtime PM from the async notifier callback, if runtime PM is not enabled, it will fail. So runtime PM should be ready before its async sub-device is registered and accessible by others. Signed-off-by: Bingbu Cao --- drivers/media/i2c/ov13b10.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c index dbc642c5995b..e8baf0e1b017 100644 --- a/drivers/media/i2c/ov13b10.c +++ b/drivers/media/i2c/ov13b10.c @@ -1536,24 +1536,27 @@ static int ov13b10_probe(struct i2c_client *client) goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor(&ov13b->sd); - if (ret < 0) - goto error_media_entity; /* * Device is already turned on by i2c-core with ACPI domain PM. * Enable runtime PM and turn off the device. */ - /* Set the device's state to active if it's in D0 state. */ if (full_power) pm_runtime_set_active(&client->dev); pm_runtime_enable(&client->dev); pm_runtime_idle(&client->dev); + ret = v4l2_async_register_subdev_sensor(&ov13b->sd); + if (ret < 0) + goto error_media_entity_runtime_pm; + return 0; -error_media_entity: +error_media_entity_runtime_pm: + pm_runtime_disable(&client->dev); + if (full_power) + pm_runtime_set_suspended(&client->dev); media_entity_cleanup(&ov13b->sd.entity); error_handler_free: From patchwork Wed Nov 22 02:54:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cao, Bingbu" X-Patchwork-Id: 13463877 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HHuk/IHr" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7360B199 for ; Tue, 21 Nov 2023 18:45:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700621108; x=1732157108; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bHxhG97nXxoKobkdQjZmIBLlGiJkoiG4o00AJmYrLQ0=; b=HHuk/IHr84kgHhfeDi8S/0QOm5Xz9DGVeBoWqI+JTKbORt6fi5ESY7U0 AumJpM8q5NQab7ugqav1IG9VRi6gdC+7wuFIftoMXXV44Li2mATabX0A1 EcafMMTVnlSISubuPd2Ln9G0IkDOj2XswetOeXmLEJAWKj3Sph7JEBoAk 1djkGyZiL0aGzGOhhuRM2tTzrbzf6CkXofH+Nuwq4ubleuVPtwCKiDXQS waIknZQbqpUYexLcpK6rcYfnBG5fLInbZVeF8xBvQVFezMEleBVi0rgWH 1R3Bro3Pl+9zbQCPMs3sZIlJtCHpHDj3Wyk1kiea+867HFFyicP6hCV6T Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="371320014" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="371320014" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 18:45:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="857508594" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="857508594" Received: from icg-kernel3.bj.intel.com ([172.16.126.107]) by FMSMGA003.fm.intel.com with ESMTP; 21 Nov 2023 18:45:06 -0800 From: bingbu.cao@intel.com To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com Cc: hdegoede@redhat.com, bingbu.cao@intel.com, bingbu.cao@linux.intel.com Subject: [PATCH v2 4/4] media: ov9734: Enable runtime PM before registering async sub-device Date: Wed, 22 Nov 2023 10:54:10 +0800 Message-ID: <20231122025411.2961572-5-bingbu.cao@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231122025411.2961572-1-bingbu.cao@intel.com> References: <20231122025411.2961572-1-bingbu.cao@intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bingbu Cao As the sensor device maybe accessible right after its async sub-device is registered, such as ipu-bridge will try to power up sensor by sensor's client device's runtime PM from the async notifier callback, if runtime PM is not enabled, it will fail. So runtime PM should be ready before its async sub-device is registered and accessible by others. Signed-off-by: Bingbu Cao --- drivers/media/i2c/ov9734.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ov9734.c b/drivers/media/i2c/ov9734.c index b6244772bc59..e4239b77e1d6 100644 --- a/drivers/media/i2c/ov9734.c +++ b/drivers/media/i2c/ov9734.c @@ -984,13 +984,6 @@ static int ov9734_probe(struct i2c_client *client) goto probe_error_v4l2_ctrl_handler_free; } - ret = v4l2_async_register_subdev_sensor(&ov9734->sd); - if (ret < 0) { - dev_err(&client->dev, "failed to register V4L2 subdev: %d", - ret); - goto probe_error_media_entity_cleanup; - } - /* * Device is already turned on by i2c-core with ACPI domain PM. * Enable runtime PM and turn off the device. @@ -999,9 +992,18 @@ static int ov9734_probe(struct i2c_client *client) pm_runtime_enable(&client->dev); pm_runtime_idle(&client->dev); + ret = v4l2_async_register_subdev_sensor(&ov9734->sd); + if (ret < 0) { + dev_err(&client->dev, "failed to register V4L2 subdev: %d", + ret); + goto probe_error_media_entity_cleanup_pm; + } + return 0; -probe_error_media_entity_cleanup: +probe_error_media_entity_cleanup_pm: + pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); media_entity_cleanup(&ov9734->sd.entity); probe_error_v4l2_ctrl_handler_free: