From patchwork Fri May 29 22:19:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 6511701 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8670DC0020 for ; Fri, 29 May 2015 22:26:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAE152061C for ; Fri, 29 May 2015 22:26:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB2DC20612 for ; Fri, 29 May 2015 22:26:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YyShA-0006d5-GH; Fri, 29 May 2015 22:24:04 +0000 Received: from mail-pa0-f51.google.com ([209.85.220.51]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YySfX-0005gR-TA for linux-arm-kernel@lists.infradead.org; Fri, 29 May 2015 22:22:24 +0000 Received: by pabru16 with SMTP id ru16so69606252pab.1 for ; Fri, 29 May 2015 15:22:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0dRnyG6EDlZhmhM84q83lDkvdTCypRR+ILMo1qdqpyY=; b=NKe4Uks9k3J5vFjJRjDDv1og3x/F4zFqqqnU9b9biLgFFeAXPDrjr8qbkrinnpNf79 /mO4mNgvezP/KQWIPMKcW5AyTPXz4PLQ7vqDcIfgnDjqfh8ZQ6QX6Ju4CmILD7YRjtLj /7D1TMz4K52uQYHfzukpNjy0lOHea8mky8gohQObeYrgmJOfeRB8oAvG55PhsaYQBaWz kq0dsCoDjCRCMhGGqhu3URHdqzPfVlya/80bm1HNsECE462d29grUfMlsXlufmNEltQA B4+LPSJGtcrBgoDlP/VUK/W3S7Wbbx3WTMvpt0Z1Azr5sBKYXmaDmDhkYV0Q8f8EI72+ hlLw== X-Gm-Message-State: ALoCoQmwL9ZBfpmMLs8CBKxgol8zx6EnUgMQyEmRv3BXUxuuZCHX4fzZb/plz6S0owhbIGLXLyvU X-Received: by 10.66.165.67 with SMTP id yw3mr18631602pab.95.1432938122894; Fri, 29 May 2015 15:22:02 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by mx.google.com with ESMTPSA id nb10sm6605761pdb.76.2015.05.29.15.21.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 May 2015 15:22:01 -0700 (PDT) From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] mfd: 88pm800: allocate pdata->rtc if not allocated earlier Date: Sat, 30 May 2015 03:49:22 +0530 Message-Id: <1432937962-4537-5-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432937962-4537-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1432937962-4537-1-git-send-email-vaibhav.hiremath@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150529_152223_980021_E3D78A93 X-CRM114-Status: GOOD ( 13.52 ) X-Spam-Score: -1.8 (-) Cc: devicetree@vger.kernel.org, sameo@linux.intel.com, rtc-linux@googlegroups.com, a.zummo@towertech.it, linux-kernel@vger.kernel.org, Vaibhav Hiremath , robh+dt@kernel.org, alexandre.belloni@free-electrons.com, Chao Xie , lee.jones@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP RTC in pmic 88PM800 can run even the core is powered off, and user can set alarm in RTC. When the alarm is timed out, the PMIC will power up the core, and the whole system will boot up. And during PMIC driver probe, it will read some register to find out whether this boot is caused by RTC timeout or not, and pass on this information to the RTC driver. So we need rtc platform data to be existed in PMIC driver to pass this information. Signed-off-by: Chao Xie Signed-off-by: Vaibhav Hiremath --- drivers/mfd/88pm800.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 8ea4467..34546a1 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -586,6 +586,25 @@ static int pm800_probe(struct i2c_client *client, return ret; } + /* + * RTC in pmic can run even the core is powered off, and user can set + * alarm in RTC. When the alarm is time out, the PMIC will power up + * the core, and the whole system will boot up. When PMIC driver is + * probed, it will read out some register to find out whether this + * boot is caused by RTC timeout or not, and it need pass this + * information to RTC driver. + * So we need rtc platform data to be existed to pass this information. + */ + if (!pdata->rtc) { + pdata->rtc = devm_kzalloc(&client->dev, + sizeof(*(pdata->rtc)), GFP_KERNEL); + if (!pdata->rtc) { + dev_err(&client->dev, + "failed to allocate memory for rtc\n"); + return -ENOMEM; + } + } + ret = pm80x_init(client); if (ret) { dev_err(&client->dev, "pm800_init fail\n");