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

Commit 01e94a35 authored by Dhanalakshmi Siddani's avatar Dhanalakshmi Siddani
Browse files

ASoC: tfa98xx: Add tfa98xx smart PA driver

Add tfa9xx driver from
https://source.codeaurora.org/external/mas/tfa98xx/?h=DIN_v6.6.3


and adapt it for the kernel directory structure.

It includes the following changes:

commit 6886738d
Author: Mehdi Chemsi <mehdi.chemsi@nxp.com>
Updating optimal settings of TFA9878 device to V12

commit 5fcdff3e
Author: mehdi chemsi <mehdi.chemsi@nxp.com>
correct driver version(v6.6.3)

commit 07caf4e3
Author: mehdi chemsi <mehdi.chemsi@nxp.com>
v6.3.3 update

commit 21a96fc5
Author: mehdi chemsi <mehdi.chemsi@nxp.com>
Pushing V6.6.2 driver that supports TFA9878 project

commit 344e6e7a
Author: mehdi chemsi <mehdi.chemsi@nxp.com>
Pushing DIN_v6.5.5 to CAF

commit 26919699
Author: Johan van Nispen <johan.van.nispen@nxp.com>
added LICENSE file

commit 8fbec820
Author: Johan van Nispen <johan.van.nispen@nxp.com>
Initial commit for TFA Audio Driver in CAF branch

Change-Id: Ib51c11778217c1a5b00624e74e449ce754485a76
Signed-off-by: default avatarDhanalakshmi Siddani <dsiddani@codeaurora.org>
parent 7b3d8cf0
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
TFA9897 SmartpA

Required properties:

  - compatible : "nxp,tfa98xx"

  - reg : I2C address of the device

  - dvdd-supply : Power supply for PA's dvdd

  - dvdd-voltage : Minimum and maximum voltage in uV to set for power supply

  - dvdd-current : dvdd's max current in uA

Examples:

	i2c_smartpa@34 {
		compatible = "nxp,tfa98xx";
		reg = <0x34>;
		reset-gpio = <&tlmm 68 0>;
		dvdd-supply = <&pm660_l9>;
		dvdd-voltage = <1800000 1800000>;
		dvdd-current = <15000>;
	};
+6 −0
Original line number Diff line number Diff line
@@ -204,6 +204,7 @@ config SND_SOC_ALL_CODECS
	select SND_SOC_WM9712 if SND_SOC_AC97_BUS
	select SND_SOC_WM9713 if SND_SOC_AC97_BUS
	select SND_SOC_AW8896 if I2C
	select SND_SOC_TFA98XX if I2C
        help
          Normally ASoC codec drivers are only built if a machine driver which
          uses them is also built since they are only usable with a machine
@@ -1096,4 +1097,9 @@ config SND_SOC_AW8896
	help
	  Enables support for aw8896 series Smart PA.

config SND_SOC_TFA98XX
	tristate "NXP Semiconductors TFA98XX amplifier"
	depends on I2C
	help
	Enables support for NXP98xx Smart PA.
endmenu
+5 −0
Original line number Diff line number Diff line
@@ -221,6 +221,10 @@ snd-soc-max98504-objs := max98504.o
snd-soc-tpa6130a2-objs := tpa6130a2.o
snd-soc-tas2552-objs := tas2552.o
snd-soc-aw8896-objs := aw8896.o
snd-soc-tfa98xx-objs := tfa98xx.o
snd-soc-tfa98xx-objs += tfa_container.o
snd-soc-tfa98xx-objs += tfa_dsp.o
snd-soc-tfa98xx-objs += tfa_init.o

obj-$(CONFIG_SND_SOC_88PM860X)	+= snd-soc-88pm860x.o
obj-$(CONFIG_SND_SOC_AB8500_CODEC)	+= snd-soc-ab8500-codec.o
@@ -442,3 +446,4 @@ obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o
obj-$(CONFIG_SND_SOC_MAX98504)	+= snd-soc-max98504.o
obj-$(CONFIG_SND_SOC_TPA6130A2)	+= snd-soc-tpa6130a2.o
obj-$(CONFIG_SND_SOC_AW8896)	+= snd-soc-aw8896.o
obj-$(CONFIG_SND_SOC_TFA98XX)	+= snd-soc-tfa98xx.o
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 NXP Semiconductors, 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 as
 * published by the Free Software Foundation.
 *
 */

/*
 * Linux kernel specific definitions used by code shared with
 * Linux/Windows user space.
 */

#ifndef __CONFIG_LINUX_KERNEL_INC__
#define __CONFIG_LINUX_KERNEL_INC__

#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/crc32.h>
#include <linux/ftrace.h>

#define _ASSERT(e)
#ifndef PRINT_ASSERT
#define PRINT_ASSERT(e) {\
	(if ((e))\
		printk(KERN_ERR "PrintAssert:%s (%s:%d) error code:%d\n",\
		__FUNCTION__, __FILE__, __LINE__, e)) \
	}
#endif
#if defined(CONFIG_TRACING) && defined(DEBUG)
	#define tfa98xx_trace_printk(...) trace_printk(__VA_ARGS__)
#else
	#define tfa98xx_trace_printk(...)
#endif

#endif /* __CONFIG_LINUX_KERNEL_INC__ */
+179 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 NXP Semiconductors, 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 as
 * published by the Free Software Foundation.
 *
 */

#ifndef _DBGPRINT_H
#   define _DBGPRINT_H

/* Debugging macro's. */
#   ifndef DEBUG
#      define DEBUG
#   endif

#   ifndef ASSERT
//#define ASSERT
#   endif
 //TODO wwwim
#   ifndef _ASSERT
		#define _ASSERT(e)
#   endif

#   ifndef PREFIX
#     define PREFIX "tfa98xx: "
#	define DRIVER_NAME "tfa98xx"
#   endif

#ifdef __KERNEL__

#   ifdef DEBUG
#      define _DEBUG(level, fmt, va...) do {\
		if (unlikely(debug >= (level))) \
			printk(KERN_INFO PREFIX "%s:%d: "fmt,\
			__func__, __LINE__, ##va); \
		} while (0);

#   else
#      define _DEBUG(level, fmt, va...) do {} while (0)
#   endif

#   define MSG(fmt, va...) printk(KERN_INFO PREFIX "%s:%d: "fmt,\
				__func__, __LINE__, ##va)
#   define _ERRORMSG(fmt, va...) printk(KERN_ERR PREFIX "ERROR %s:%d: "fmt,\
				__func__, __LINE__, ##va)


#   define DEBUG0(x...) MSG(x)
#   define DEBUG1(x...) _DEBUG(1, x)
#   define DEBUG2(x...) _DEBUG(2, x)
#   define DEBUG3(x...) _DEBUG(3, x)
#   define ERRORMSG(x...) _ERRORMSG(x)
#	define PRINT(x...)	printk(x)
#   define PRINT_ERROR(x...) printk(KERN_INFO PREFIX " **ERROR** " x)
#   define PRINT_ASSERT(e) if (e) printk(KERN_ERR\
			"PrintAssert:%s (%s:%d)	error code:%d\n",\
			 __FUNCTION__, __FILE__, __LINE__, e)

#   define PRINT_ENTRY DEBUG2("+[%s]\n", __func__)
#   define PRINT_EXIT  DEBUG2("-[%s]\n", __func__)

#   ifdef ASSERT
#      define assert(cond, action) do {\
			if (unlikely(!(cond))) {
			DEBUG0("Assert:\
			%s\n", #cond); action; } } \
			while (0)
#   else
#      define assert(cond, action) do { } while (0)
#   endif

#else /* __KERNEL__ */
#if defined(WIN32) || defined(_X64)
#include <stdio.h>
/* user mode */
#   ifdef DEBUG
#      define _DEBUGMSG(level, fmt, ...)  printf(PREFIX "%s:%d: "fmt,\
				__FUNCTION__, __LINE__, __VA_ARGS__)
#   else
#      define _DEBUGMSG(level, fmt, ...) do {} while (0)
#   endif

#   define _ERRORMSG(fmt, ...) printf(PREFIX "%s:%s:%d: "fmt, __FILE__,\
				__FUNCTION__, __LINE__, __VA_ARGS__)

#   define DEBUG0(...) MSG(__VA_ARGS__)
#   define DEBUG1(...) _DEBUGMSG(1, __VA_ARGS__)
#   define DEBUG2(...) _DEBUGMSG(2, __VA_ARGS__)
#   define DEBUG3(...) _DEBUGMSG(3, __VA_ARGS__)
#   define ERRORMSG(fmt, ...) _ERRORMSG(fmt, __VA_ARGS__)
#	define PRINT(...)	printf(__VA_ARGS__)
/*
#	define PRINT(...) {	FILE *stream;				\
	if((stream = freopen("nxp_tfa.txt", "ab+", stdout)) == NULL) exit(-1);\
		printf(__VA_ARGS__);					\
		freopen( "CON", "ab+", stdout );			\
	}
*/
#	define PRINT_ERROR(...)	 fprintf(stderr, __VA_ARGS__)
#	define PRINT_FILE(file, ...)	fprintf(file, __VA_ARGS__)
#	define PRINT_ASSERT(e) {\
			if ((e))\
			fprintf(stderr, "PrintAssert:%s (%s:%d)\
					error code:%d\n", __FUNCTION__,\
					__FILE__, __LINE__, e)\
			}
//#	define PRINT_ASSERT(e) if ((e)) fprintf(stderr, "PrintAssert:%s (%s:%d) %s\n",__FUNCTION__,__FILE__,__LINE__, Tfa98xx_GetErrorString(e))

#elif defined(__CODE_RED)
#include "app_global.h"
#   ifdef DEBUG
#      define _DEBUG(level, fmt, va...) TB_TRACE_INF(TbTracePfx2("tfa",\
					TB_FUNC, va))
//printf(PREFIX "%s:%d: "fmt,__func__,__LINE__,##va);
#   else
#      define _DEBUG(level, fmt, va...) do {} while (0)
#   endif

#   define MSG(fmt, ...) TB_TRACE_INF(TbTracePfx2("tfa", TB_FUNC, __VA_ARGS__))
//printf(PREFIX "%s:%s:%d: "fmt,__FILE__,__func__,__LINE__,##va)
//TB_TRACE_INF(TbTracePfx2(APP_PFX,TB_FUNC,"path=%s, chan=%u, muted=%s, vol=%d\n",
//                                path->isRecording ? "recording" : "playback",
//                                           i,
//                                  channelVol.currentMuteValue ? "YES" : "NO",
//                                              channelVol.currentVolumeValue
//                                              ));
//#   define _ERRORMSG(fmt,va...) TB_TRACE_INF(TbTracePfx2("tfa",TB_FUNC,va))
#   define ERRORMSG(...) TB_TRACE_INF(TbTracePfx2("tfa", TB_FUNC, __VA_ARGS__))
//fprintf(stderr, PREFIX "ERROR %s:%s:%d: "fmt,__FILE__,__func__,__LINE__, ##va)

#define DEBUG0(x...) MSG(x)
#define DEBUG1(x...) _DEBUG(1, x)
#define DEBUG2(x...) _DEBUG(2, x)
#define DEBUG3(x...) _DEBUG(3, x)
//#   define ERRORMSG(x...) _ERRORMSG(x)
#define PRINT(x...)	TB_TRACE_INF(TbTracePfx2("tfa", TB_FUNC, x))
//printf(x)
#define PRINT_ERROR(x...) TB_TRACE_INF(TbTracePfx2("tfa", TB_FUNC, x))
//fprintf(stderr,__VA_ARGS__)
#define PRINT_FILE(file, x...) TB_TRACE_INF(TbTracePfx2("tfa", TB_FUNC, x))
//fprintf(file,__VA_ARGS__)
#define PRINT_ASSERT(e)
//TB_TRACE_INF(TbTracePfx2("tfa",TB_FUNC,Tfa98xx_GetErrorString(e)))
//if ((e)) fprintf(stderr, "PrintAssert:%s (%s:%d) %s\n",__FUNCTION__,__FILE__,__LINE__, Tfa98xx_GetErrorString(e))
#else
#include <stdio.h>
/* user mode */
#   ifdef DEBUG
#      define _DEBUG(level, fmt, va...)  printf(PREFIX "%s:%d: "fmt, __func__,\
						__LINE__, ##va);
#   else
#      define _DEBUG(level, fmt, va...) do {} while (0)
#   endif

#   define MSG(fmt, va...) printf(PREFIX "%s:%s:%d: "fmt, __FILE__, __func__,\
						__LINE__, ##va)
#   define _ERRORMSG(fmt, va...) fprintf(stderr, PREFIX "ERROR %s:%s:%d: "fmt,\
						__FILE__, __func__, __LINE__, ##va)

#define DEBUG0(x...) MSG(x)
#define DEBUG1(x...) _DEBUG(1, x)
#define DEBUG2(x...) _DEBUG(2, x)
#define DEBUG3(x...) _DEBUG(3, x)
#define ERRORMSG(x...) _ERRORMSG(x)
#define PRINT(x...)	printf(x)
#define PRINT_ERROR(...)	 fprintf(stderr, __VA_ARGS__)
#define PRINT_FILE(file, ...)	fprintf(file, __VA_ARGS__)
#define PRINT_ASSERT(e)if ((e)) fprintf(stderr, "PrintAssert:%s (%s:%d)\
			error code:%d\n", __FUNCTION__, __FILE__, __LINE__, e)
//#	define PRINT_ASSERT(e) if ((e)) fprintf(stderr, "PrintAssert:%s (%s:%d) %s\n", __FUNCTION__, __FILE__, __LINE__, Tfa98xx_GetErrorString(e))


#endif	 /* WIN32 */

#endif	 /* user */

#endif				/* _DBGPRINT_H --------------- */
Loading