Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp757685ybm; Tue, 21 May 2019 03:06:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyE7fgl7dI6vkqF0xSqLOF+bWw+tiL79WVu+EvmN+82mFVVLFFrSF/u7736HE4GfNUblnb8 X-Received: by 2002:a63:ff0f:: with SMTP id k15mr79697716pgi.407.1558433173834; Tue, 21 May 2019 03:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558433173; cv=none; d=google.com; s=arc-20160816; b=uD3LT2f9l5JnJub6bUPyzPDSjK5qZIEiZP9wOioaYPVShW8Owa20KetS4NidjSEfDR Y55mv5spU+DTRTmTRN79Lk/bQazxwwFHZXyviKJrrwTJP5Teav32I0TXUMYw8fSOjGdv TarzO+Sji4ynHhF88U5URRFpjAO0w4KtTfdevaEkeoRrNsrDq7VZNqFOFPt1wx5hrH4i EX722iBFSwLZSqGftdcBv9PO1AQuPazf71hUAeBIoyKRTddkPU3BNmYtRCr6FgD4JyDt +/IBmHuSeaQLirpGq+++Ju16xz/1379IhIFsgWZsZaefcZoMGFOGKHUNyib/WFQzd5dL UWdw== 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; bh=DxIF9KVtWmXBRnTHVzh2xAOdzUS366tdKHCGiFR+NAk=; b=xQ/7vI1eSiXm3UETq7yRU/8b0Y4l4OkvE39dnPDyIgFOmxNhonij0IjugAdwVrgddm 5N6Vt1i90LPJeoEdhljn+clpXcR3Gus7c3s5iB/XKelXVeKAUr2UgXOoZnBozoWc0U3f Ma+4fuNs2vIelewuxM9/fHHuV9nCXwtjtrfk/FKkyt5euxwxPMYPIymKqfP/KO2yYoyT hu3wqXvbgHGDF8WabI/7pJyhmBQcnM8M6fTOZWcAA72uBkzwN3iy6SoR2yi5nVqt3uXG QYzR7rAfmn2oOkCa7A/pCQsCkAK1lOiPuH9OeHXJLwxSW8LiE/35/BcBQHrlx1vazBFU 6wOw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a190si22864185pfb.122.2019.05.21.03.05.57; Tue, 21 May 2019 03:06:13 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727452AbfEUKEs (ORCPT + 99 others); Tue, 21 May 2019 06:04:48 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:53058 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726318AbfEUKEq (ORCPT ); Tue, 21 May 2019 06:04:46 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4LA4c5X026004; Tue, 21 May 2019 05:04:41 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail4.cirrus.com ([87.246.98.35]) by mx0a-001ae601.pphosted.com with ESMTP id 2sjff1uupn-1; Tue, 21 May 2019 05:04:40 -0500 Received: from EDIEX02.ad.cirrus.com (ediex02.ad.cirrus.com [198.61.84.81]) by mail4.cirrus.com (Postfix) with ESMTP id A7888611C8AC; Tue, 21 May 2019 05:05:45 -0500 (CDT) Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Tue, 21 May 2019 11:04:39 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1591.10 via Frontend Transport; Tue, 21 May 2019 11:04:39 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id C1CFA2DB; Tue, 21 May 2019 11:04:39 +0100 (BST) From: Charles Keepax To: CC: , , , , , Subject: [PATCH 3/3] regulator: arizona-micsupp: Add support for Cirrus Logic Madera codecs Date: Tue, 21 May 2019 11:04:39 +0100 Message-ID: <20190521100439.27383-3-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190521100439.27383-1-ckeepax@opensource.cirrus.com> References: <20190521100439.27383-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905210064 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Richard Fitzgerald 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 Signed-off-by: Charles Keepax --- drivers/regulator/Kconfig | 7 ++-- drivers/regulator/arizona-micsupp.c | 71 ++++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index d2db658840f47..53576c2df737b 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -143,11 +143,12 @@ config REGULATOR_ARIZONA_LDO1 and Wolfson Microelectronic Arizona codecs. 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 Microelectronic Arizona codecs devices. config REGULATOR_AS3711 diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index be0d46da51a14..de6802b85e9f9 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c @@ -25,6 +25,10 @@ #include #include +#include +#include +#include + #include struct arizona_micsupp { @@ -200,6 +204,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) @@ -316,6 +342,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 = { @@ -323,10 +367,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