Received: by 10.223.164.202 with SMTP id h10csp987216wrb; Thu, 23 Nov 2017 09:18:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMbwkCMArbF/ZS5czIn9oa5iGzv/ecjeb6KMUxOJEoYv1jKlrzlFGo69yQ6monxQhG4TGBZM X-Received: by 10.159.231.6 with SMTP id w6mr25559691plq.253.1511457528564; Thu, 23 Nov 2017 09:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511457528; cv=none; d=google.com; s=arc-20160816; b=RiFaSPY0dBWW5XGKwcSapam5QWKPwVnNsaWlTy7aIsuQinsEkfBjQgfypBdfGE4j5u oOkTPx9boID/Z/LaF9Z5Y9KBbIt9A20dn89p4PuuAKdgyBNK4faBH1vh0Qet5KL2dRdf Vg3Re3Pa4ZtL4OVUjh6SOaIsCD3bIeIBAm/K/rit9I0sIkBvt660edEE6qLIXl0F9QFH mcmK2WX6U4jQkkw985P4bF3tyed9K7TO46Not7LdEFJoCqSLnS9VfuGSVYW+Pxb+nnxk lI/WpF4b+kWvDKA5gdWDCKFD3+9DD66RxvbiZ/zBpEdPJoga67b+Cw1D9p0WZk6JBeI1 sklg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=RHRDdI16OSbcHM1tg4RtO2u+ks1C1PlwPM+6DYvHNjY=; b=zp/LqBrARK9i7SzRNUzQ3Qr+LAvVi8OqhYoBFjU51TZ1qxfrrtpoOrfAJGl4w0n5zi Zqls/zj9QFYrdV71sVVCGRFEA71OVubkuUCnN7PAPsj5Hm/w5TRsr9xfquyurCDeaFtO KLlJ/EDUf2gnQyngGsiHS7RwF7d7JbhvqHQSTJDu02x7zU1uQNzWGPNVZaHTqe5wSfWv 8eccvkwbYQbRAoOn9h4pm3rss/BgH3kpexGFV/W9xe5Q59shyqv4Qp8Hacpv3Ocz0LB1 5XXNxQOL7+dwRh6oEy3B8bWAdE+OLu6LbXwXE3vB8ScOoek41f5wrMkdiNHZGq7qZ1ep Bc5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 21si17865638pfn.413.2017.11.23.09.18.37; Thu, 23 Nov 2017 09:18:48 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753396AbdKWRRP (ORCPT + 76 others); Thu, 23 Nov 2017 12:17:15 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:55562 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753157AbdKWRNj (ORCPT ); Thu, 23 Nov 2017 12:13:39 -0500 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vANH9HCn002490; Thu, 23 Nov 2017 11:13:25 -0600 Authentication-Results: ppops.net; spf=none smtp.mailfrom=rf@opensource.wolfsonmicro.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0b-001ae601.pphosted.com with ESMTP id 2ecrj59pgr-1; Thu, 23 Nov 2017 11:13:25 -0600 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail1.cirrus.com (Postfix) with ESMTP id DF45860D9749; Thu, 23 Nov 2017 11:13:24 -0600 (CST) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.301.0; Thu, 23 Nov 2017 17:13:21 +0000 Received: from edi-sw-dsktp006.ad.cirrus.com (edi-sw-dsktp006.ad.cirrus.com [198.90.223.54]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id vANHDKx8008967; Thu, 23 Nov 2017 17:13:21 GMT From: Richard Fitzgerald To: , , , , , , CC: , , , , , Richard Fitzgerald Subject: [PATCH v6 08/17] regulator: arizona-ldo1: Add support for Cirrus Logic Madera codecs Date: Thu, 23 Nov 2017 17:13:07 +0000 Message-ID: <20171123171316.10868-9-rf@opensource.wolfsonmicro.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171123171316.10868-1-rf@opensource.wolfsonmicro.com> References: <20171123171316.10868-1-rf@opensource.wolfsonmicro.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711230233 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a new driver identity "madera-ldo1" and probe function so that this driver can be used to control the LDO1 regulator on some Cirrus Logic Madera codecs. Signed-off-by: Richard Fitzgerald --- drivers/regulator/Kconfig | 8 ++-- drivers/regulator/arizona-ldo1.c | 82 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 53639a6bd888..3db4f994aea8 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -126,12 +126,12 @@ config REGULATOR_AB8500 signal AB8500 PMIC config REGULATOR_ARIZONA_LDO1 - tristate "Wolfson Arizona class devices LDO1" - depends on MFD_ARIZONA + tristate "Cirrus Madera and Wolfson Arizona class devices LDO1" + depends on MFD_ARIZONA || MFD_MADERA depends on SND_SOC help - Support for the LDO1 regulators found on Wolfson Arizona class - devices. + Support for the LDO1 regulators found on Cirrus Logic Madera codecs + and Wolfson Arizona codecs. config REGULATOR_ARIZONA_MICSUPP tristate "Cirrus Madera and Wolfson Arizona class devices MICSUPP" diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 96fddfff5dc4..c64625e76124 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c @@ -31,6 +31,10 @@ #include #include +#include +#include +#include + struct arizona_ldo1 { struct regulator_dev *regulator; struct regmap *regmap; @@ -188,6 +192,31 @@ static const struct regulator_init_data arizona_ldo1_wm5110 = { .num_consumer_supplies = 1, }; +static const struct regulator_desc madera_ldo1 = { + .name = "LDO1", + .supply_name = "LDOVDD", + .type = REGULATOR_VOLTAGE, + .ops = &arizona_ldo1_ops, + + .vsel_reg = MADERA_LDO1_CONTROL_1, + .vsel_mask = MADERA_LDO1_VSEL_MASK, + .min_uV = 900000, + .uV_step = 25000, + .n_voltages = 13, + .enable_time = 3000, + + .owner = THIS_MODULE, +}; + +static const struct regulator_init_data madera_ldo1_default = { + .constraints = { + .min_uV = 1200000, + .max_uV = 1200000, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, +}; + static int arizona_ldo1_of_get_pdata(struct arizona_ldo1_pdata *pdata, struct regulator_config *config, const struct regulator_desc *desc, @@ -341,6 +370,32 @@ static int arizona_ldo1_probe(struct platform_device *pdev) return ret; } +static int madera_ldo1_probe(struct platform_device *pdev) +{ + struct madera *madera = dev_get_drvdata(pdev->dev.parent); + struct arizona_ldo1 *ldo1; + bool external_dcvdd; + int ret; + + ldo1 = devm_kzalloc(&pdev->dev, sizeof(*ldo1), GFP_KERNEL); + if (!ldo1) + return -ENOMEM; + + ldo1->regmap = madera->regmap; + + ldo1->init_data = madera_ldo1_default; + + ret = arizona_ldo1_common_init(pdev, ldo1, &arizona_ldo1, + &madera->pdata.ldo1, + &external_dcvdd); + if (ret) + return ret; + + madera->internal_dcvdd = !external_dcvdd; + + return 0; +} + static struct platform_driver arizona_ldo1_driver = { .probe = arizona_ldo1_probe, .driver = { @@ -348,10 +403,35 @@ static struct platform_driver arizona_ldo1_driver = { }, }; -module_platform_driver(arizona_ldo1_driver); +static struct platform_driver madera_ldo1_driver = { + .probe = madera_ldo1_probe, + .driver = { + .name = "madera-ldo1", + }, +}; + +static struct platform_driver * const madera_ldo1_drivers[] = { + &arizona_ldo1_driver, + &madera_ldo1_driver, +}; + +static int __init arizona_ldo1_init(void) +{ + return platform_register_drivers(madera_ldo1_drivers, + ARRAY_SIZE(madera_ldo1_drivers)); +} +module_init(arizona_ldo1_init); + +static void __exit madera_ldo1_exit(void) +{ + platform_unregister_drivers(madera_ldo1_drivers, + ARRAY_SIZE(madera_ldo1_drivers)); +} +module_exit(madera_ldo1_exit); /* Module information */ MODULE_AUTHOR("Mark Brown "); MODULE_DESCRIPTION("Arizona LDO1 driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:arizona-ldo1"); +MODULE_ALIAS("platform:madera-ldo1"); -- 2.11.0 From 1584866966176187830@xxx Thu Nov 23 14:22:00 +0000 2017 X-GM-THRID: 1584129828604031252 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread