TAS5805MEVM: Need your support to bringup TAS5805MPWPR codec with IMX8MM with Android 11 code

Part Number: TAS5805MEVM
Other Parts Discussed in Thread: TAS5805M, TAS5805,

Hi Team,

We are integrating TAS5805MPWPR  codec IC with IMX8MM and Android 11 code base.

I have few questions  and doubts: 

1. Dose android supports this TAS5805MPWPR ?

2. Can we integrate TAS5805MPWPR EVK with IMX8MM ?

3. Can we control I2S and I2C signals from imx8mm?

3. Could you please share latest driver files for this TAS5805MPWPR  codec ?

5. Please share software porting guide for this.

Thanks

Divyesh.

  • Hi Divyesh

    1. yes, android version doesn't affect by amplifier.

    2.if IMX8MM has i2c and i2s port, it canbe used.

    3.yes, you can

    4.we don't have special driver codec. you can send command by i2c directly.

    5. you can go to this page for the PPC3 software to control the EVM board.

    https://www.ti.com/tool/TAS5805MEVM?keyMatch=&tisearch=search-everything&usecase=partmatches

    thanks.

    Jesse

  • 4. then how we can integrate it with IMX8MM processor. We need driver file to control audio codec? 

    5. Software guide to integrate with Android code base. 

  • Hi

    I am sorry that TI don't have the driver file or code to support this.

    Jesse

  • In our design we are having this IC with custom board  IMX8MM with Android 11 code base.

    We have to give support for this.. If you don't have codec driver file.. so how it will work?

  • Hi

    we can provide the register position and the description for each register.

    I think if you can ask IMX8MM to provide the support for the port writing and reading.

    thanks

    Jesse

  • The register seems no problem.

    I think you can take a try.

    thanks.

    Jesse

  • Hi Jesse,

    Looks like initial register map is not initialized in driver code. Attaching referance.

    .0654.stereo_flow2_48kHz_default_coldboot_-10dB.h

    Header file is not there. Do I need to add anything in header file?

    Please check driver file. if anything is missing, please let me know.

    Thanks

    Divyesh

  • Hi Divyesh

    your head file seems no problem. you can use it.

    thanks.

    Jesse

  • anything else need to be changed ? to make this codec works? apart from kernel changes

  • these code should work for linux and no necessary to change anything.

    if you want any changes to make it work on other platform, i am very sorry that we can't provide the code support.

  • We are using Android 11 Code base.

  • I am sorry that we don't have any android code for the device.

    thanks.

  • Hi Jesse,

    I have two options for driver file -

    1. Use this driver file : tas5805m.c - sound/soc/codecs/tas5805m.c - Linux source code (v5.18.2) - Bootlin

    If we are using this driver , then can you please provide  "tas5805m_dsp_%s.bin" firmware file.

    2. Or  shall I go for below driver and header file

     6082.stereo_flow2_48kHz_default_coldboot_-10dB.h

    5078.tas5805m.c
    /*
     * Driver for the TAS5805M Audio Amplifier
     *
     * Author: Andy Liu <andy-liu@ti.com>
     *
     * 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.
     *
     * 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/moduleparam.h>
    #include <linux/slab.h>
    #include <linux/of.h>
    #include <linux/init.h>
    #include <linux/i2c.h>
    #include <linux/regmap.h>
    
    #include <sound/soc.h>
    #include <sound/pcm.h>
    #include <sound/initval.h>
    
    #include "stereo_flow2_48kHz_default_coldboot_-10dB.h"
    
    #define TAS5805M_DRV_NAME    "tas5805m"
    
    #define TAS5805M_RATES	     (SNDRV_PCM_RATE_48000)
    #define TAS5805M_FORMATS     (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
    			                  SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
    
    #define TAS5805M_REG_00      (0x00)
    #define TAS5805M_REG_03      (0x03)
    #define TAS5805M_REG_24      (0x24)
    #define TAS5805M_REG_25      (0x25)
    #define TAS5805M_REG_26      (0x26)
    #define TAS5805M_REG_27      (0x27)
    #define TAS5805M_REG_28      (0x28)
    #define TAS5805M_REG_29      (0x29)
    #define TAS5805M_REG_2A      (0x2a)
    #define TAS5805M_REG_2B      (0x2b)
    #define TAS5805M_REG_35      (0x35)
    #define TAS5805M_REG_7F      (0x7f)
    
    #define TAS5805M_PAGE_00     (0x00)
    #define TAS5805M_PAGE_2A     (0x2a)
    
    #define TAS5805M_BOOK_00     (0x00)
    #define TAS5805M_BOOK_8C     (0x8c)
    
    #define TAS5805M_VOLUME_MAX  (158)
    #define TAS5805M_VOLUME_MIN  (0)
    
    
    const uint32_t tas5805m_volume[] = {
    	0x0000001B,    //0, -110dB
    	0x0000001E,    //1, -109dB
    	0x00000021,    //2, -108dB
    	0x00000025,    //3, -107dB
    	0x0000002A,    //4, -106dB
    	0x0000002F,    //5, -105dB
    	0x00000035,    //6, -104dB
    	0x0000003B,    //7, -103dB
    	0x00000043,    //8, -102dB
    	0x0000004B,    //9, -101dB
    	0x00000054,    //10, -100dB
    	0x0000005E,    //11, -99dB
    	0x0000006A,    //12, -98dB
    	0x00000076,    //13, -97dB
    	0x00000085,    //14, -96dB
    	0x00000095,    //15, -95dB
    	0x000000A7,    //16, -94dB
    	0x000000BC,    //17, -93dB
    	0x000000D3,    //18, -92dB
    	0x000000EC,    //19, -91dB
    	0x00000109,    //20, -90dB
    	0x0000012A,    //21, -89dB
    	0x0000014E,    //22, -88dB
    	0x00000177,    //23, -87dB
    	0x000001A4,    //24, -86dB
    	0x000001D8,    //25, -85dB
    	0x00000211,    //26, -84dB
    	0x00000252,    //27, -83dB
    	0x0000029A,    //28, -82dB
    	0x000002EC,    //29, -81dB
    	0x00000347,    //30, -80dB
    	0x000003AD,    //31, -79dB
    	0x00000420,    //32, -78dB
    	0x000004A1,    //33, -77dB
    	0x00000532,    //34, -76dB
    	0x000005D4,    //35, -75dB
    	0x0000068A,    //36, -74dB
    	0x00000756,    //37, -73dB
    	0x0000083B,    //38, -72dB
    	0x0000093C,    //39, -71dB
    	0x00000A5D,    //40, -70dB
    	0x00000BA0,    //41, -69dB
    	0x00000D0C,    //42, -68dB
    	0x00000EA3,    //43, -67dB
    	0x0000106C,    //44, -66dB
    	0x0000126D,    //45, -65dB
    	0x000014AD,    //46, -64dB
    	0x00001733,    //47, -63dB
    	0x00001A07,    //48, -62dB
    	0x00001D34,    //49, -61dB
    	0x000020C5,    //50, -60dB
    	0x000024C4,    //51, -59dB
    	0x00002941,    //52, -58dB
    	0x00002E49,    //53, -57dB
    	0x000033EF,    //54, -56dB
    	0x00003A45,    //55, -55dB
    	0x00004161,    //56, -54dB
    	0x0000495C,    //57, -53dB
    	0x0000524F,    //58, -52dB
    	0x00005C5A,    //59, -51dB
    	0x0000679F,    //60, -50dB
    	0x00007444,    //61, -49dB
    	0x00008274,    //62, -48dB
    	0x0000925F,    //63, -47dB
    	0x0000A43B,    //64, -46dB
    	0x0000B845,    //65, -45dB
    	0x0000CEC1,    //66, -44dB
    	0x0000E7FB,    //67, -43dB
    	0x00010449,    //68, -42dB
    	0x0001240C,    //69, -41dB
    	0x000147AE,    //70, -40dB
    	0x00016FAA,    //71, -39dB
    	0x00019C86,    //72, -38dB
    	0x0001CEDC,    //73, -37dB
    	0x00020756,    //74, -36dB
    	0x000246B5,    //75, -35dB
    	0x00028DCF,    //76, -34dB
    	0x0002DD96,    //77, -33dB
    	0x00033718,    //78, -32dB
    	0x00039B87,    //79, -31dB
    	0x00040C37,    //80, -30dB
    	0x00048AA7,    //81, -29dB
    	0x00051884,    //82, -28dB
    	0x0005B7B1,    //83, -27dB
    	0x00066A4A,    //84, -26dB
    	0x000732AE,    //85, -25dB
    	0x00081385,    //86, -24dB
    	0x00090FCC,    //87, -23dB
    	0x000A2ADB,    //88, -22dB
    	0x000B6873,    //89, -21dB
    	0x000CCCCD,    //90, -20dB
    	0x000E5CA1,    //91, -19dB
    	0x00101D3F,    //92, -18dB
    	0x0012149A,    //93, -17dB
    	0x00144961,    //94, -16dB
    	0x0016C311,    //95, -15dB
    	0x00198A13,    //96, -14dB
    	0x001CA7D7,    //97, -13dB
    	0x002026F3,    //98, -12dB
    	0x00241347,    //99, -11dB
    	0x00287A27,    //100, -10dB
    	0x002D6A86,    //101, -9dB
    	0x0032F52D,    //102, -8dB
    	0x00392CEE,    //103, -7dB
    	0x004026E7,    //104, -6dB
    	0x0047FACD,    //105, -5dB
    	0x0050C336,    //106, -4dB
    	0x005A9DF8,    //107, -3dB
    	0x0065AC8C,    //108, -2dB
    	0x00721483,    //109, -1dB
    	0x00800000,    //110, 0dB
    	0x008F9E4D,    //111, 1dB
    	0x00A12478,    //112, 2dB
    	0x00B4CE08,    //113, 3dB
    	0x00CADDC8,    //114, 4dB
    	0x00E39EA9,    //115, 5dB
    	0x00FF64C1,    //116, 6dB
    	0x011E8E6A,    //117, 7dB
    	0x0141857F,    //118, 8dB
    	0x0168C0C6,    //119, 9dB
    	0x0194C584,    //120, 10dB
    	0x01C62940,    //121, 11dB
    	0x01FD93C2,    //122, 12dB
    	0x023BC148,    //123, 13dB
    	0x02818508,    //124, 14dB
    	0x02CFCC01,    //125, 15dB
    	0x0327A01A,    //126, 16dB
    	0x038A2BAD,    //127, 17dB
    	0x03F8BD7A,    //128, 18dB
    	0x0474CD1B,    //129, 19dB
    	0x05000000,    //130, 20dB
    	0x059C2F02,    //131, 21dB
    	0x064B6CAE,    //132, 22dB
    	0x07100C4D,    //133, 23dB
    	0x07ECA9CD,    //134, 24dB
    	0x08E43299,    //135, 25dB
    	0x09F9EF8E,    //136, 26dB
    	0x0B319025,    //137, 27dB
    	0x0C8F36F2,    //138, 28dB
    	0x0E1787B8,    //139, 29dB
    	0x0FCFB725,    //140, 30dB
    	0x11BD9C84,    //141, 31dB
    	0x13E7C594,    //142, 32dB
    	0x16558CCB,    //143, 33dB
    	0x190F3254,    //144, 34dB
    	0x1C1DF80E,    //145, 35dB
    	0x1F8C4107,    //146, 36dB
    	0x2365B4BF,    //147, 37dB
    	0x27B766C2,    //148, 38dB
    	0x2C900313,    //149, 39dB
    	0x32000000,    //150, 40dB
    	0x3819D612,    //151, 41dB
    	0x3EF23ECA,    //152, 42dB
    	0x46A07B07,    //153, 43dB
    	0x4F3EA203,    //154, 44dB
    	0x58E9F9F9,    //155, 45dB
    	0x63C35B8E,    //156, 46dB
    	0x6FEFA16D,    //157, 47dB
    	0x7D982575,    //158, 48dB
    };
    
    struct tas5805m_priv {
    	struct regmap *regmap;
    
    	struct mutex lock;
    
    	int vol;
    };
    
    const struct regmap_config tas5805m_regmap = {
    	.reg_bits = 8,
    	.val_bits = 8,
    	.cache_type = REGCACHE_RBTREE,
    };
    
    static int tas5805m_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
    {
    	uinfo->type   = SNDRV_CTL_ELEM_TYPE_INTEGER;
    	uinfo->access = (SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE);
    	uinfo->count  = 1;
    	
    	uinfo->value.integer.min  = TAS5805M_VOLUME_MIN;
    	uinfo->value.integer.max  = TAS5805M_VOLUME_MAX;
    	uinfo->value.integer.step = 1;
    
    	return 0;
    }
    
    static int tas5805m_vol_locked_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
    {
    	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
    	struct tas5805m_priv *tas5805m = snd_soc_codec_get_drvdata(codec);
    		
    	mutex_lock(&tas5805m->lock);	
    	ucontrol->value.integer.value[0] = tas5805m->vol;
    	mutex_unlock(&tas5805m->lock);
    	
    	return 0;
    }
    
    static inline int get_volume_index(int vol)
    {
       int index;
    
       index = vol;
       
       if (index < TAS5805M_VOLUME_MIN) 
       	  index = TAS5805M_VOLUME_MIN;   
    
       if (index > TAS5805M_VOLUME_MAX) 
       	  index = TAS5805M_VOLUME_MAX;	
    
       return index;
    }
    
    static void tas5805m_set_volume(struct snd_soc_codec *codec, int vol)
    {
        unsigned int index;
    	uint32_t volume_hex;
    	uint8_t byte4;
    	uint8_t byte3;
    	uint8_t byte2;
    	uint8_t byte1;
    
    	index = get_volume_index(vol);	
    	volume_hex = tas5805m_volume[index];
    
    	byte4 = ((volume_hex >> 24) & 0xFF);
    	byte3 = ((volume_hex >> 16) & 0xFF);
    	byte2 = ((volume_hex >> 8)	& 0xFF);
    	byte1 = ((volume_hex >> 0)	& 0xFF);
    	
    	//w 58 00 00
    	snd_soc_write(codec, TAS5805M_REG_00, TAS5805M_PAGE_00);
    	//w 58 7f 8c
    	snd_soc_write(codec, TAS5805M_REG_7F, TAS5805M_BOOK_8C);
    	//w 58 00 2a
    	snd_soc_write(codec, TAS5805M_REG_00, TAS5805M_PAGE_2A);
    	//w 58 24 xx xx xx xx 
    	snd_soc_write(codec, TAS5805M_REG_24, byte4);
    	snd_soc_write(codec, TAS5805M_REG_25, byte3);
    	snd_soc_write(codec, TAS5805M_REG_26, byte2);
    	snd_soc_write(codec, TAS5805M_REG_27, byte1);
    	//w 58 28 xx xx xx xx 
    	snd_soc_write(codec, TAS5805M_REG_28, byte4);
    	snd_soc_write(codec, TAS5805M_REG_29, byte3);
    	snd_soc_write(codec, TAS5805M_REG_2A, byte2);
    	snd_soc_write(codec, TAS5805M_REG_2B, byte1);
    }
    
    static int tas5805m_vol_locked_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
    {
    	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
    	struct tas5805m_priv *tas5805m = snd_soc_codec_get_drvdata(codec);
    		
    	mutex_lock(&tas5805m->lock);	
    	
    	tas5805m->vol = ucontrol->value.integer.value[0];	
    	tas5805m_set_volume(codec, tas5805m->vol);
    	
    	mutex_unlock(&tas5805m->lock);
    	
    	return 0;
    }
    
    static const struct snd_kcontrol_new tas5805m_vol_control = 
    {	
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 
        .name  = "Master Playback Volume", 
    	.info  = tas5805m_vol_info, 
    	.get   = tas5805m_vol_locked_get,
    	.put   = tas5805m_vol_locked_put, 
    };
    
    static int tas5805m_snd_probe(struct snd_soc_codec *codec)
    {
        int ret;
    		
    	ret = snd_soc_add_codec_controls(codec, &tas5805m_vol_control, 1);
    
    	return ret;
    }
    
    static struct snd_soc_codec_driver soc_codec_tas5805m = {
    	.probe = tas5805m_snd_probe,
    };
    
    static int tas5805m_mute(struct snd_soc_dai *dai, int mute)
    {
    	u8 reg03_value = 0;
    	u8 reg35_value = 0;
    	struct snd_soc_codec *codec = dai->codec;
    	
    	if (mute)
    	{
    	    //mute both left & right channels
    		reg03_value = 0x0b;
    		reg35_value = 0x00;  
    	}
    	else
    	{
    	    //unmute
    		reg03_value = 0x03;
    		reg35_value = 0x11;	
    	}	
    	
    	snd_soc_write(codec, TAS5805M_REG_00, TAS5805M_PAGE_00);
    	snd_soc_write(codec, TAS5805M_REG_7F, TAS5805M_BOOK_00);
    	snd_soc_write(codec, TAS5805M_REG_00, TAS5805M_PAGE_00);	
    	snd_soc_write(codec, TAS5805M_REG_03, reg03_value);
    	snd_soc_write(codec, TAS5805M_REG_35, reg35_value);
    
    	return 0;
    }
    
    static const struct snd_soc_dai_ops tas5805m_dai_ops = {
    	.digital_mute = tas5805m_mute,
    };
    
    static struct snd_soc_dai_driver tas5805m_dai = {
    	.name		= "tas5805m-amplifier",
    	.playback 	= {
    		.stream_name	= "Playback",
    		.channels_min	= 2,
    		.channels_max	= 2,
    		.rates		= TAS5805M_RATES,
    		.formats	= TAS5805M_FORMATS,
    	},
    	.ops = &tas5805m_dai_ops,
    };
    
    
    
    static int tas5805m_probe(struct device *dev, struct regmap *regmap)
    {
    	struct tas5805m_priv *tas5805m;
    	int ret;
    	
    	tas5805m = devm_kzalloc(dev, sizeof(struct tas5805m_priv), GFP_KERNEL);
    	if (!tas5805m)
    		return -ENOMEM;
    	
    	dev_set_drvdata(dev, tas5805m);
    	tas5805m->regmap = regmap;
        tas5805m->vol    = 100;         //100, -10dB
        
        mutex_init(&tas5805m->lock);
    		
    	ret = regmap_register_patch(regmap, tas5805m_init_sequence, ARRAY_SIZE(tas5805m_init_sequence));
    	if (ret != 0)
    	{
    		dev_err(dev, "Failed to initialize TAS5805M: %d\n",ret);
    		goto err;
    
    	}
    
    	ret = snd_soc_register_codec(dev, 
    	                             &soc_codec_tas5805m,
    			                     &tas5805m_dai, 
    								 1);
    	if (ret != 0) 
    	{
    		dev_err(dev, "Failed to register CODEC: %d\n", ret);
    		goto err;
    	}
    
    	return 0;
    	
    err:
    	return ret;
    
    }
    
    static int tas5805m_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
    {	
    	struct regmap *regmap;
    	struct regmap_config config = tas5805m_regmap;
    	
    	regmap = devm_regmap_init_i2c(i2c, &config);
    	if (IS_ERR(regmap))
    		return PTR_ERR(regmap);
    
    	return tas5805m_probe(&i2c->dev, regmap);
    }
    
    static int tas5805m_remove(struct device *dev)
    {	
    	snd_soc_unregister_codec(dev);
    	
    	return 0;
    }
    
    static int tas5805m_i2c_remove(struct i2c_client *i2c)
    {	
    	tas5805m_remove(&i2c->dev);
    	
    	return 0;
    }
    
    static const struct i2c_device_id tas5805m_i2c_id[] = {
    	{ "tas5805m", },
    	{ }
    };
    MODULE_DEVICE_TABLE(i2c, tas5805m_i2c_id);
    
    #ifdef CONFIG_OF
    static const struct of_device_id tas5805m_of_match[] = {
    	{ .compatible = "ti,tas5805m", },
    	{ }
    };
    MODULE_DEVICE_TABLE(of, tas5805m_of_match);
    #endif
    
    static struct i2c_driver tas5805m_i2c_driver = {
    	.probe 		= tas5805m_i2c_probe,
    	.remove 	= tas5805m_i2c_remove,
    	.id_table	= tas5805m_i2c_id,
    	.driver		= {
    		.name	= TAS5805M_DRV_NAME,
    		.of_match_table = tas5805m_of_match,
    	},
    };
    
    module_i2c_driver(tas5805m_i2c_driver);
    
    MODULE_AUTHOR("Andy Liu <andy-liu@ti.com>");
    MODULE_DESCRIPTION("TAS5805M Audio Amplifier Driver");
    MODULE_LICENSE("GPL v2");

    Need your help to choose only one, which will help in Kernel 5.10 version and android 11 code base 

    thanks

    Divyesh

  • Divyesh

    please refer below link. 

    these code is the only thing what we can provide.

    i am not sure does it work for you. Please confirm.

    https://tidrive.ext.ti.com/u/sig85JwoPO6gKDzo/1197b1ae-593a-42f8-85bc-d2eb884fd2e3?l

    we don't have any bin file to provide.

    so maybe you need to use .h file or you can confirm does the file in the link work for you or not.

    thanks.

    Jesse

  • Hi Jesse,

    Need your help to initialize DTS file.

    I cant see any pins driver file to control from dts. like fault, pdn pin.

    If you check our schematic, We need to control below few pins which highlighted in yellow.

    help to control this pins from imx.

    pls confirm

  • Hi Divyesh

    we don't have that kind of file.

    you mean you use your mcu pin to control our pin of IC, i think this file should provide by MCU company.

    thanks.

    Jesse

  • The driver file you suggested, doesn't have pins to control fault, pdn pins.... 

    how to configure these pins then?

  • those are all files we can provide.

    please confirm imx8mm how it send the signal.

  • Pdn, fualt pins will be connected to IMX8MM..

    When codec need to powerdown..imx can send signal on this pins...

    these pins will be configured in dts files....and dts node for this codec will be parsed in driver... so driver should control this pin.

    ThankS

  • Hi Divyesh

     We don't have any file can control IMX8MM device, you need to ask IMX8MM side for these file.

  • Hi Team,

    I'm configuring I2S signals for TAS5805M. As per the datasheet MCLK is not required.

    Could you please brief on BCLK and WCLK clocks... How these clocks will be generated. 

    What are the value we are expecting at BCLK and WCLK?

    Thanks

  • Hi Divyesh

    you can use mclk as bclk, which is the sclk of amp.

    the wclk is the LRCLK of amp.

    about the value, you can refer the below table.

  • Hi Divyesh

    for the question is a different one, can we change the thread to different e2e ticket, or you can contact me by e-mail.

    my e-mail address is : jesse-ji@ti.com

    thanks.

    Jesse

  • Hi Jesse,

    Thanks for the data and Mail-ID.

    Added driver file shared by you [https://tidrive.ext.ti.com/u/sig85JwoPO6gKDzo/1197b1ae-593a-42f8-85bc-d2eb884fd2e3?l] and done with DTSI and all other required changes. but we are facing compilation issue as API's used in driver file are from older kernel version. This driver file is having less features , even sound controls are not there.

    I was planning to go with tas5805m.c - sound/soc/codecs/tas5805m.c - Linux source code (v5.18) - Bootlin driver. This driver looks good ( not facing any compilation issues ). BUT, this driver requires bin file for DSP configuration. Could you please help for that ?

    Thanks

    Divyesh

  • Hi Divyesh

    i am afraid that our side don't have that kind of bin file.

    thanks.

    Jesse

  • bin file is nothing but DSP config header file ... I am going to use header file change instead of bin ..

    Will share changes . I want you to review it properly.

    thanks

  • I have made few changes in code to load header file which is having DSP configuration setup array.

    I want expert advice on that changes, Could you please review these changes once. Since DSP configuration is most imp part of it.

    Please find dts changes:

    + pvdd_tas: regulator-12v {
    + compatible = "regulator-fixed";
    + regulator-name = "12V";
    + regulator-min-microvolt = <12000000>;
    + regulator-max-microvolt = <12000000>;
    + startup-delay-us = <300000>;
    + regulator-always-on;
    + };
    +
    + sound-tas5805 {
    + compatible = "simple-audio-card";
    + simple-audio-card,name = "tas5805m-amp";
    + simple-audio-card,format = "i2s";
    + simple-audio-card,bitclock-master = <&dailink0_master>;
    + simple-audio-card,frame-master = <&dailink0_master>;
    +
    + dailink0_master: simple-audio-card,cpu {
    + sound-dai = <&sai3>;
    + };
    + simple-audio-card,codec {
    + sound-dai = <&tas5805m>;
    + };
    + };
    +

    +&i2c4 {
    + clock-frequency = <100000>;
    + pinctrl-names = "default";
    + pinctrl-0 = <&pinctrl_i2c4>;
    + status = "okay";
    +
    + tas5805m: tas5805m@2c {
    + compatible = "ti,tas5805m";
    + #address-cells = <1>;
    + #size-cells = <0>;
    + reg = <0x2c>;
    + pvdd-supply = <&pvdd_tas>;
    + pinctrl-names = "default";
    + pinctrl-0 = <&pinctrl_pdn_gpio>;
    + pdn-gpios = <&gpio3 20 GPIO_ACTIVE_LOW>;
    + status = "okay";
    + };
    +};

    + pinctrl_i2c4: i2c4grp {
    + fsl,pins = <
    + MX8MM_IOMUXC_I2C4_SCL_I2C4_SCL 0x400001c3
    + MX8MM_IOMUXC_I2C4_SDA_I2C4_SDA 0x400001c3
    + >;
    + };
    +
    + pinctrl_pdn_gpio: pinctrl_pdn_gpio {
    + fsl,pins = <
    + MX8MM_IOMUXC_SAI5_RXC_GPIO3_IO20 0x41
    + >;
    + };
    +

    + /*TAS5805 SAI3*/
    pinctrl_sai3: sai3grp {
    fsl,pins = <
    - MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0xd6
    - MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0xd6
    - MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK 0xd6
    - MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0xd6
    + MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0xd6 /*WCLK*/
    + MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0xd6 /*BCLK*/
    + MX8MM_IOMUXC_SAI3_RXD_SAI3_RX_DATA0 0xd6 /*DOUT*/
    + MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0xd6 /*DIN*/
    >;
    };

    Please check patch file for driver changes & attaching header file for reference:

    1200.tas5805m.h

    removed_bin_dependancy.txt
    diff --git a/sound/soc/codecs/tas5805m_20w.c b/sound/soc/codecs/tas5805m_20w.c
    index 7ec4cde..226fba5 100644
    --- a/sound/soc/codecs/tas5805m_20w.c
    +++ b/sound/soc/codecs/tas5805m_20w.c
    @@ -29,6 +29,7 @@
     #include <sound/soc.h>
     #include <sound/pcm.h>
     #include <sound/initval.h>
    +#include "tas5805m.h"
     
     /* Datasheet-defined registers on page 0, book 0 */
     #define REG_PAGE		0x00
    @@ -451,39 +452,12 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c)
     		return PTR_ERR(tas5805m->gpio_pdn_n);
     	}
     
    -	/* This configuration must be generated by PPC3. The file loaded
    -	 * consists of a sequence of register writes, where bytes at
    -	 * even indices are register addresses and those at odd indices
    -	 * are register values.
    -	 *
    -	 * The fixed portion of PPC3's output prior to the 5ms delay
    -	 * should be omitted.
    -	 */
    -	if (device_property_read_string(dev, "ti,dsp-config-name",
    -					&config_name))
    -		config_name = "default";
    -
    -	snprintf(filename, sizeof(filename), "tas5805m_dsp_%s.bin",
    -		 config_name);
    -	ret = request_firmware(&fw, filename, dev);
    -	if (ret)
    -		return ret;
    -
    -	if ((fw->size < 2) || (fw->size & 1)) {
    -		dev_err(dev, "firmware is invalid\n");
    -		release_firmware(fw);
    -		return -EINVAL;
    -	}
    -
    -	tas5805m->dsp_cfg_len = fw->size;
    -	tas5805m->dsp_cfg_data = devm_kmalloc(dev, fw->size, GFP_KERNEL);
    -	if (!tas5805m->dsp_cfg_data) {
    -		release_firmware(fw);
    -		return -ENOMEM;
    +	ret = regmap_register_patch(regmap, tas5805m_init_sequence, ARRAY_SIZE(tas5805m_init_sequence));
    +	if (ret != 0)
    +	{
    +		dev_err(dev, "Failed to initialize TAS5805M: %d\n",ret);
    +		goto err;
     	}
    -	memcpy(tas5805m->dsp_cfg_data, fw->data, fw->size);
    -
    -	release_firmware(fw);
     
     	/* Do the first part of the power-on here, while we can expect
     	 * the I2S interface to be quiet. We must raise PDN# and then
    @@ -521,6 +495,9 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c)
     	}
     
     	return 0;
    +
    +err:
    +	return ret;
     }
     
     static int tas5805m_i2c_remove(struct i2c_client *i2c)
    @@ -564,4 +541,4 @@ static int tas5805m_i2c_remove(struct i2c_client *i2c)
     MODULE_AUTHOR("Andy Liu <andy-liu@ti.com>");
     MODULE_AUTHOR("Daniel Beer <daniel.beer@igorinstitute.com>");
     MODULE_DESCRIPTION("TAS5805M Audio Amplifier Driver");
    -MODULE_LICENSE("GPL v2");
    \ No newline at end of file
    +MODULE_LICENSE("GPL v2");
    

  • Hi 

       Our whole team is focused on the audio amp devices. This IMX8MM device is not TI's products, I'm afraid no one here is familiar with it. No one understand the codes you post, I'm afraid.

  • I have made changes for TAS5805M to support with IMX8MM processor.

    I wanted you to review above patch file , which is having header file changes for DSP config

  • I'm afraid no one here is familiar with it. No one understand the codes you post, I'm afraid.

  • Hi Shadow,

    Used drive file:  tas5805m.c - sound/soc/codecs/tas5805m.c - Linux source code (v5.18) - Bootlin

    File path is correct : vendor/firmware

    Driver was trying to look firmware file before file system mount on device. That’s why it was throwing an error as file not present.

    After few changes able load it properly and codec got registered.

    Success logs:

    06-14 08:08:16.028   227   227 I modprobe: Loading module /vendor/lib/modules/snd-soc-tas5805m_20w.ko with args ""

    06-14 08:08:16.114     0     0 E tas5805m 3-002c: tas5805m_i2c_probe Probe invoked

    06-14 08:08:16.123     0     0 E tas5805m 3-002c: Divyesh tas >> allocated register map tas5805m_i2c_probe

    06-14 08:08:16.135     0     0 E tas5805m 3-002c: Divyesh tas >> got pvdd supply tas5805m_i2c_probe pvdd :202885120

    06-14 08:08:16.144     0     0 E tas5805m 3-002c: Divyesh tas >> got pdn tas5805m_i2c_probe

    06-14 08:08:16.151     0     0 E tas5805m 3-002c: Divyesh tas >> Firmware loading tas5805m_i2c_probe and filename: tas5805m_dsp_pbtl_config.bin

    06-14 08:08:16.172     0     0 E tas5805m 3-002c: Divyesh tas >> Loading firmware from /vendor/firmware/tas5805m_dsp_pbtl_config.bin

    06-14 08:08:16.182     0     0 E tas5805m 3-002c: Divyesh tas >> direct-loading tas5805m_dsp_pbtl_config.bin

    06-14 08:08:16.264   227   227 I modprobe: Loaded kernel module /vendor/lib/modules/snd-soc-tas5805m_20w.ko

    06-14 08:08:17.725   361   361 I audio_hw_primary: card0: tas5805m-amp

     

    evk_8mm:/ # cat /proc/asound/cards

     0 [tas5805mamp    ]: tas5805m-amp - tas5805m-amp

                          tas5805m-amp

  • Hi Divyesh

       Seems problem solved. Glad to heat that.

  • Still audio codec interface need to be up.!

  • Hi  ,

    We are using TAS5805MEVM board. We are going to connect with IMX8MM.

    We want to give external I2S and i2C signal to the TAS5805MEVM board.

    IMX8MM <<---->> BCLK,WCLK,DIN,DOUT <<--->> TAS5805MEVM board

    Need to isolate i2S signal from SPDIF and XMOS.

    What are the pin settings need to be done for that.

    What i2c signal I have to use.. We are giving i2c from IMX8mm processor

    IMX8MM <<---->> i2c <<--->> TAS5805MEVM board

    Design:

  • Hi Divyesh

       You can use J12 J13 J14 to send in I2S, use J18 and J19 to send in I2C. This EVM can't completely isolate signal path from XMOS or SPDIF physically, but if you don't use PPC3 software to control, only power up the EVM. There should be no I2S and I2C signal from XMOS or SPDIF.

  • Thanks ,

    Will try these configurations..

    1. To power up the board, Do we need external power supply or we need to connect USB?

    2. What should I set I2C address in dts file. 

    3. After powering up, if we are not using PPC tool then XMOS and SPDIF should not work as per your inputs right?

    Thanks

    Divyesh

  • Hi Divyesh

    1. To power up the board, Do we need external power supply or we need to connect USB?

    Both is necessary. power supply provide the power for PVDD, usb provide the power for DVDD.

    or you can use an external power supply to provide the power for DVDD, then the USB should be unnecessary.

    2. What should I set I2C address in dts file. 

    if u use the upper side chip, it is 0x58

    the down side chip is 0x5a

    3. After powering up, if we are not using PPC tool then XMOS and SPDIF should not work as per your inputs right?

    XMOS should not work anymore, but you can switch the input to SPDIF on the board, it should work i think.

    thanks.

    Jesse

  • Hi Jesse Ji,

    Thanks for the inputs.

    Jesse - XMOS should not work anymore, but you can switch the input to SPDIF on the board, it should work i think.

    Divyesh - Ok got it. In our case we are not using XMOS and SPDIF, We want to I2S and I2C signals from IMX8mm Processor directly. We are not using any PPC tool for any configuration.

  • Hi Jesse,

    To give external I2S signal from IMX8MM, What should I keep jumper settings in below image:

    Confused between BYPASS and PSIA. Please clear out the doubt.

  • Divyesh

    if you use the external i2s, you can just remove the jumper.

    thanks.

    Jesse

  • Hi ,

    Could you please share DSP settings header file for BTL (non-PBTL configuration). As per out design, We should go for BTL configurations register settings.

    I know that using a non-PBTL configuration on PBTL hardware will trip the short-circuit protection, but I'm not sure if this will occur the other way around -- perhaps it will be fine?

  • Hi Divyesh

    You can using the PPC3 tool to generate the head file for amplifier setting.

    the setting is not decide by TI, it should decide by your hardware engineer.

    thanks.

    Jesse

  • Hi Jesse ji,

    We don't have provision to connect audio codec with Laptop. Could you please here to generate header file for PBTL and BTL configuration?

    Question on Power control: 

    Is it possible to control the output power for this IC?

    AS per our requirement, We have two TAS5805M IC's in design. These IC's has their specific use cases.

    Audio Internal Amplifier 0.8W Speaker - TAS5805M - This IC will be specifically use for 0.8W power (PBTL configuration)-

    Use case for this IC - This Amp will be used for notification and Alarm ringtone

     

    2X20W AUDIO AMPLIFIER - TAS5805M- This IC will be specifically use for 2*20W power (BTL configuration).

    Use case for this IC - This Amp will be used for media player or we can say as a woofer we are using it.

     

    To achieve above requirement, What changes need to done so that we can achieve respective power from the output?

    This is major requirement we have in our design. Please share inputs to achieve above requirement.

  • Hello Divyesh,

    Refer to this guide on how to generate a header file, this should be done by the engineer designing this system so choose a speaker configuration and process flow and follow these steps to create a header file How-to-Generate-a-Header-File-from-TAS5805M-in-PPC3.pdf

    0.8W application wouldn't be a good fit for the TAS5805M, refer to https://www.ti.com/audio-ic/amplifiers/speaker-amplifiers/overview.html for lower output power mono speaker amps that would suit this application better

    Refer to Output Power vs Supply Voltage in the TAS5805M datasheet to determine what would be a suitable supply voltage for your impedance. However we do state in our datasheet spec that we can do 2 × 23 W in 2.0 Mode (8-Ω, 21 V, THD+N=1%) if you want one example for reference for a BTL configuration.


    best regards,

    Luis

  • Hi @luis,  

    We have integrated TAS5805M EVK with IMX8MM.

    Please check Image below:

    We have connected USB for DVDD. We are giving PVDD - 21 V. External I2S and i2C we are giving

    I2S lines soldered at bottom side:

    After integrating all the changes, We are facing one issues.

    Need you help to check the issues.

    I2C dump:

    Fail logs:

    23:59:57.819 0 0 E imx-sdma 302c0000.dma-controller: tas5 Direct firmware load for imx/sdma/sdma-imx7d.bin failed with error -2
    01-01 00:00:00.011 0 0 E asoc-simple-card sound-tas5805-20w: link 1, dais 2, ccnf 0
    01-01 00:00:00.018 0 0 E asoc-simple-card sound-tas5805-20w: link_of (/sound-tas5805-20w)
    01-01 00:00:00.025 0 0 E asoc-simple-card sound-tas5805-0p8w: link 1, dais 2, ccnf 0
    01-01 00:00:00.032 0 0 E asoc-simple-card sound-tas5805-0p8w: link_of (/sound-tas5805-0p8w)
    01-01 00:00:01.236 0 0 E asoc-simple-card sound-tas5805-20w: link 1, dais 2, ccnf 0
    01-01 00:00:01.242 0 0 E asoc-simple-card sound-tas5805-20w: link_of (/sound-tas5805-20w)
    01-01 00:00:01.250 0 0 E asoc-simple-card sound-tas5805-0p8w: link 1, dais 2, ccnf 0
    01-01 00:00:01.257 0 0 E asoc-simple-card sound-tas5805-0p8w: link_of (/sound-tas5805-0p8w)
    01-01 00:00:02.973 0 0 E asoc-simple-card sound-tas5805-20w: link 1, dais 2, ccnf 0
    01-01 00:00:02.980 0 0 E asoc-simple-card sound-tas5805-20w: link_of (/sound-tas5805-20w)
    01-01 00:00:02.988 0 0 E asoc-simple-card sound-tas5805-0p8w: link 1, dais 2, ccnf 0
    01-01 00:00:02.994 0 0 E asoc-simple-card sound-tas5805-0p8w: link_of (/sound-tas5805-0p8w)
    01-01 00:00:03.050 0 0 E asoc-simple-card sound-tas5805-20w: link 1, dais 2, ccnf 0
    01-01 00:00:03.056 0 0 E asoc-simple-card sound-tas5805-20w: link_of (/sound-tas5805-20w)
    01-01 00:00:03.064 0 0 E asoc-simple-card sound-tas5805-0p8w: link 1, dais 2, ccnf 0
    01-01 00:00:03.071 0 0 E asoc-simple-card sound-tas5805-0p8w: link_of (/sound-tas5805-0p8w)
    01-01 00:00:03.119 0 0 E asoc-simple-card sound-tas5805-20w: link 1, dais 2, ccnf 0
    01-01 00:00:03.125 0 0 E asoc-simple-card sound-tas5805-20w: link_of (/sound-tas5805-20w)
    01-01 00:00:03.133 0 0 E asoc-simple-card sound-tas5805-0p8w: link 1, dais 2, ccnf 0
    01-01 00:00:03.140 0 0 E asoc-simple-card sound-tas5805-0p8w: link_of (/sound-tas5805-0p8w)
    01-01 00:00:03.169 0 0 E platform regulatory.0: tas5 Direct firmware load for regulatory.db failed with error -2
    01-01 00:00:04.864 0 0 E platform regulatory.0: tas5805 Loading firmware from /vendor/firmware/regulatory.db.p7s
    01-01 00:00:04.875 0 0 E platform regulatory.0: tas5805 direct-loading regulatory.db.p7s
    01-01 00:00:05.571 0 0 E Enter into: tas5805m_i2c_probe
    01-01 00:00:05.571 0 0 E tas5805m 3-002c: Firmware file name : tas5805m_dsp_pbtl_config_20w.bin
    01-01 00:00:05.584 0 0 E tas5805m 3-002c: tas5805 Loading firmware from /vendor/firmware/tas5805m_dsp_pbtl_config_20w.bin
    01-01 00:00:05.594 0 0 E tas5805m 3-002c: tas5805 direct-loading tas5805m_dsp_pbtl_config_20w.bin
    01-01 00:00:05.602 0 0 E tas5805m 3-002c: ret = request_firmware: 0
    01-01 00:00:05.611 0 0 E tas5805m 3-002c: ret = regulator_enable: 0
    01-01 00:00:05.775 0 0 E tas5805m 3-002c: ASoC: dynamically register DAI 3-002c
    01-01 00:00:05.781 0 0 E tas5805m 3-002c: ASoC: Registered DAI 'tas5805m-amplifier'
    01-01 00:00:05.788 0 0 E tas5805m 3-002c: ret = snd_soc_register_component: 0
    01-01 00:00:05.851 0 0 E asoc-simple-card sound-tas5805-20w: link 1, dais 2, ccnf 0
    01-01 00:00:05.858 0 0 E asoc-simple-card sound-tas5805-20w: link_of (/sound-tas5805-20w)
    01-01 00:00:05.865 0 0 E asoc-simple-card sound-tas5805-20w: ASoC: binding 30030000.sai-tas5805m-amplifier
    01-01 00:00:05.875 0 0 E asoc-simple-card sound-tas5805-20w: ASoC: probe tas5805m-amp-20W dai link 0 late -2
    01-01 00:00:05.883 0 0 E asoc-simple-card sound-tas5805-20w: ASoC: probe tas5805m-amp-20W dai link 0 late -1
    01-01 00:00:05.901 0 0 E asoc-simple-card sound-tas5805-20w: ASoC: probe tas5805m-amp-20W dai link 0 late 0
    01-01 00:00:05.909 0 0 E asoc-simple-card sound-tas5805-20w: ASoC: probe tas5805m-amp-20W dai link 0 late 1
    01-01 00:00:05.918 0 0 E asoc-simple-card sound-tas5805-20w: ASoC: probe tas5805m-amp-20W dai link 0 late 2
    01-01 00:00:05.932 0 0 E asoc-simple-card sound-tas5805-0p8w: link 1, dais 2, ccnf 0
    01-01 00:00:05.939 0 0 E asoc-simple-card sound-tas5805-0p8w: link_of (/sound-tas5805-0p8w)
    01-01 00:00:12.782 0 0 E Enter into: tas5805m_vol_info
    01-01 00:00:12.782 0 0 E Enter into: tas5805m_vol_info
    01-01 00:00:12.787 0 0 E Enter into: tas5805m_vol_get
    01-01 00:00:12.791 0 0 E Enter into: tas5805m_vol_info
    01-01 00:00:12.806 0 0 E Enter into: tas5805m_vol_put
    01-01 00:00:12.806 0 0 E tas5805m 3-002c: set vol=90/0 (is_powered=0)
    01-01 00:00:12.816 0 0 E Enter into: tas5805m_vol_info
    01-01 00:00:12.816 0 0 E Enter into: tas5805m_vol_get
    01-01 00:00:12.820 0 0 E Enter into: tas5805m_vol_info
    01-01 00:00:12.824 0 0 E Enter into: tas5805m_vol_put
    01-01 00:00:12.828 0 0 E tas5805m 3-002c: set vol=90/90 (is_powered=0)
    01-01 00:00:33.347 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:33.590 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:33.603 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:35.671 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:35.695 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:35.726 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:38.602 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:38.607 0 0 E 30030000.sai-tas5805m-amplifier: ASoC: pop wq checking: Playback status: active waiting: yes
    01-01 00:00:38.623 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:40.547 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:40.566 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:40.586 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:40.607 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:40.619 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:40.931 0 0 E tas5805m 3-002c: set mute=1 (is_powered=0)
    01-01 00:00:43.727 0 0 E 30030000.sai-tas5805m-amplifier: ASoC: pop wq checking: Playback status: inactive waiting: yes

    06-29 04:43:40.984 351 1145 I tas5 audio_hw_primary: select_output_device(), headphone 0 ,headset 0 ,speaker 2
    06-29 04:43:40.984 351 1145 D tas5 audio_hw_primary: start_output_stream: pcm_open: card: 0, pcm_device_id: 0, rate: 48000, channel: 2, format: 0, period_size: 0xc0, flag: 9
    06-29 04:43:40.992 351 1145 E tas5 audio_hw_primary: start_output_stream: pcm_open error: cannot set hw params: Invalid argument

    Thanks

    Divyesh.

  • Hi Divyesh

    can you confirm the waveform of i2s and i2c? Also the pvdd and dvdd voltage.

    Also which chip are you using? it seems like you are using Amplifier U1.

    Am i understanding right?

    thanks.

    Jesse

  • No I2S waveform coming out.

    I2C is working. Able to dump and detect.

    U1 we are using

    Pvdd is 21v and dvdd 3.3v