From patchwork Mon Jun 29 15:31:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 50430 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 0225B228D9 for ; Mon, 29 Jun 2015 15:38:11 +0000 (UTC) Received: by wiar9 with SMTP id r9sf15061100wia.1 for ; Mon, 29 Jun 2015 08:38:10 -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=R0kF0KvBX/UCbRc4rw9gSVyx07ovxwJpQ+8ncHHeAO8=; b=ju8MLEF8cNgLO5q18AmTbaJCefnyf8RkNJaWo44LufEgkK9DKI/+A8JMYAy/7rgcTq vWqg6ubIBDRo/PVs2GvYv3YyWYykQEdqCNwyXwC2zJsgPlA0+R9jTFtjRFiGybCWK//K peWO7w0McdCiNnT96USYWhcmiHXaN7/oczKrW3KKOIlzDbY5W72/KjCUBeRxJoPD5SfP 9IvTrKrg35zWRp1gTDRUMkH8K63RE61ghdx7UluwhITdKqJIfA3/7IOpj7tIX0VrR5/w mM3QFDkI6n2ngrJzYmOXbp/9rYf43c8tLIbJS+9UQva0g6/+xYrDo3haVYOu1tbUMtoE iR5Q== X-Gm-Message-State: ALoCoQkq3dEqQssUA7hzyEJOoSA51+pqZpib4MENtcPLzchkLZ8pTbQOxZn9CrVUA/zM1UmxPMaU X-Received: by 10.180.106.10 with SMTP id gq10mr8991680wib.0.1435592290217; Mon, 29 Jun 2015 08:38:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.10 with SMTP id p10ls804979lag.29.gmail; Mon, 29 Jun 2015 08:38:10 -0700 (PDT) X-Received: by 10.152.206.10 with SMTP id lk10mr14790912lac.90.1435592290053; Mon, 29 Jun 2015 08:38:10 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id ci2si715328lbd.65.2015.06.29.08.38.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2015 08:38:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lagh6 with SMTP id h6so58583162lag.2 for ; Mon, 29 Jun 2015 08:38:10 -0700 (PDT) X-Received: by 10.152.5.167 with SMTP id t7mr9614840lat.112.1435592289952; Mon, 29 Jun 2015 08:38:09 -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 hn6csp1790164lbb; Mon, 29 Jun 2015 08:38:08 -0700 (PDT) X-Received: by 10.68.181.163 with SMTP id dx3mr32843858pbc.5.1435592277319; Mon, 29 Jun 2015 08:37:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yl2si64899832pbc.89.2015.06.29.08.37.56; Mon, 29 Jun 2015 08:37:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 S1753579AbbF2Phm (ORCPT + 8 others); Mon, 29 Jun 2015 11:37:42 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:33802 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753242AbbF2PgO (ORCPT ); Mon, 29 Jun 2015 11:36:14 -0400 Received: by pdbep18 with SMTP id ep18so96941060pdb.1 for ; Mon, 29 Jun 2015 08:36:12 -0700 (PDT) X-Received: by 10.66.66.46 with SMTP id c14mr33419500pat.71.1435592172560; Mon, 29 Jun 2015 08:36:12 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by mx.google.com with ESMTPSA id fq2sm2772621pdb.35.2015.06.29.08.36.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Jun 2015 08:36:11 -0700 (PDT) From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Cc: devicetree@vger.kernel.org, robh+dt@kernel.org, sameo@linux.intel.com, lee.jones@linaro.org, linux-kernel@vger.kernel.org, yizhang@marvell.com, Vaibhav Hiremath , Chao Xie Subject: [PATCH-V5 1/4] mfd: 88pm800: Add device tree support Date: Mon, 29 Jun 2015 21:01:14 +0530 Message-Id: <1435591877-18214-2-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435591877-18214-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1435591877-18214-1-git-send-email-vaibhav.hiremath@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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.215.47 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 Acked-by: Lee Jones --- 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,