From patchwork Thu Jun 25 07:26:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 50303 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54AC8228FC for ; Thu, 25 Jun 2015 07:32:28 +0000 (UTC) Received: by wiws10 with SMTP id s10sf19315540wiw.2 for ; Thu, 25 Jun 2015 00:32:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=hefacWGcbv7d/HiKCASbmk0T0csEovTlRBHkTeQE39E=; b=WDGiB0WUKUih3qfEAMyjkXbjHqmxNNWxg4LD1iJu6jD7VYulbC1f+6vcGXOIek/DcF 0GEDffFmQZ35DFgSJv14lfzpYGXxhf7BmwHxYxvDGdwCZHVTSJJxI7nl2vtYJ6nHNERW aGlvw/PoDQPBoNmnp+IGEl+e1vZghMSkgI+EzAeVOCvsDpC0jlycXygO/Mp0Ffuq9D7G eE5XWV1eBw4LNswbML1e1JlC3k2nAHIEKcS4wLA8NlpyX437g/0Vwl5WIdW2bNablv4H /2dVxMlFOxJNS4dw5GtdskhJ3h0MoFaZQdleyhH9479hzmYRojMtWGt9bMdiJ95JquKN dRqQ== X-Gm-Message-State: ALoCoQm0CkLeI2It294CuWK+zZeor5B2+Mu7+7Z/e2Y+jLpT5TIZg3NNk9fVRPmgSCKxv6PgLSQS X-Received: by 10.112.166.137 with SMTP id zg9mr38882981lbb.11.1435217547686; Thu, 25 Jun 2015 00:32:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.73 with SMTP id y9ls263984lay.18.gmail; Thu, 25 Jun 2015 00:32:27 -0700 (PDT) X-Received: by 10.112.164.66 with SMTP id yo2mr22349746lbb.33.1435217547490; Thu, 25 Jun 2015 00:32:27 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id o1si24015560lbc.8.2015.06.25.00.32.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2015 00:32:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbpo10 with SMTP id po10so39976672lbb.3 for ; Thu, 25 Jun 2015 00:32:27 -0700 (PDT) X-Received: by 10.112.42.50 with SMTP id k18mr15487749lbl.76.1435217547064; Thu, 25 Jun 2015 00:32:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp405192lbb; Thu, 25 Jun 2015 00:32:25 -0700 (PDT) X-Received: by 10.70.6.161 with SMTP id c1mr19562209pda.76.1435217545189; Thu, 25 Jun 2015 00:32:25 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fe3si20592180pad.183.2015.06.25.00.32.24; Thu, 25 Jun 2015 00:32:25 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751637AbbFYHcU (ORCPT + 30 others); Thu, 25 Jun 2015 03:32:20 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:35729 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752001AbbFYHbz (ORCPT ); Thu, 25 Jun 2015 03:31:55 -0400 Received: by pdbci14 with SMTP id ci14so47753832pdb.2 for ; Thu, 25 Jun 2015 00:31:53 -0700 (PDT) X-Received: by 10.66.141.137 with SMTP id ro9mr86804934pab.152.1435217513706; Thu, 25 Jun 2015 00:31:53 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by mx.google.com with ESMTPSA id nl10sm29020111pdb.38.2015.06.25.00.31.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Jun 2015 00:31:52 -0700 (PDT) From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lee.jones@linaro.org, robh+dt@kernel.org, yizhang@marvell.com, Vaibhav Hiremath , Chao Xie Subject: [PATCH-v4 1/3] mfd: 88pm800: Add device tree support Date: Thu, 25 Jun 2015 12:56:27 +0530 Message-Id: <1435217189-19578-2-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435217189-19578-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1435217189-19578-1-git-send-email-vaibhav.hiremath@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vaibhav.hiremath@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add DT support to the 88pm800 driver, along with compatible field for it's sub-devices (rtc, onkey and regulator) Signed-off-by: Chao Xie Signed-off-by: Vaibhav Hiremath --- drivers/mfd/88pm800.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 841717a..40fd014 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -27,6 +27,7 @@ #include #include #include +#include /* Interrupt Registers */ #define PM800_INT_STATUS1 (0x05) @@ -121,6 +122,11 @@ static const struct i2c_device_id pm80x_id_table[] = { }; MODULE_DEVICE_TABLE(i2c, pm80x_id_table); +static const struct of_device_id pm80x_of_match_table[] = { + { .compatible = "marvell,88pm800", }, + {}, +}; + static struct resource rtc_resources[] = { { .name = "88pm80x-rtc", @@ -133,6 +139,7 @@ static struct resource rtc_resources[] = { static struct mfd_cell rtc_devs[] = { { .name = "88pm80x-rtc", + .of_compatible = "marvell,88pm80x-rtc", .num_resources = ARRAY_SIZE(rtc_resources), .resources = &rtc_resources[0], .id = -1, @@ -151,6 +158,7 @@ static struct resource onkey_resources[] = { static const struct mfd_cell onkey_devs[] = { { .name = "88pm80x-onkey", + .of_compatible = "marvell,88pm80x-onkey", .num_resources = 1, .resources = &onkey_resources[0], .id = -1, @@ -160,6 +168,7 @@ static const struct mfd_cell onkey_devs[] = { static const struct mfd_cell regulator_devs[] = { { .name = "88pm80x-regulator", + .of_compatible = "marvell,88pm80x-regulator", .id = -1, }, }; @@ -544,8 +553,21 @@ static int pm800_probe(struct i2c_client *client, int ret = 0; struct pm80x_chip *chip; struct pm80x_platform_data *pdata = dev_get_platdata(&client->dev); + struct device_node *np = client->dev.of_node; struct pm80x_subchip *subchip; + if (!pdata && !np) { + dev_err(&client->dev, + "pm80x requires platform data or of_node\n"); + return -EINVAL; + } + + if (!pdata) { + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + } + ret = pm80x_init(client); if (ret) { dev_err(&client->dev, "pm800_init fail\n"); @@ -611,6 +633,7 @@ static struct i2c_driver pm800_driver = { .name = "88PM800", .owner = THIS_MODULE, .pm = &pm80x_pm_ops, + .of_match_table = pm80x_of_match_table, }, .probe = pm800_probe, .remove = pm800_remove,