Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4156481ybl; Mon, 9 Dec 2019 06:24:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxNxgOI1AOXBgybSN1TcUEeZkClYvGZ1dOt3mAQ7dhPvPl6n/rDq6MvcK0vGbU4bPwJWDWH X-Received: by 2002:aca:4e87:: with SMTP id c129mr23413631oib.153.1575901460701; Mon, 09 Dec 2019 06:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575901460; cv=none; d=google.com; s=arc-20160816; b=fTHtjWN0EJeBn3tHQV6qftDTT5K4+6zryu5/n8S0ehM81HOJly9gPNmPFu+viDstnr f5qGqwcmqRNb/N2QbmfMqVO7nTzJjEWZZyLja2EsbZzCdP5B/xG/tU1EjdaixnjNujBb 4NjCFxJatJZQSSkUjYsMdJML2tg32X5miI1mSn97TZ3sRZE/ckJhoBFKHiG2WFNVg+c8 wLWu2YhK4l4YF4K4QEs8znkeqR7UR+i5gVyDfgAqbvj/0WblSjYwqiUiRqCEVbYBzN2Y i/liVu3Symy/rPzAwnIIP2OOHbJsJHu1BhbxKHrXNrENvbTQDtCQ5WZUupcOzX9p4e5p Wmeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ptQ4pGlvKOUD254nljM1IdEgFTGS3gxKwlHKh/StSfs=; b=GDC2oIKIw5nNJ2iwVcTZ4yPEfSzvdaCs1dQSN58SkQJ5b4OtkUv63LYu0CQNKOvGup FXxWHKdEYQKXYb1uPjQFo07BeoN9ZZOUvnK+AliI5e0VmYrijl78CnWfkPhlSDL4CyYY nN9RLvCq46/cXhg2QOf5c8Eqb4rXjWz/+HzHvs8i1gUVSFf+m/RKutpk/7PGvdJDg/M5 q55sgsb5ECaSmk6RKOyNsGNX/ayDakpDcF++SXB2afO5+ACy6scmXgycFKrlcdKCRWwh x9rPD7vZL6d3toGeJqiP3fWujTbP4yUayQVWFzVqOyfpaOV1T+3otUhfzuP4vIAYBOJ+ xofw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v25si10729911oth.136.2019.12.09.06.24.08; Mon, 09 Dec 2019 06:24:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727708AbfLINeQ (ORCPT + 99 others); Mon, 9 Dec 2019 08:34:16 -0500 Received: from foss.arm.com ([217.140.110.172]:60694 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727438AbfLINeP (ORCPT ); Mon, 9 Dec 2019 08:34:15 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5E694328; Mon, 9 Dec 2019 05:34:14 -0800 (PST) Received: from [10.1.196.37] (e121345-lin.cambridge.arm.com [10.1.196.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D5B0F3F718; Mon, 9 Dec 2019 05:34:12 -0800 (PST) Subject: Re: [RFCv1 2/8] mfd: rk808: use syscore for RK805 PMIC shutdown To: Anand Moon , Rob Herring , Mark Rutland , Heiko Stuebner , Jagan Teki , Manivannan Sadhasivam , Daniel Schultz Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org References: <20191206184536.2507-1-linux.amoon@gmail.com> <20191206184536.2507-3-linux.amoon@gmail.com> From: Robin Murphy Message-ID: Date: Mon, 9 Dec 2019 13:34:09 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191206184536.2507-3-linux.amoon@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/12/2019 6:45 pm, Anand Moon wrote: > Use common syscore_shutdown for RK805 PMIC to do > clean I2C shutdown, drop the unused pm_pwroff_prep_fn > and pm_pwroff_fn function pointers. Coincidentally, I've also been looking at RK805 for the sake of trying to get suspend to behave on my RK3328 box, and I've ended up with some slightly different cleanup patches - I'll tidy them up and post them for comparison as soon as I can. > Cc: Heiko Stuebner > Signed-off-by: Anand Moon > --- > drivers/mfd/rk808.c | 33 +++++++++++++++++---------------- > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c > index e637f5bcc8bb..713d989064ba 100644 > --- a/drivers/mfd/rk808.c > +++ b/drivers/mfd/rk808.c > @@ -467,16 +467,6 @@ static void rk808_update_bits(unsigned int reg, unsigned int mask, > "can't write to register 0x%x: %x!\n", reg, ret); > } > > -static void rk805_device_shutdown(void) > -{ > - rk808_update_bits(RK805_DEV_CTRL_REG, DEV_OFF, DEV_OFF); > -} > - > -static void rk805_device_shutdown_prepare(void) > -{ > - rk808_update_bits(RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SHUTDOWN_FUN); > -} > - > static void rk808_device_shutdown(void) > { > rk808_update_bits(RK808_DEVCTRL_REG, DEV_OFF_RST, DEV_OFF_RST); > @@ -491,10 +481,23 @@ static void rk8xx_syscore_shutdown(void) > { > struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); > > - if (system_state == SYSTEM_POWER_OFF && > - (rk808->variant == RK809_ID || rk808->variant == RK817_ID)) { > - rk808_update_bits(RK817_SYS_CFG(3), RK817_SLPPIN_FUNC_MSK, > - SLPPIN_DN_FUN); > + if (system_state == SYSTEM_POWER_OFF) { > + dev_info(&rk808_i2c_client->dev, "System Shutdown Event\n"); > + > + switch (rk808->variant) { > + case RK805_ID: > + rk808_update_bits(RK805_GPIO_IO_POL_REG, > + SLP_SD_MSK, SHUTDOWN_FUN); > + rk808_update_bits(RK805_DEV_CTRL_REG, DEV_OFF, DEV_OFF); Why this change? Shutdown via the SLEEP pin is working just fine on my box :/ Robin. > + break; > + case RK809_ID: > + case RK817_ID: > + rk808_update_bits(RK817_SYS_CFG(3), > + RK817_SLPPIN_FUNC_MSK, SLPPIN_DN_FUN); > + break; > + default: > + break; > + } > } > } > > @@ -565,8 +568,6 @@ static int rk808_probe(struct i2c_client *client, > nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg); > cells = rk805s; > nr_cells = ARRAY_SIZE(rk805s); > - rk808->pm_pwroff_fn = rk805_device_shutdown; > - rk808->pm_pwroff_prep_fn = rk805_device_shutdown_prepare; > break; > case RK808_ID: > rk808->regmap_cfg = &rk808_regmap_config; >