From nobody Sun Nov 24 23:07:06 2024 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 3C5CF153BF8; Fri, 1 Nov 2024 09:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730454097; cv=none; b=RwqizV05oWXtgLWwucOpcPI+cbObTEvBDIzlFzqVJmKsIX2uS9VJrxzFGV+hFmZ4cWZMohOwG/psd9D0oT90vRaX6kUlAhCH1DpvwOcKHX4GOo5Iisjinf//yapMFphYyNTBc4lflaL2QQ9i0EQrzzuIe5bxKB5tkU7gBTxMuX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730454097; c=relaxed/simple; bh=B4sqT1zWc7Cadh52ZfLpGKGgABwSPJW8mkWiaiyf9/k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a1HamFYChulyBn/Ys6QbwOyo8Ns/tumSLy6CUbVLcoeaJ76+zulp0lhZb38TVYu47vtLcJ/IBlyVP549sTByQWQCwc9Bsyv9erDywVdZkAtHNCJ85uRc0J/pBamQDIHxLYTU68+VzINVH0gjljNE/b+DKR5O67U1a3mwRgKDvXM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Xfwn45RRlzlXGs; Fri, 1 Nov 2024 17:39:36 +0800 (CST) Received: from kwepemg200008.china.huawei.com (unknown [7.202.181.35]) by mail.maildlp.com (Postfix) with ESMTPS id E510618005F; Fri, 1 Nov 2024 17:41:31 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemg200008.china.huawei.com (7.202.181.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 1 Nov 2024 17:41:31 +0800 From: Jinjie Ruan To: , , , , , , , , , , , CC: , Subject: [PATCH v2 1/3] media: i2c: dw9768: Fix pm_runtime_set_suspended() with runtime pm enabled Date: Fri, 1 Nov 2024 17:40:48 +0800 Message-ID: <20241101094050.2421038-2-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241101094050.2421038-1-ruanjinjie@huawei.com> References: <20241101094050.2421038-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemg200008.china.huawei.com (7.202.181.35) Content-Type: text/plain; charset="utf-8" It is not valid to call pm_runtime_set_suspended() and pm_runtime_set_active() for devices with runtime PM enabled because it returns -EAGAIN if it is enabled already and working. So, adjust the order to fix it. Cc: stable@vger.kernel.org Fixes: 5f9a089b6de3 ("dw9768: Enable low-power probe on ACPI") Suggested-by: Sakari Ailus Signed-off-by: Jinjie Ruan --- v2: - !pm_runtime_enabled() check -> !IS_ENABLED(CONFIG_PM). - Add suggested-by. - Cc stable. --- drivers/media/i2c/dw9768.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c index 18ef2b35c9aa..87a7c3ceeb11 100644 --- a/drivers/media/i2c/dw9768.c +++ b/drivers/media/i2c/dw9768.c @@ -471,10 +471,9 @@ static int dw9768_probe(struct i2c_client *client) * to be powered on in an ACPI system. Similarly for power off in * remove. */ - pm_runtime_enable(dev); full_power =3D (is_acpi_node(dev_fwnode(dev)) && acpi_dev_state_d0(dev)) || - (is_of_node(dev_fwnode(dev)) && !pm_runtime_enabled(dev)); + (is_of_node(dev_fwnode(dev)) && !IS_ENABLED(CONFIG_PM)); if (full_power) { ret =3D dw9768_runtime_resume(dev); if (ret < 0) { @@ -484,6 +483,7 @@ static int dw9768_probe(struct i2c_client *client) pm_runtime_set_active(dev); } =20 + pm_runtime_enable(dev); ret =3D v4l2_async_register_subdev(&dw9768->sd); if (ret < 0) { dev_err(dev, "failed to register V4L2 subdev: %d", ret); @@ -495,12 +495,12 @@ static int dw9768_probe(struct i2c_client *client) return 0; =20 err_power_off: + pm_runtime_disable(dev); if (full_power) { dw9768_runtime_suspend(dev); pm_runtime_set_suspended(dev); } err_clean_entity: - pm_runtime_disable(dev); media_entity_cleanup(&dw9768->sd.entity); err_free_handler: v4l2_ctrl_handler_free(&dw9768->ctrls); @@ -517,12 +517,12 @@ static void dw9768_remove(struct i2c_client *client) v4l2_async_unregister_subdev(&dw9768->sd); v4l2_ctrl_handler_free(&dw9768->ctrls); media_entity_cleanup(&dw9768->sd.entity); + pm_runtime_disable(dev); if ((is_acpi_node(dev_fwnode(dev)) && acpi_dev_state_d0(dev)) || - (is_of_node(dev_fwnode(dev)) && !pm_runtime_enabled(dev))) { + (is_of_node(dev_fwnode(dev)) && !IS_ENABLED(CONFIG_PM))) { dw9768_runtime_suspend(dev); pm_runtime_set_suspended(dev); } - pm_runtime_disable(dev); } =20 static const struct of_device_id dw9768_of_table[] =3D { --=20 2.34.1 From nobody Sun Nov 24 23:07:06 2024 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 3C62715667B; Fri, 1 Nov 2024 09:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730454097; cv=none; b=L6jiEUiWfb8dFOaNUYqawuOLJuQRT/zT0715UWASs3X9U7JDBaqB5A224v03gXTipCsBBWYMQmESs3ze5hga88SRKHECyfpci/qG+H22TpU5stzToHG4Jvvx2akWQHvnCFIKnlrSOHsF3xiTaZOUqgO9EdmaKYCARuAYjgH6d0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730454097; c=relaxed/simple; bh=EDUkQtfNBeqggKtTDqGaUGqzrG/JbmviQpQegALOkIQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lpJjQCo7EqyIjbSmP5i6mWEY0TP9FYXVN0bpKOyhCNHS1KGgwYtky4rRjbaSv8fc8hIFd4pcT8FMZxtMQWrSK+LwkMaWO9hdkbtcXabeBF1SAq+0xBAX4bGB7pJrkbEbfru7roHca2Hcw34a+UInhSnFLYSCt5UnJI1cZgorENE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4XfwmK6bqGzdkXj; Fri, 1 Nov 2024 17:38:57 +0800 (CST) Received: from kwepemg200008.china.huawei.com (unknown [7.202.181.35]) by mail.maildlp.com (Postfix) with ESMTPS id 6E1A2180115; Fri, 1 Nov 2024 17:41:32 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemg200008.china.huawei.com (7.202.181.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 1 Nov 2024 17:41:31 +0800 From: Jinjie Ruan To: , , , , , , , , , , , CC: , Subject: [PATCH v2 2/3] media: amphion: Fix pm_runtime_set_suspended() with runtime pm enabled Date: Fri, 1 Nov 2024 17:40:49 +0800 Message-ID: <20241101094050.2421038-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241101094050.2421038-1-ruanjinjie@huawei.com> References: <20241101094050.2421038-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemg200008.china.huawei.com (7.202.181.35) Content-Type: text/plain; charset="utf-8" It is not valid to call pm_runtime_set_suspended() for devices with runtime PM enabled because it returns -EAGAIN if it is enabled already and working. So, call pm_runtime_disable() before to fix it. Cc: stable@vger.kernel.org Fixes: b50a64fc54af ("media: amphion: add amphion vpu device driver") Signed-off-by: Jinjie Ruan Reviewed-by: Bryan O'Donoghue --- v2: - Add fix tag. - Add Cc stable. --- drivers/media/platform/amphion/vpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_drv.c b/drivers/media/platf= orm/amphion/vpu_drv.c index 2bf70aafd2ba..51d5234869f5 100644 --- a/drivers/media/platform/amphion/vpu_drv.c +++ b/drivers/media/platform/amphion/vpu_drv.c @@ -151,8 +151,8 @@ static int vpu_probe(struct platform_device *pdev) media_device_cleanup(&vpu->mdev); v4l2_device_unregister(&vpu->v4l2_dev); err_vpu_deinit: - pm_runtime_set_suspended(dev); pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); =20 return ret; } --=20 2.34.1 From nobody Sun Nov 24 23:07:06 2024 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (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 A37AC156C71; Fri, 1 Nov 2024 09:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730454098; cv=none; b=TJZq8oCoykug/JTpKQ/dzBGcMPiZuS5cBpeOk6vmy5PN/JOEGnnbP/Opzam/XY8niGJ1Kb5GHl1R4SP0blalXzK01ZmtUNyAkKX/mQPbMtEKQfZRw93dmUMr0rioJIo37C3w82xJYRaCORNK3bw6yk1qfcSGuKJnlOsZqIl1vLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730454098; c=relaxed/simple; bh=WgGBNRaDj18Fmg/UzNoNhKY/fpm/63w6fDav6PV+78s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=No9VWnBazraxh3sUUrmlUKuzcxFvXA0b4XcfwG6yIt6wAUQMbEzGJBMjwjQpwVNyrL1s/wGrSK8l7NWfdmExs1DW4mcj5hC834GZYIgcDnt+5sJBmBlnmhBIEdoUqkRqE5fnQ3AFgzxPof/fi9lNZvBE3oV6nFPozXu/5ifK0qk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Xfwml4HXNz1T9Tg; Fri, 1 Nov 2024 17:39:19 +0800 (CST) Received: from kwepemg200008.china.huawei.com (unknown [7.202.181.35]) by mail.maildlp.com (Postfix) with ESMTPS id F140218005F; Fri, 1 Nov 2024 17:41:32 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemg200008.china.huawei.com (7.202.181.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 1 Nov 2024 17:41:32 +0800 From: Jinjie Ruan To: , , , , , , , , , , , CC: , Subject: [PATCH v2 3/3] media: venus: Fix pm_runtime_set_suspended() with runtime pm enabled Date: Fri, 1 Nov 2024 17:40:50 +0800 Message-ID: <20241101094050.2421038-4-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241101094050.2421038-1-ruanjinjie@huawei.com> References: <20241101094050.2421038-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemg200008.china.huawei.com (7.202.181.35) Content-Type: text/plain; charset="utf-8" It is not valid to call pm_runtime_set_suspended() for devices with runtime PM enabled because it returns -EAGAIN if it is enabled already and working. So, call pm_runtime_disable() before to fix it. Cc: stable@vger.kernel.org Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper fun= ctions") Signed-off-by: Jinjie Ruan Acked-by: Stanimir Varbanov Reviewed-by: Bryan O'Donoghue --- v2: - Add Cc stable. --- drivers/media/platform/qcom/venus/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index 84e95a46dfc9..cabcf710c046 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -412,8 +412,8 @@ static int venus_probe(struct platform_device *pdev) of_platform_depopulate(dev); err_runtime_disable: pm_runtime_put_noidle(dev); - pm_runtime_set_suspended(dev); pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); hfi_destroy(core); err_core_deinit: hfi_core_deinit(core, false); --=20 2.34.1