From patchwork Mon Dec 3 12:12:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 13330 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DD93C23E27 for ; Mon, 3 Dec 2012 12:09:09 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 702A7A180D9 for ; Mon, 3 Dec 2012 12:09:09 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so3796535ieb.11 for ; Mon, 03 Dec 2012 04:09:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :dlp-filter:x-mtr:x-brightmail-tracker:x-brightmail-tracker :x-cfilter-loop:x-gm-message-state; bh=CSWMZf361PnjgV6WwOtHtAeU2rYoAEwApf5AcpL6ZpA=; b=TDULNiJ0mFGlWTMkLlrfRHGxtPbgvx8bYS7AKJ/IERUVbeODakTMRQVbN+Ui9NxdJ3 HkRJNW8b8OFPb85t9mvZF5yX1PNlm16fKfXJ+jI5w9PJwOpJWXkwJgq9y37b2zpTAM/k 8U6mkAPbwCkTjTW20A42apbm+OnrJ6kAUfLjt5HONgH2mbMm/LOPPjNF42j3Uv5kVdU7 DkzXjzaqNt3t3pUvAxdqxroulJkBZdhtiDFSNxjSy0T/GT+aIFzOb1THCRO20Sd7S12L WT0z+8TD1DaQsqSMuVUmoSpHJIXCEzXx6NOwJfgK/nul9U14+Xwj/PEy1R9BZHXnBwm5 +9Ew== Received: by 10.50.187.197 with SMTP id fu5mr5888481igc.70.1354536548742; Mon, 03 Dec 2012 04:09:08 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp131564igt; Mon, 3 Dec 2012 04:09:08 -0800 (PST) Received: by 10.66.9.2 with SMTP id v2mr25323188paa.18.1354536547816; Mon, 03 Dec 2012 04:09:07 -0800 (PST) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id a6si18521866paw.342.2012.12.03.04.09.07; Mon, 03 Dec 2012 04:09:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.25 as permitted sender) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.25 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEG00MQ6F36WC10@mailout2.samsung.com>; Mon, 03 Dec 2012 21:09:06 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 82.67.12699.2669CB05; Mon, 03 Dec 2012 21:09:06 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-bc-50bc9662f8ca Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E1.67.12699.1669CB05; Mon, 03 Dec 2012 21:09:05 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEG00DHAEYBTR70@mmp1.samsung.com>; Mon, 03 Dec 2012 21:09:05 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, l.majewski@samsung.com Subject: [PATCH 3/3] PMIC: MAX77686: Add FDT Support Date: Mon, 03 Dec 2012 17:42:20 +0530 Message-id: <1354536740-28485-4-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1354536740-28485-1-git-send-email-rajeshwari.s@samsung.com> References: <1354536740-28485-1-git-send-email-rajeshwari.s@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRmVeSWpSXmKPExsWyRsSkTjdp2p4Ag9cXBS0err/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlvH+7ib1gI29Fw4FNLA2MS7i6GDk5JARMJKZOmscC YYtJXLi3nq2LkYtDSGApo8SRlr1McEUHWxghEosYJXovbGGCcCYySbx8sAqsik3ASGLryWmM ILaIgITEr/6rYDazQInEt2/drCC2MNCkFbdXs4PYLAKqEiufTgGr4RXwkOidf40RYpuCxLGp X8HqOQU8Jf6cugQ2XwioZtOF/cwQvQIS3yYfAjqbA6heVmLTAWaQeyQEbrNJTN1xF2qOpMTB FTdYJjAKL2BkWMUomlqQXFCclJ5rpFecmFtcmpeul5yfu4kRGJCn/z2T3sG4qsHiEKMAB6MS D+/DL7sDhFgTy4orcw8xSnAwK4nwurXsCRDiTUmsrEotyo8vKs1JLT7E6AN0yURmKdHkfGC0 5JXEGxqbmJsam1oaGZmZmuIQVhLnbfZICRASSE8sSc1OTS1ILYIZx8TBKdXAGJNpZjJxl93C L2/MUiU1p5VOPvVI/0LAcvmcXQnu9/l21aY6hB2ReqK3+dCEL6Ev2A9LcrXNYj5f+jzh3Ae2 D3cfxVzXne76629xzHf50y/qu5gn2u7g59869UXNadFVYl2ixmmRXvPqO27NjTqQzzXPu69D rENF2rpvj8QTl3fThadWODzOUWIpzkg01GIuKk4EAMYgc6Z1AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRmVeSWpSXmKPExsVy+t9jAd3EaXsCDB49trZ4uP4mi8WUw19Y HJg87lzbwxbAGNXAaJORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+Ti E6DrlpkDNFtJoSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjDmPH+7Sb2go28 FQ0HNrE0MC7h6mLk5JAQMJGYerCFEcIWk7hwbz1bFyMXh5DAIkaJ3gtbmCCciUwSLx+sYgKp YhMwkth6chpYh4iAhMSv/qtgNrNAicS3b92sILYw0NQVt1ezg9gsAqoSK59OAavhFfCQ6J1/ DWqbgsSxqV/B6jkFPCX+nLoENl8IqGbThf3MExh5FzAyrGIUTS1ILihOSs810itOzC0uzUvX S87P3cQIDvdn0jsYVzVYHGIU4GBU4uF9+GV3gBBrYllxZe4hRgkOZiURXreWPQFCvCmJlVWp RfnxRaU5qcWHGH2ArprILCWanA+MxbySeENjE3NTY1NLEwsTM0scwkrivM0eKQFCAumJJanZ qakFqUUw45g4OKUaGNcc7PPo6ryxy/LaynuiJet3WjyY9O3Ui/mPjm6QseuNubj+z/aiZe0r T50K3ODcZXalh+NS85cfM9+lPLv9V1i7pHHWzxl/xEsfzJsSJvd5ReDcGouMy+t6DafJVklP OHpp2dlbS8p+7dyyML7Ell3AfU/8CYnZrvecl9sVXBG+ISb2fbU3D3OmEktxRqKhFnNRcSIA RNCij6QCAAA= X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQkEXFm+Em3NU5WAK0fmjaJcfjiAsiNwAssFr1J3prDaa+5t3u5vRvZiofgHmKtDWw93RoA5 This patch adds fdt support to MAX77686. Signed-off-by: Rajeshwari Shinde --- drivers/misc/pmic_max77686.c | 34 +++++++++++++++++++++++++++++----- 1 files changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/misc/pmic_max77686.c b/drivers/misc/pmic_max77686.c index 36f7f4d..113d038 100644 --- a/drivers/misc/pmic_max77686.c +++ b/drivers/misc/pmic_max77686.c @@ -22,21 +22,45 @@ */ #include +#include +#include #include #include +DECLARE_GLOBAL_DATA_PTR; + int pmic_init(void) { struct pmic *p = get_pmic(); static const char name[] = "MAX77686_PMIC"; - puts("Board PMIC init\n"); + #ifdef CONFIG_OF_CONTROL + const void *blob = gd->fdt_blob; + int node, parent; + + node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC); + if (node <= 0) { + debug("EXYNOS_SOUND: No node for codec in device tree\n"); + debug("node = %d\n", node); + return -1; + } + parent = fdt_parent_offset(blob, node); + if (parent < 0) { + debug("%s: Cannot find node parent\n", __func__); + return -1; + } + p->bus = i2c_get_bus_num_fdt(parent); + p->hw.i2c.addr = fdtdec_get_int(blob, node, + "reg", 0); + #else + p->bus = I2C_PMIC; + p->hw.i2c.addr = MAX77686_I2C_ADDR; + #endif + p->name = name; + p->hw.i2c.tx_num = 1; p->interface = PMIC_I2C; p->number_of_regs = PMIC_NUM_OF_REGS; - p->hw.i2c.addr = MAX77686_I2C_ADDR; - p->hw.i2c.tx_num = 1; - p->bus = I2C_PMIC; - + puts("Board PMIC init MAX77686\n"); return 0; }