Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp752148imu; Wed, 9 Jan 2019 05:53:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN4XtDYyOx2VLS3iQiAjFQLOJnJ26mtQAmD7O3I+xDQto9DmklhCFcWANSf4MXkM20cAlH7G X-Received: by 2002:a65:4381:: with SMTP id m1mr5382782pgp.358.1547042029507; Wed, 09 Jan 2019 05:53:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547042029; cv=none; d=google.com; s=arc-20160816; b=TjESnIIE5dVAzCoOrXmaKiaKW+Vkd5hstPpMhntXOWfR3FeJBO+wwLKlLYVJ2AmIx8 qEzTL5BdOuO61mpBbnagtiY6WqRYR5FRtk9jh4jK9Fs/svy5Vk9aR3hQzOKgorUqU9R0 LFwL6EjNnW8i5dhs13GRAsJFgW8WhHpRRpQintiMyMUTHTQFAYgNGDNy2vI8X6IbeS7I FtAuiT2LeHlp8mhoI3YpWdw/Gr54r1h1STlvATvc7249mIar+uAovcF4I0+bvTvI7Lo2 IrWlgtqB3Nfo4rkzEgmlPWLUN6tmVAKgNAmppxwKDSSiaedb+116+Y0rOlUfQDfHEvcG Awow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=uz5uxYxK1HuWkuq4WBIHZmJOqodHSuI5mPRxhWnPbgM=; b=0irR2evTu+N9tD8gon7bFXDMXGnp+Xc+sSAblu4K3Ox1w3Asv9EyCb1d7YhmAGaHTR 3PBqWQV6NYKkM92iJGH8t5T0tyCVu14jQlIBRf9RwGKZFyQgjAlaIR2RI26/LE4Zfp5K MGqsiGMpvqKqGjjyOLgPWHFaYESTkgDK/l/w7RpxASg7En3BToH998WPvRwbROdf37SU rav7B61SmJCoXafhiRbtz/o9KfV7sCUncruNBqr70UxPcxmumiCMtH/jUdcW2RGqySfx y3PUaGYqYYr8gokXKHTIy1nH95dTaI5oSi7p/5KWCLlmTNxJJvMekXLC5WjmIMZ/eP65 FVUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fJDHhoEw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cd16si43471893plb.47.2019.01.09.05.53.33; Wed, 09 Jan 2019 05:53:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fJDHhoEw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730936AbfAINKj (ORCPT + 99 others); Wed, 9 Jan 2019 08:10:39 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36878 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730815AbfAINKi (ORCPT ); Wed, 9 Jan 2019 08:10:38 -0500 Received: by mail-wm1-f65.google.com with SMTP id g67so8136052wmd.2 for ; Wed, 09 Jan 2019 05:10:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=uz5uxYxK1HuWkuq4WBIHZmJOqodHSuI5mPRxhWnPbgM=; b=fJDHhoEwxPxjrYsMBPF7tACoNaPdKphvgbdh1qXkMwn+sQpY12OIuKdXqCRpFrLVHx 9wl56/qjFtY0GxSqG8yVxMW1AePvmau/fNzLK/m+DS1fx7OEr9y0Ip+JhcUL99+fXW48 Sfy0ENz7ThgEYU7nNcilFGzcRVOGyUnJ4abhlaCQDEe01mToKrcQiS5LNAoleZR/logS 9oyxCWCJz82nstoWJ2MH1ttEIAOmZNzMExnNIIgJyCffjdqgwiqQhIZRpkSXioQnAxcU GAMZaOopDxR8asG7erQldVvyowEKgYwRFI+6MFFbM1Q9DhcLHlYvYru5Kr//UM9Wbyf0 ap+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=uz5uxYxK1HuWkuq4WBIHZmJOqodHSuI5mPRxhWnPbgM=; b=DxdEeWA+s0RWJ1Cx6F2AhqzXa8uJTWs53NLQEkZ0g6mOmPNoJ0kfjNa8uEdFEHZi8i jo6H4PM4JHGnkPI93j7J1WzFD8PRsMtXm4N1g7j1Qk9n6njboSkw8+/1Q8VXab3N3zKR 6/QeNZWfkR3t3Z831fWFAiXDGcSjkLVxihtqYp1UXdRJtHti6CzTbyE46tiGS+4MdMKc GWxNQCSoBhLbV2+gZV1+eQcA8OmkkD5y6TIqAy4qYToLROKVVtDGuXkeFQb6v12E2ZOn GhptYP8HGhVKEGb6KOmjt/Cib2Bllv7+mQ893HXii4zWCUJhekndUwz0UyVHk7m79Hrx Nruw== X-Gm-Message-State: AJcUukf3/fbKvCyOHvtsrb1cM2jIyicCAYF7MWYyQGwb6qksBFJlQnkY ZcrooBYA09KKaeYV8fGEjTHyhIsAtgY= X-Received: by 2002:a1c:2501:: with SMTP id l1mr5888247wml.102.1547039436239; Wed, 09 Jan 2019 05:10:36 -0800 (PST) Received: from [192.168.0.59] ([195.238.85.143]) by smtp.gmail.com with ESMTPSA id g16sm57950040wru.41.2019.01.09.05.10.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 05:10:35 -0800 (PST) Subject: Re: [PATCH 1/1] mfd: rk808: Prepare rk805 for poweroff To: =?UTF-8?Q?Heiko_St=c3=bcbner?= , Stefan Mavrodiev Cc: linux-rockchip@lists.infradead.org, Lee Jones , open list References: <1538465910-27233-1-git-send-email-stefan@olimex.com> <1917869.4NZ4yPfKWV@diego> From: Stefan Mavrodiev Message-ID: <489e70a8-dbe7-e248-972e-c7de4e0f2c1a@gmail.com> Date: Wed, 9 Jan 2019 15:10:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1917869.4NZ4yPfKWV@diego> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: bg Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/9/19 3:07 PM, Heiko Stübner wrote: > Hi Stefan, Lee, > > Am Dienstag, 2. Oktober 2018, 09:38:29 CET schrieb Stefan Mavrodiev: >> RK805 has SLEEP signal, which can put the device into SLEEP or OFF >> mode. The default is SLEEP mode. >> >> However, when the kernel performs power-off (actually the ATF) the >> device will not go fully off and this will result in higher power >> consumption and inability to wake the device with RTC alarm. >> >> The solution is to enable pm_power_off_prepare function, which will >> configure SLEEP pin for OFF function. >> >> Signed-off-by: Stefan Mavrodiev > just found this while cleaning my inbox and this change looks > significant and it seems hasn't been applied yet. > > I guess this is still relevant, right? Yes, but I guess it's out-of-sync with the latest kernel. > > > Heiko > >> --- >> drivers/mfd/rk808.c | 24 ++++++++++++++++++++++++ >> 1 file changed, 24 insertions(+) >> >> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c >> index 216fbf6..50f3f78 100644 >> --- a/drivers/mfd/rk808.c >> +++ b/drivers/mfd/rk808.c >> @@ -387,6 +387,25 @@ static void rk805_device_shutdown(void) >> dev_err(&rk808_i2c_client->dev, "power off error!\n"); >> } >> >> +static void rk805_device_shutdown_prepare(void) >> +{ >> + int ret; >> + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); >> + >> + if (!rk808) { >> + dev_warn(&rk808_i2c_client->dev, >> + "have no rk805, so do nothing here\n"); >> + >> + return; >> + } >> + >> + ret = regmap_update_bits(rk808->regmap, >> + RK805_GPIO_IO_POL_REG, >> + SLP_SD_MSK, SHUTDOWN_FUN); >> + if (ret) >> + dev_err(&rk808_i2c_client->dev, "power off error!\n"); >> +} >> + >> static void rk808_device_shutdown(void) >> { >> int ret; >> @@ -549,6 +568,10 @@ static int rk808_probe(struct i2c_client *client, >> if (pm_off && !pm_power_off) { >> rk808_i2c_client = client; >> pm_power_off = pm_pwroff_fn; >> + } else if (pm_off && !pm_power_off_prepare && >> + rk808->variant == RK805_ID) { >> + rk808_i2c_client = client; >> + pm_power_off_prepare = rk805_device_shutdown_prepare; >> } >> >> return 0; >> @@ -564,6 +587,7 @@ static int rk808_remove(struct i2c_client *client) >> >> regmap_del_irq_chip(client->irq, rk808->irq_data); >> pm_power_off = NULL; >> + pm_power_off_prepare = NULL; >> >> return 0; >> } > > >