From patchwork Wed Jun 24 09:21:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 50257 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B44E221575 for ; Wed, 24 Jun 2015 09:26:39 +0000 (UTC) Received: by lbbwc1 with SMTP id wc1sf9349442lbb.3 for ; Wed, 24 Jun 2015 02:26:38 -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=8MH5Z0AsL4htPRBW7Lsjth/jYbn5NpuSS+bI93QivOA=; b=Y7bv8QEr5AYiRrnDtpegpBoFhM2+lxJf4dHeeKXqU5L4d5I/uqZU8QebBGYq/88R6r x07pg4cUZUodOd3evr4hBsOpVc3in9qOrdzEZNYYtPkhaYHUVEkSmZBmj547qSE3bxH4 qbRBqyBDlRIEI1jYgS45H6T70oqb6t+xr+ykFFp+GSLnvIoadcLW+RDFNNtayVh4Ijrm Rv1FIPF/p7VQAmtC3L7UBNPXTjzfwTfBPDlTYHhdDVEuE7sFYa3DqX4M/TFmBZF0KFpB cO9SPtw9hgRqmnMWASWNZ2u7UTh+xVmy2m/TFpMLPVvi2U89QIvgzoaQl7IaU74RpZ4J hqfQ== X-Gm-Message-State: ALoCoQldCSwChmwgZ1hngbUmHrUFHg0RTMmY7uxlUMxDmOIpt/dsOH8+G2xRQRvNfo/v6V/hlCvP X-Received: by 10.194.81.136 with SMTP id a8mr5034152wjy.2.1435137998541; Wed, 24 Jun 2015 02:26:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.133 with SMTP id y5ls178523laj.19.gmail; Wed, 24 Jun 2015 02:26:38 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr11731871laj.19.1435137998354; Wed, 24 Jun 2015 02:26:38 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id v9si21133775laz.32.2015.06.24.02.26.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jun 2015 02:26:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lacny3 with SMTP id ny3so22257145lac.3 for ; Wed, 24 Jun 2015 02:26:38 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr40079775laf.32.1435137998261; Wed, 24 Jun 2015 02:26:38 -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 hn6csp3655879lbb; Wed, 24 Jun 2015 02:26:37 -0700 (PDT) X-Received: by 10.68.175.35 with SMTP id bx3mr42768575pbc.128.1435137996401; Wed, 24 Jun 2015 02:26:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gp5si38950074pbb.69.2015.06.24.02.26.35; Wed, 24 Jun 2015 02:26:36 -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 S1752102AbbFXJ0a (ORCPT + 8 others); Wed, 24 Jun 2015 05:26:30 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:33512 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751860AbbFXJ0U (ORCPT ); Wed, 24 Jun 2015 05:26:20 -0400 Received: by pdjn11 with SMTP id n11so26815632pdj.0 for ; Wed, 24 Jun 2015 02:26:20 -0700 (PDT) X-Received: by 10.66.222.130 with SMTP id qm2mr78191687pac.39.1435137980219; Wed, 24 Jun 2015 02:26:20 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by mx.google.com with ESMTPSA id t2sm26032717pdo.81.2015.06.24.02.26.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Jun 2015 02:26:19 -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, Vaibhav Hiremath , Chao Xie Subject: [PATCH-v3 1/3] mfd: 88pm800: Add device tree support Date: Wed, 24 Jun 2015 14:51:11 +0530 Message-Id: <1435137673-1629-2-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435137673-1629-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1435137673-1629-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.49 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 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 841717a..059f01a 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,23 @@ 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) { + dev_err(&client->dev, "failed to allocaate memory\n"); + return -ENOMEM; + } + } + ret = pm80x_init(client); if (ret) { dev_err(&client->dev, "pm800_init fail\n"); @@ -611,6 +635,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,