From patchwork Sun Jun 22 15:31:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beniamino Galvani X-Patchwork-Id: 4396211 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D542EBEECB for ; Sun, 22 Jun 2014 15:37:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6B752021B for ; Sun, 22 Jun 2014 15:37:40 +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 F31542022A for ; Sun, 22 Jun 2014 15:37:39 +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 1WyjmR-0005ty-47; Sun, 22 Jun 2014 15:34:07 +0000 Received: from mail-we0-x236.google.com ([2a00:1450:400c:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WyjmA-0005o1-Ct for linux-arm-kernel@lists.infradead.org; Sun, 22 Jun 2014 15:33:51 +0000 Received: by mail-we0-f182.google.com with SMTP id q59so5764313wes.13 for ; Sun, 22 Jun 2014 08:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AlYH8Xi2ps3Z5iJ1Guwfjr2kGGZ4YaOL+qq2CV+3tew=; b=ns4F7b+IasAIai1MF9L/gUAKzTjzKCnQ9dGiGV6fNiSGqCUozBjeDuvqNkQtVmL9jv lGDLI1C3LdlhqHPchE92gsjLWb8lfC/SWHRBxUztK/P++sQGxcFirn35z6E91OD2Vamg ezX8FdFFxr4U/BpH5qmyWqFlISWhyFuFiZvBs7/OQWBt8MNWFXi/ZdLAYX9FBXnOyvwA +5BFDxvJA1GvFBvGPMK1NTUPADHUJPdhLy9pZ+b3ttsZjvsgfztpQRFVDYqHIJLjsRUb giM0DfscKfyZBki55dlxBMx06J7FFNeebir9SGyNnaeh3+DN9Vz+Mpi2aKGeF8ihyI1w mCAQ== X-Received: by 10.194.7.36 with SMTP id g4mr20507359wja.37.1403451208314; Sun, 22 Jun 2014 08:33:28 -0700 (PDT) Received: from sark.local (host188-27-dynamic.31-79-r.retail.telecomitalia.it. [79.31.27.188]) by mx.google.com with ESMTPSA id ex4sm24500007wic.2.2014.06.22.08.33.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jun 2014 08:33:27 -0700 (PDT) From: Beniamino Galvani To: Liam Girdwood , Mark Brown Subject: [PATCH 4/5] regulator: act8865: add support for act8846 Date: Sun, 22 Jun 2014 17:31:44 +0200 Message-Id: <1403451105-31929-5-git-send-email-b.galvani@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403451105-31929-1-git-send-email-b.galvani@gmail.com> References: <1403451105-31929-1-git-send-email-b.galvani@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140622_083350_746773_26DD8997 X-CRM114-Status: GOOD ( 12.56 ) X-Spam-Score: -0.8 (/) Cc: Mark Rutland , devicetree@vger.kernel.org, Heiko Stuebner , Pawel Moll , Ian Campbell , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Wenyou Yang , Beniamino Galvani , Rob Herring , Kumar Gala , linux-arm-kernel@lists.infradead.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=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no 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 Add device id and definition of registers and regulators to support the act8846 PMU. Signed-off-by: Beniamino Galvani --- drivers/regulator/act8865-regulator.c | 71 +++++++++++++++++++++++++++++++++ include/linux/regulator/act8865.h | 17 ++++++++ 2 files changed, 88 insertions(+) diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index c604b34..1a693a5 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c @@ -29,6 +29,40 @@ #include /* + * ACT8846 Global Register Map. + */ +#define ACT8846_SYS0 0x00 +#define ACT8846_SYS1 0x01 +#define ACT8846_REG1_VSET 0x10 +#define ACT8846_REG1_CTRL 0x12 +#define ACT8846_REG2_VSET0 0x20 +#define ACT8846_REG2_VSET1 0x21 +#define ACT8846_REG2_CTRL 0x22 +#define ACT8846_REG3_VSET0 0x30 +#define ACT8846_REG3_VSET1 0x31 +#define ACT8846_REG3_CTRL 0x32 +#define ACT8846_REG4_VSET0 0x40 +#define ACT8846_REG4_VSET1 0x41 +#define ACT8846_REG4_CTRL 0x42 +#define ACT8846_REG5_VSET 0x50 +#define ACT8846_REG5_CTRL 0x51 +#define ACT8846_REG6_VSET 0x58 +#define ACT8846_REG6_CTRL 0x59 +#define ACT8846_REG7_VSET 0x60 +#define ACT8846_REG7_CTRL 0x61 +#define ACT8846_REG8_VSET 0x68 +#define ACT8846_REG8_CTRL 0x69 +#define ACT8846_REG9_VSET 0x70 +#define ACT8846_REG9_CTRL 0x71 +#define ACT8846_REG10_VSET 0x80 +#define ACT8846_REG10_CTRL 0x81 +#define ACT8846_REG11_VSET 0x90 +#define ACT8846_REG11_CTRL 0x91 +#define ACT8846_REG12_VSET 0xa0 +#define ACT8846_REG12_CTRL 0xa1 +#define ACT8846_REG13_CTRL 0xb1 + +/* * ACT8865 Global Register Map. */ #define ACT8865_SYS_MODE 0x00 @@ -103,6 +137,21 @@ static struct regulator_ops act8865_ops = { .owner = THIS_MODULE, \ } +static const struct regulator_desc act8846_regulators[] = { + ACT88xx_REG("REG1", ACT8846, REG1, VSET), + ACT88xx_REG("REG2", ACT8846, REG2, VSET0), + ACT88xx_REG("REG3", ACT8846, REG3, VSET0), + ACT88xx_REG("REG4", ACT8846, REG4, VSET0), + ACT88xx_REG("REG5", ACT8846, REG5, VSET), + ACT88xx_REG("REG6", ACT8846, REG6, VSET), + ACT88xx_REG("REG7", ACT8846, REG7, VSET), + ACT88xx_REG("REG8", ACT8846, REG8, VSET), + ACT88xx_REG("REG9", ACT8846, REG9, VSET), + ACT88xx_REG("REG10", ACT8846, REG10, VSET), + ACT88xx_REG("REG11", ACT8846, REG11, VSET), + ACT88xx_REG("REG12", ACT8846, REG12, VSET), +}; + static const struct regulator_desc act8865_regulators[] = { ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1), ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1), @@ -115,11 +164,27 @@ static const struct regulator_desc act8865_regulators[] = { #ifdef CONFIG_OF static const struct of_device_id act8865_dt_ids[] = { + { .compatible = "active-semi,act8846", .data = (void *)ACT8846 }, { .compatible = "active-semi,act8865", .data = (void *)ACT8865 }, { } }; MODULE_DEVICE_TABLE(of, act8865_dt_ids); +static struct of_regulator_match act8846_matches[] = { + [ACT8846_ID_REG1] = { .name = "REG1" }, + [ACT8846_ID_REG2] = { .name = "REG2" }, + [ACT8846_ID_REG3] = { .name = "REG3" }, + [ACT8846_ID_REG4] = { .name = "REG4" }, + [ACT8846_ID_REG5] = { .name = "REG5" }, + [ACT8846_ID_REG6] = { .name = "REG6" }, + [ACT8846_ID_REG7] = { .name = "REG7" }, + [ACT8846_ID_REG8] = { .name = "REG8" }, + [ACT8846_ID_REG9] = { .name = "REG9" }, + [ACT8846_ID_REG10] = { .name = "REG10" }, + [ACT8846_ID_REG11] = { .name = "REG11" }, + [ACT8846_ID_REG12] = { .name = "REG12" }, +}; + static struct of_regulator_match act8865_matches[] = { [ACT8865_ID_DCDC1] = { .name = "DCDC_REG1"}, [ACT8865_ID_DCDC2] = { .name = "DCDC_REG2"}, @@ -222,6 +287,11 @@ static int act8865_pmic_probe(struct i2c_client *client, } switch (type) { + case ACT8846: + matches = act8846_matches; + regulators = act8846_regulators; + num_regulators = ARRAY_SIZE(act8846_regulators); + break; case ACT8865: matches = act8865_matches; regulators = act8865_regulators; @@ -290,6 +360,7 @@ static int act8865_pmic_probe(struct i2c_client *client, } static const struct i2c_device_id act8865_ids[] = { + { .name = "act8846", .driver_data = ACT8846 }, { .name = "act8865", .driver_data = ACT8865 }, { }, }; diff --git a/include/linux/regulator/act8865.h b/include/linux/regulator/act8865.h index b49be81..b6c4909 100644 --- a/include/linux/regulator/act8865.h +++ b/include/linux/regulator/act8865.h @@ -30,7 +30,24 @@ enum { }; enum { + ACT8846_ID_REG1, + ACT8846_ID_REG2, + ACT8846_ID_REG3, + ACT8846_ID_REG4, + ACT8846_ID_REG5, + ACT8846_ID_REG6, + ACT8846_ID_REG7, + ACT8846_ID_REG8, + ACT8846_ID_REG9, + ACT8846_ID_REG10, + ACT8846_ID_REG11, + ACT8846_ID_REG12, + ACT8846_REG_NUM, +}; + +enum { ACT8865, + ACT8846, }; /**