Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eea1836b authored by Karthikeyan Mani's avatar Karthikeyan Mani
Browse files

drivers: mfd: Add support for wcd9xxx core module



Move Codec reset functions from codec module
so that it can be can be compiled separately
to support module option.

CRs-fixed: 2068879
Change-Id: I2d83c3216d42150610478f2bf71e348aa7984f4c
Signed-off-by: default avatarKarthikeyan Mani <kmani@codeaurora.org>
parent 5b1f0d1b
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ menu "Multifunction device drivers"
config MFD_CORE
	tristate
	select IRQ_DOMAIN
	default n
	default y

config MFD_CS5535
	tristate "AMD CS5535 and CS5536 southbridge core functions"
@@ -1636,11 +1636,16 @@ config MSM_CDC_SUPPLY
	  power supply enable or disable. This driver acts as interface
	  between codec and regulator framework.

config WCD9XXX_CODEC_UTIL
	tristate "WCD9XXX Codec Utils"
	select MFD_CORE
config WCD9XXX_CODEC_CORE
	tristate "WCD9XXX Codec Core"
	select SLIMBUS
	select SOUNDWIRE_WCD_CTRL
	select MSM_CDC_SUPPLY
	select MSM_CDC_PINCTRL
	select REGMAP_ALLOW_WRITE_DEBUGFS
	select PINCTRL_WCD
	help
	  WCD9XXX Util driver provides APIs for WCD drivers to reset,
	  WCD9XXX Core driver provides APIs for WCD drivers to reset,
	  suspend/resume, regmap bus callback functions and read/write
	  functions. This driver also hides the underlying bus related
	  functionalities.
@@ -1649,8 +1654,6 @@ config WCD9335_CODEC
	tristate "WCD9335 Codec"
	select SLIMBUS
	select SOUNDWIRE_WCD_CTRL
	select MFD_CORE
	select WCD9XXX_CODEC_UTIL
	select MSM_CDC_SUPPLY
	select MSM_CDC_PINCTRL
	select REGMAP_ALLOW_WRITE_DEBUGFS
@@ -1665,8 +1668,6 @@ config WCD934X_CODEC
	tristate "WCD934X Codec"
	depends on SLIMBUS
	select SOUNDWIRE_WCD_CTRL
	select MFD_CORE
	select WCD9XXX_CODEC_UTIL
	select MSM_CDC_SUPPLY
	select MSM_CDC_PINCTRL
	select REGMAP_ALLOW_WRITE_DEBUGFS
+7 −8
Original line number Diff line number Diff line
@@ -205,14 +205,13 @@ obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o
obj-$(CONFIG_MFD_DLN2)		+= dln2.o
obj-$(CONFIG_MFD_RT5033)	+= rt5033.o
obj-$(CONFIG_MFD_SKY81452)	+= sky81452.o
obj-$(CONFIG_MSM_CDC_PINCTRL)	+= msm-cdc-pinctrl.o
obj-$(CONFIG_MSM_CDC_SUPPLY) += msm-cdc-supply.o
obj-$(CONFIG_WCD9XXX_CODEC_UTIL) += wcd9xxx-utils.o
obj-$(CONFIG_WCD9335_CODEC)	+= wcd9xxx-core.o wcd9xxx-irq.o wcd9xxx-slimslave.o\
					wcd9335-regmap.o wcd9335-tables.o
obj-$(CONFIG_WCD934X_CODEC)	+= wcd9xxx-core.o wcd9xxx-irq.o wcd9xxx-slimslave.o\
					wcd934x-regmap.o wcd934x-tables.o

wcd-core-objs			:= wcd9xxx-rst.o wcd9xxx-core-init.o \
				   wcd9xxx-core.o wcd9xxx-irq.o \
				   wcd9xxx-slimslave.o wcd9xxx-utils.o \
				   wcd934x-regmap.o wcd934x-tables.o \
				   wcd9335-regmap.o wcd9335-tables.o \
				   msm-cdc-pinctrl.o msm-cdc-supply.o
obj-$(CONFIG_WCD934X_CODEC)	+= wcd-core.o
intel-soc-pmic-objs		:= intel_soc_pmic_core.o intel_soc_pmic_crc.o
intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC)	+= intel_soc_pmic_bxtwc.o
obj-$(CONFIG_INTEL_SOC_PMIC)	+= intel-soc-pmic.o
+10 −2
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -239,7 +239,15 @@ static struct platform_driver msm_cdc_pinctrl_driver = {
	.probe = msm_cdc_pinctrl_probe,
	.remove = msm_cdc_pinctrl_remove,
};
module_platform_driver(msm_cdc_pinctrl_driver);

int msm_cdc_pinctrl_drv_init(void)
{
	return platform_driver_register(&msm_cdc_pinctrl_driver);
}

void msm_cdc_pinctrl_drv_exit(void)
{
	platform_driver_unregister(&msm_cdc_pinctrl_driver);
}
MODULE_DESCRIPTION("MSM CODEC pin control platform driver");
MODULE_LICENSE("GPL v2");
+55 −0
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/module.h>
#include <linux/mfd/msm-cdc-pinctrl.h>
#include <linux/mfd/wcd9xxx/wcd9xxx-irq.h>
#include <linux/mfd/wcd9xxx/core.h>

#define NUM_DRIVERS_REG_RET 3

static int __init wcd9xxx_core_init(void)
{
	int ret[NUM_DRIVERS_REG_RET] = {0};
	int i = 0;

	ret[0] = msm_cdc_pinctrl_drv_init();
	if (ret[0])
		pr_err("%s: Failed init pinctrl drv: %d\n", __func__, ret[0]);

	ret[1] = wcd9xxx_irq_drv_init();
	if (ret[1])
		pr_err("%s: Failed init irq drv: %d\n", __func__, ret[1]);

	ret[2] = wcd9xxx_init();
	if (ret[2])
		pr_err("%s: Failed wcd core drv: %d\n", __func__, ret[2]);

	for (i = 0; i < NUM_DRIVERS_REG_RET; i++) {
		if (ret[i])
			return ret[i];
	}

	return 0;
}
module_init(wcd9xxx_core_init);

static void __exit wcd9xxx_core_exit(void)
{
	wcd9xxx_exit();
	wcd9xxx_irq_drv_exit();
	msm_cdc_pinctrl_drv_exit();
}
module_exit(wcd9xxx_core_exit);

MODULE_DESCRIPTION("WCD9XXX CODEC core init driver");
MODULE_LICENSE("GPL v2");
+2 −4
Original line number Diff line number Diff line
@@ -1665,7 +1665,7 @@ static struct i2c_driver wcd9335_i2c_driver = {
	.remove                 =       wcd9xxx_i2c_remove,
};

static int __init wcd9xxx_init(void)
int wcd9xxx_init(void)
{
	int ret[NUM_WCD9XXX_REG_RET] = {0};
	int i = 0;
@@ -1699,9 +1699,8 @@ static int __init wcd9xxx_init(void)

	return 0;
}
module_init(wcd9xxx_init);

static void __exit wcd9xxx_exit(void)
void wcd9xxx_exit(void)
{
	wcd9xxx_set_intf_type(WCD9XXX_INTERFACE_TYPE_PROBING);

@@ -1710,7 +1709,6 @@ static void __exit wcd9xxx_exit(void)
	i2c_del_driver(&wcd9335_i2c_driver);
	slim_driver_unregister(&wcd_slim_driver);
}
module_exit(wcd9xxx_exit);

MODULE_DESCRIPTION("Codec core driver");
MODULE_LICENSE("GPL v2");
Loading