Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1071573ybl; Fri, 6 Dec 2019 10:47:16 -0800 (PST) X-Google-Smtp-Source: APXvYqykZD7QV8PEd2AAWsycEMcq+lN4XTbSqUWenulKEpVUwIGdWfhaEK5IGo4qzmAtyd5nGcKp X-Received: by 2002:aca:120e:: with SMTP id 14mr12862305ois.135.1575658036171; Fri, 06 Dec 2019 10:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575658036; cv=none; d=google.com; s=arc-20160816; b=rcSmM+bHwwtcAimzrSF2n3pRJEo/fsUHWwn57oUSHYW2bP/BfYzrfmybK3PkXzAm+/ T7sqvy8WMpP03ACSuAIhn/PjFiSj3owyrlzdd3PORDGQRZy9EHrcync6xJ6lXeY2zJlJ hPqZYzaBuuF5VPgjJsfiSiLCb/lqNV5Bq1pKJz0VeRk7cNnSyUiGuuoDAG7H5X/nxPFq S436YPT/oNK5javn5XC1+gRZXYCmVh17nTDsWltolYKksOIciTrx0VoBpwmcMBCVtKT5 EVCqC71es9K6yw/l4I9APoM2emgroPXZLwbSWJTD7oHqCIsBDEHIukNNLY0N4AjvL3Za zXig== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4ALlNtT9n//klMFnTtfFii4pRLMXyJbBsPcMcF/Rqyk=; b=uElYiMcbJSLjyWOczBabGTEM1Lz9OWD85wzORs+uw0fc3hSNC5oL94fsX3wh5rez/I bTtdW+v0Mz3EdFXVO+BO9BLjfSRyAwRB45UNUe0sa39UuhDUQSg/bGyk+QnDXq/KRt8h TNBF8+Nqa/BDRd68adbIFX4BUdgJy9n8wvwpEF+32kA+YAOGi/a3RkaFepEABNqpMBdf bfEmzlQxlMGDx0IUktDVnicQ1C5kwRALFvWJFCb+sU4fFykbtfYXNKrAF5vjudrWCxm+ Rgmqy23Xw2zMzJfxSvBqrAHXI1tF/y4RzqQApEGAiENuwgkIPTrmTZ/FKV9rmIJUNSeO 1v8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TFnRVyht; 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 j24si7828092oie.176.2019.12.06.10.47.04; Fri, 06 Dec 2019 10:47:16 -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=TFnRVyht; 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 S1726455AbfLFSqZ (ORCPT + 99 others); Fri, 6 Dec 2019 13:46:25 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39447 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfLFSqY (ORCPT ); Fri, 6 Dec 2019 13:46:24 -0500 Received: by mail-pl1-f193.google.com with SMTP id o9so3072650plk.6; Fri, 06 Dec 2019 10:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4ALlNtT9n//klMFnTtfFii4pRLMXyJbBsPcMcF/Rqyk=; b=TFnRVyhtoot/cjUc7zbP9FvPleB1QnRt3VHm+kqU/jL/ZbvvLAn9EI3E2YIwpPSCLk 5PDSszs2xes7VZVCLdoO3pqAHdhQQYcAZGZvOFw+Z6GpQ7u7m88VSk6SmhR35XRSzJYU M3aZikNJQXwd3v2bHXNTzOdYqQztoqEtQC2MPLyXl6vEepcbp0H4Gu3RKIbl55iMu1H6 qx5uo1c/l/6cunCIiBsdsCtqczGhl51GDRotV1Ch+k0PHQfy8fF6SeAmxCBWKvovIORw XvL3GKPqE5m0E/h+m4fmj7Oz6oy8MGNktXXjlzipi43R5RmCX16MPjYQIHnsRy6bz7Mc w1DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4ALlNtT9n//klMFnTtfFii4pRLMXyJbBsPcMcF/Rqyk=; b=BB5po+x3OyYxQg/Z6Jubj0K9yX4XJ8OWNqC7y/Chxmhn8OKeL6Y9JXdqfJ0KlP707x rJug3Ejr63Fptn0B/MaJp8sVn8/RbtIgeI9FiniWGb4VdL78IIlqk3OFE9DZ+pjm90LD 3FUD+2xEVIfPNLpG7LuQYMy50W38+np10vTga184TQFyzGLoFs0DDrW16B1MsgSaQzB6 rONVN9kv/yzNxh++RpaRQWO7DytjAnSyw/kE00yXTfmzdLRm8+k5rODK3CCdx0aIP0Ms XBjZXVBdlJjIcavIdhb1ah3OyVyjQpA+7FTD+UTRxhx+6JYt8RbEWcQFpZrj4Zwtftam Bcag== X-Gm-Message-State: APjAAAXuhgHI8U7g3Ww80/OJyHnBD3bzYCoVk96W/fQEop78CRSrAAPz 8jspofH4d/XfRhQgIaUpp1I= X-Received: by 2002:a17:902:fe91:: with SMTP id x17mr15451025plm.50.1575657984312; Fri, 06 Dec 2019 10:46:24 -0800 (PST) Received: from localhost.localdomain ([103.51.73.190]) by smtp.gmail.com with ESMTPSA id p4sm16777039pfb.157.2019.12.06.10.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 10:46:23 -0800 (PST) From: Anand Moon To: Rob Herring , Mark Rutland , Heiko Stuebner , Jagan Teki , Manivannan Sadhasivam , Robin Murphy , Daniel Schultz Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFCv1 2/8] mfd: rk808: use syscore for RK805 PMIC shutdown Date: Fri, 6 Dec 2019 18:45:30 +0000 Message-Id: <20191206184536.2507-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191206184536.2507-1-linux.amoon@gmail.com> References: <20191206184536.2507-1-linux.amoon@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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); + 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; -- 2.24.0