Received: by 10.223.164.202 with SMTP id h10csp987086wrb; Thu, 23 Nov 2017 09:18:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ3iBZk2MICUSUrAo03Ud/Zol/QgIyGV1rCLW1xgkiqtw2XoXxBHmxpl1GJoZTshU0mde3W X-Received: by 10.159.198.4 with SMTP id f4mr17473713plo.331.1511457520825; Thu, 23 Nov 2017 09:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511457520; cv=none; d=google.com; s=arc-20160816; b=XEqqTnpHYg7kOpaC5160ZDDo3Zj8EGVg8HMcFfZwlBvd+6gxnREqq+kbCZA45mdXUF cjiijiHos7fwrQ4qTz7TcoYrFbLS9Y1IdMXfOQacGNBv7K4zYkObE66J6pJYBwjK5QNr KEyAls69W2+a+BB56uvft8Lz69mifpEnfO6Z+dHvDfew62p75AFvCrJgSsdY22itErwF 0xLb7Q1pNzQwvn0UcTB5UGCP/HdPmlpvaLM1fpEo0+FGwEftCE+ARU48HlwfNeIMbIj0 ypIxoW4xAZmEPs0c41921WZTd+R9SZIgMcPs70XvjQucHTLzzi+midIVGbGVTmurG/4q Lj6Q== 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=i21XqjN+J2TOfucbD7FMbmiJP6QUoVI1mT1jjPufY/M=; b=gjOWAqb4vLqu7hrhcWhF6/V4dzScC1Fo2o3LdHVLmBHt8LUIXFHT3MkvgPEPP2L8xo ExYpXo4yueUdMfNXVV84EpHiFm5srPUl5efY7MZTST/nU4BtnDXPvlNqaPyERsXOv39Z 8M47zM4wloczxIH/HV8QkjNDBtHr0xd6nqgsnwFLhXKA/IVzo2cGSAe5OSOzlxqs04zH dCmri3L0+a9Ql1FtGzsfHok7IInTRpKSoz8k1OT7xpxZbt3EeMbieUKcpiGyzw0nnXs4 ANALvMJWkyF5ri0fQZ1DlrLTrjCNBbnM2TOy+HJsYU8NzsYD0J+e+obl0oiCoA69Hzz2 zsMw== 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 34si16526187plm.569.2017.11.23.09.18.29; Thu, 23 Nov 2017 09:18:40 -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 S1753423AbdKWRRQ (ORCPT + 76 others); Thu, 23 Nov 2017 12:17:16 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:55560 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753156AbdKWRNj (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 vANH9HCo002490; Thu, 23 Nov 2017 11:13:26 -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-2; Thu, 23 Nov 2017 11:13:26 -0600 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail1.cirrus.com (Postfix) with ESMTP id 9D69B60D9747; Thu, 23 Nov 2017 11:13:25 -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 vANHDKx7008967; Thu, 23 Nov 2017 17:13:21 GMT From: Richard Fitzgerald To: , , , , , , CC: , , , , , Richard Fitzgerald Subject: [PATCH v6 07/17] regulator: arizona-micsupp: Add support for Cirrus Logic Madera codecs Date: Thu, 23 Nov 2017 17:13:06 +0000 Message-ID: <20171123171316.10868-8-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-micsupp" and probe function so that this driver can be used to control the micsupp regulator on Cirrus Logic Madera codecs. Signed-off-by: Richard Fitzgerald Acked-by: Rob Herring --- .../bindings/regulator/arizona-regulator.txt | 3 +- drivers/regulator/Kconfig | 7 ++- drivers/regulator/arizona-micsupp.c | 71 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/regulator/arizona-regulator.txt b/Documentation/devicetree/bindings/regulator/arizona-regulator.txt index 443564d7784f..91b00f9f06d5 100644 --- a/Documentation/devicetree/bindings/regulator/arizona-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/arizona-regulator.txt @@ -5,7 +5,8 @@ of analogue I/O. This document lists regulator specific bindings, see the primary binding document: - ../mfd/arizona.txt + For Wolfson Arizona codecs: ../mfd/arizona.txt + For Cirrus Logic Madera codecs: ../mfd/madera.txt Optional properties: - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 96cd55f9e3c5..53639a6bd888 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -134,11 +134,12 @@ config REGULATOR_ARIZONA_LDO1 devices. config REGULATOR_ARIZONA_MICSUPP - tristate "Wolfson Arizona class devices MICSUPP" - depends on MFD_ARIZONA + tristate "Cirrus Madera and Wolfson Arizona class devices MICSUPP" + depends on MFD_ARIZONA || MFD_MADERA depends on SND_SOC help - Support for the MICSUPP regulators found on Wolfson Arizona class + Support for the MICSUPP regulators found on Cirrus Logic Madera codecs + and Wolfson Arizona codecs devices. config REGULATOR_AS3711 diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index 120de94caf02..36bf73c15e2d 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c @@ -30,6 +30,10 @@ #include #include +#include +#include +#include + #include struct arizona_micsupp { @@ -205,6 +209,28 @@ static const struct regulator_init_data arizona_micsupp_ext_default = { .num_consumer_supplies = 1, }; +static const struct regulator_desc madera_micsupp = { + .name = "MICVDD", + .supply_name = "CPVDD1", + .type = REGULATOR_VOLTAGE, + .n_voltages = 40, + .ops = &arizona_micsupp_ops, + + .vsel_reg = MADERA_LDO2_CONTROL_1, + .vsel_mask = MADERA_LDO2_VSEL_MASK, + .enable_reg = MADERA_MIC_CHARGE_PUMP_1, + .enable_mask = MADERA_CPMIC_ENA, + .bypass_reg = MADERA_MIC_CHARGE_PUMP_1, + .bypass_mask = MADERA_CPMIC_BYPASS, + + .linear_ranges = arizona_micsupp_ext_ranges, + .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ext_ranges), + + .enable_time = 3000, + + .owner = THIS_MODULE, +}; + static int arizona_micsupp_of_get_pdata(struct arizona_micsupp_pdata *pdata, struct regulator_config *config, const struct regulator_desc *desc) @@ -321,6 +347,24 @@ static int arizona_micsupp_probe(struct platform_device *pdev) &arizona->pdata.micvdd); } +static int madera_micsupp_probe(struct platform_device *pdev) +{ + struct madera *madera = dev_get_drvdata(pdev->dev.parent); + struct arizona_micsupp *micsupp; + + micsupp = devm_kzalloc(&pdev->dev, sizeof(*micsupp), GFP_KERNEL); + if (!micsupp) + return -ENOMEM; + + micsupp->regmap = madera->regmap; + micsupp->dapm = &madera->dapm; + micsupp->dev = madera->dev; + micsupp->init_data = arizona_micsupp_ext_default; + + return arizona_micsupp_common_init(pdev, micsupp, &madera_micsupp, + &madera->pdata.micvdd); +} + static struct platform_driver arizona_micsupp_driver = { .probe = arizona_micsupp_probe, .driver = { @@ -328,10 +372,35 @@ static struct platform_driver arizona_micsupp_driver = { }, }; -module_platform_driver(arizona_micsupp_driver); +static struct platform_driver madera_micsupp_driver = { + .probe = madera_micsupp_probe, + .driver = { + .name = "madera-micsupp", + }, +}; + +static struct platform_driver * const arizona_micsupp_drivers[] = { + &arizona_micsupp_driver, + &madera_micsupp_driver, +}; + +static int __init arizona_micsupp_init(void) +{ + return platform_register_drivers(arizona_micsupp_drivers, + ARRAY_SIZE(arizona_micsupp_drivers)); +} +module_init(arizona_micsupp_init); + +static void __exit arizona_micsupp_exit(void) +{ + platform_unregister_drivers(arizona_micsupp_drivers, + ARRAY_SIZE(arizona_micsupp_drivers)); +} +module_exit(arizona_micsupp_exit); /* Module information */ MODULE_AUTHOR("Mark Brown "); MODULE_DESCRIPTION("Arizona microphone supply driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:arizona-micsupp"); +MODULE_ALIAS("platform:madera-micsupp"); -- 2.11.0 From 1585306760845185554@xxx Tue Nov 28 10:52:21 +0000 2017 X-GM-THRID: 1585306760845185554 X-Gmail-Labels: Inbox,Category Promotions,HistoricalUnread