From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753169AbbETMPM (ORCPT ); Wed, 20 May 2015 08:15:12 -0400 Received: from mga14.intel.com ([192.55.52.115]:12294 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752002AbbETMPK (ORCPT ); Wed, 20 May 2015 08:15:10 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,464,1427785200"; d="scan'208";a="496033610" Date: Wed, 20 May 2015 15:15:06 +0300 From: Mika Westerberg To: Jisheng Zhang Cc: wsa@the-dreams.de, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] i2c: designware: separate ops for system_sleep_pm and runtime_pm Message-ID: <20150520121506.GU1490@lahna.fi.intel.com> References: <1431693099-2292-1-git-send-email-jszhang@marvell.com> <20150518082823.GH1490@lahna.fi.intel.com> <20150519203242.74617ad6@xhacker> <20150519131516.GO1490@lahna.fi.intel.com> <20150520193422.73de7d90@xhacker> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150520193422.73de7d90@xhacker> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2015 at 07:34:22PM +0800, Jisheng Zhang wrote: > Sorry for confusion. Considering one platform which doesn't support power off > the i2c host but it can disable the host's clock. So in such platform, when > the host is runtime suspended, its clock is disabled, then i2c_dw_disable() will > hang when s2ram. Right. This happens also when the platform powers off the device. > Except using the runtime pm API to ensure the host is in > a correct state, is there any other solution? AFAIK, 'dev->power.direct_complete' > doesn't help such case. What I had in mind is something like below: static int i2c_dw_prepare(struct device *dev) { return pm_runtime_suspended(dev); } static void i2c_dw_complete(struct device *dev) { if (dev->power.direct_complete) pm_request_resume(dev); } In other words it checks if the device is already runtime suspended and prevents ->suspend() etc. from being called. If that does not work (I didn't try as this problem does not exist on ACPI platforms because we have PM domain handling things) then we do not have much of a choice than do what you suggest and runtime resume the device on ->suspend()