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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 162FAEE6425 for ; Fri, 15 Sep 2023 07:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbjIOH2q (ORCPT ); Fri, 15 Sep 2023 03:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbjIOH2m (ORCPT ); Fri, 15 Sep 2023 03:28:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08E881BEB for ; Fri, 15 Sep 2023 00:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694762910; x=1726298910; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hdyy9ST1OkBbRQlL3dXvqnxajJYXCjA7MX6OUo0CpyI=; b=blozzlrcibn45kxqDJGupviO2yaL48H8feMrMArcikjM37fcBdGEU2SQ 0lnyT5+RyFDxjWOHVm2LhRomLIc3SCwJ/8HC9oDRVoZPhMBs+Sw5jtZSY LPRQPduMPP0tUm6OTi73q0dEbyZ7OXwBM0UTfoKVspTWtTEpCxRhr1uoG jNiWtSC4xHcfbtdmC81TMSF3VVxuX9jnhwqSsfJ9oywMBx5Icdg/fgcgC AgFnM7WQRCw/OYr5eCqND/pweRqfyHdr5GeMS2DeXF3ywzmg0OI3eZSRi IZdrqx4QIA+H6WxIIsTaCTy98sKWUaus7Bqdct5TgPwYJ4fq3x1AdiLgD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="465548726" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="465548726" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 00:28:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="888133120" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="888133120" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 00:27:45 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id CEBBF11F831; Fri, 15 Sep 2023 10:28:16 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, Tianshu Qiu , Bingbu Cao , Tomi Valkeinen , Jacopo Mondi Subject: [PATCH 5/7] media: ov2740: Enable runtime PM before registering the async subdev Date: Fri, 15 Sep 2023 10:28:07 +0300 Message-Id: <20230915072809.37886-6-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230915072809.37886-1-sakari.ailus@linux.intel.com> References: <20230915072809.37886-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Enable runtime PM before registering the async sub-device as the ipu bridge may try to resume the device immediately after the async sub-device has been registered. If runtime PM is still disabled, this will fail. Signed-off-by: Sakari Ailus --- drivers/media/i2c/ov2740.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index 41d4f85470fd..319dc00e47b4 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -1172,6 +1172,12 @@ static int ov2740_probe(struct i2c_client *client) goto probe_error_v4l2_ctrl_handler_free; } + /* 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(&ov2740->sd); if (ret < 0) { dev_err_probe(dev, ret, "failed to register V4L2 subdev\n"); @@ -1182,16 +1188,12 @@ static int ov2740_probe(struct i2c_client *client) if (ret) dev_warn(&client->dev, "register nvmem failed, ret %d\n", ret); - /* 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); - return 0; probe_error_media_entity_cleanup: media_entity_cleanup(&ov2740->sd.entity); + pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); probe_error_v4l2_ctrl_handler_free: v4l2_ctrl_handler_free(ov2740->sd.ctrl_handler); -- 2.39.2