Skip to contentSkip to conversation

ASoC: tas2781: Add tas2781 driver.

PATCH Superseded Shenghao Ding 2 participants 4 messages Jan 31, 2023

Subsystems (3)

v2 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: tas2781: Add tas2781 driver.

Create tas2781 driver.

---
Changes to be committed:

	modified:   sound/soc/codecs/Kconfig
	modified:   sound/soc/codecs/Makefile
	new file:   sound/soc/codecs/tas2781-dsp.c
	new file:   sound/soc/codecs/tas2781-dsp.h
	new file:   sound/soc/codecs/tas2781-i2c.c
	new file:   sound/soc/codecs/tas2781.h
---
 sound/soc/codecs/Kconfig       |   12 +
 sound/soc/codecs/Makefile      |    2 +
 sound/soc/codecs/tas2781-dsp.c | 2273 ++++++++++++++++++++++++++++++++
 sound/soc/codecs/tas2781-dsp.h |  178 +++
 sound/soc/codecs/tas2781-i2c.c | 1926 +++++++++++++++++++++++++++
 sound/soc/codecs/tas2781.h     |  176 +++
 6 files changed, 4567 insertions(+)
 create mode 100644 sound/soc/codecs/tas2781-dsp.c
 create mode 100644 sound/soc/codecs/tas2781-dsp.h
 create mode 100644 sound/soc/codecs/tas2781-i2c.c
 create mode 100644 sound/soc/codecs/tas2781.h
sound/soc/codecs/Kconfig +12 -0
index 0f9d71490..9016c4846 100644
@@ -223,6 +223,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_TAS2764
 	imply SND_SOC_TAS2770
 	imply SND_SOC_TAS2780
+	imply SND_SOC_TAS2781
 	imply SND_SOC_TAS5086
 	imply SND_SOC_TAS571X
 	imply SND_SOC_TAS5720
@@ -1579,6 +1580,17 @@ config SND_SOC_TAS2780
 	  Enable support for Texas Instruments TAS2780 high-efficiency
 	  digital input mono Class-D audio power amplifiers.
 
+config SND_SOC_TAS2781
+	tristate "Texas Instruments TAS2781 speaker amplifier"
+	depends on I2C
+	select REGMAP_I2C
+	select CRC8
+	help
+	  Enable support for Texas Instruments TAS2781 Smart Amplifier
+	  Digital input mono Class-D and DSP-inside audio power amplifiers.
+	  Note the TAS2781 driver implements a flexible and configurable
+	  algo coff setting, for one, two, even multiple TAS2781 chips.
+
 config SND_SOC_TAS5086
 	tristate "Texas Instruments TAS5086 speaker amplifier"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 71d3ce586..49f912aea 100644
@@ -355,6 +355,7 @@ snd-soc-tas2552-objs := tas2552.o
 snd-soc-tas2562-objs := tas2562.o
 snd-soc-tas2764-objs := tas2764.o
 snd-soc-tas2780-objs := tas2780.o
+snd-soc-tas2781-objs :=	tas2781-i2c.o tas2781-dsp.o
 # Mux
 snd-soc-simple-mux-objs := simple-mux.o
 
@@ -606,6 +607,7 @@ obj-$(CONFIG_SND_SOC_TAS2552)	+= snd-soc-tas2552.o
 obj-$(CONFIG_SND_SOC_TAS2562)	+= snd-soc-tas2562.o
 obj-$(CONFIG_SND_SOC_TAS2764)	+= snd-soc-tas2764.o
 obj-$(CONFIG_SND_SOC_TAS2780)	+= snd-soc-tas2780.o
+obj-$(CONFIG_SND_SOC_TAS2781)	+= snd-soc-tas2781.o
 obj-$(CONFIG_SND_SOC_TAS5086)	+= snd-soc-tas5086.o
 obj-$(CONFIG_SND_SOC_TAS571X)	+= snd-soc-tas571x.o
 obj-$(CONFIG_SND_SOC_TAS5720)	+= snd-soc-tas5720.o
sound/soc/codecs/tas2781-dsp.c new file +2273 -0

2,273 lines not on this page · raw message

sound/soc/codecs/tas2781-dsp.h new file +178 -0

178 lines not on this page · raw message

sound/soc/codecs/tas2781-i2c.c new file +1926 -0

511 lines not on this page · raw message

sound/soc/codecs/tas2781.h new file +176 -0

176 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

#1 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Shenghao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on linus/master v6.2-rc6 next-20230131] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shenghao-Ding/ASoC-tas2781-Add-tas2781-driver/20230131-212221
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20230131131701.7097-1-13916275206%40139.com
patch subject: [PATCH v2] ASoC: tas2781: Add tas2781 driver.
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230131/[email protected]/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/d0782b52a1274657458fa49356eacb7c56eddf6b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Shenghao-Ding/ASoC-tas2781-Add-tas2781-driver/20230131-212221 git checkout d0782b52a1274657458fa49356eacb7c56eddf6b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash sound/soc/

If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> sound/soc/codecs/tas2781-dsp.c:591:5: warning: no previous prototype for 'fw_parse_variable_header_git' [-Wmissing-prototypes]
     591 | int fw_parse_variable_header_git(struct tasdevice_priv *tas_dev,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/codecs/tas2781-dsp.c:650:5: warning: no previous prototype for 'fw_parse_variable_header_cal' [-Wmissing-prototypes]

650 | int fw_parse_variable_header_cal(struct tasdevice_priv *tas_dev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/fw_parse_variable_header_git +591 sound/soc/codecs/tas2781-dsp.c

590

 > 591	int fw_parse_variable_header_git(struct tasdevice_priv *tas_dev,
   592		const struct firmware *fmw, int offset)
   593	{
   594		const unsigned char *buf = fmw->data;
   595		struct tasdevice_fw *tas_fmw = tas_dev->fmw;
   596		struct tasdevice_dspfw_hdr *fw_hdr = &(tas_fmw->fw_hdr);
   597		int i = strlen((char *)&buf[offset]);
   598	
   599		i++;
   600	
   601		if (offset + i > fmw->size) {
   602			dev_err(tas_dev->dev, "%s: File Size error\n", __func__);
   603			offset = -1;
   604			goto out;
   605		}
   606	
   607		offset  += i;
   608	
   609		if (offset + 4 > fmw->size) {
   610			dev_err(tas_dev->dev, "%s: File Size error\n", __func__);
   611			offset = -1;
   612			goto out;
   613		}
   614		fw_hdr->device_family = SMS_HTONL(buf[offset], buf[offset + 1],
   615			buf[offset + 2], buf[offset + 3]);
   616		if (fw_hdr->device_family != 0) {
   617			dev_err(tas_dev->dev, "ERROR:%s: not TAS device\n", __func__);
   618			offset = -1;
   619			goto out;
   620		}
   621		offset  += 4;
   622		if (offset + 4 > fmw->size) {
   623			dev_err(tas_dev->dev, "%s: File Size error\n", __func__);
   624			offset = -1;
   625			goto out;
   626		}
   627		fw_hdr->device = SMS_HTONL(buf[offset], buf[offset + 1],
   628			buf[offset + 2], buf[offset + 3]);
   629		if (fw_hdr->device >= TASDEVICE_DSP_TAS_MAX_DEVICE ||
   630			fw_hdr->device == 6) {
   631			dev_err(tas_dev->dev, "ERROR:%s: not support device %d\n",
   632				__func__, fw_hdr->device);
   633			offset = -1;
   634			goto out;
   635		}
   636		offset  += 4;
   637		fw_hdr->ndev = deviceNumber[fw_hdr->device];
   638		if (fw_hdr->ndev != tas_dev->ndev) {
   639			dev_err(tas_dev->dev,
   640				"%s: ndev(%u) in dspbin dismatch ndev(%u) in DTS\n",
   641				__func__, fw_hdr->ndev,
   642				tas_dev->ndev);
   643			offset = -1;
   644		}
   645	
   646	out:
   647		return offset;
   648	}
   649	
 > 650	int fw_parse_variable_header_cal(struct tasdevice_priv *tas_dev,

651 struct tasdevice_fw *tas_fmw, const struct firmware *fmw, int offset)
652 {
653 const unsigned char *buf = fmw->data;
654 struct tasdevice_dspfw_hdr *fw_hdr = &(tas_fmw->fw_hdr);
655 int i = strlen((char *)&buf[offset]);
656
657 i++;
658
659 if (offset + i > fmw->size) {
660 dev_err(tas_dev->dev, "%s: File Size error\n", __func__);
661 offset = -1;
662 goto out;
663 }
664
665 offset += i;
666
667 if (offset + 4 > fmw->size) {
668 dev_err(tas_dev->dev, "%s: mnDeviceFamily error\n", __func__);
669 offset = -1;
670 goto out;
671 }
672 fw_hdr->device_family = SMS_HTONL(buf[offset], buf[offset + 1],
673 buf[offset + 2], buf[offset + 3]);
674 if (fw_hdr->device_family != 0) {
675 dev_err(tas_dev->dev, "ERROR:%s: not TAS device\n", __func__);
676 offset = -1;
677 goto out;
678 }
679 offset += 4;
680 if (offset + 4 > fmw->size) {
681 dev_err(tas_dev->dev, "%s: mnDevice error\n", __func__);
682 offset = -1;
683 goto out;
684 }
685 fw_hdr->device = SMS_HTONL(buf[offset], buf[offset + 1],
686 buf[offset + 2], buf[offset + 3]);
687 if (fw_hdr->device >= TASDEVICE_DSP_TAS_MAX_DEVICE ||
688 fw_hdr->device == 6) {
689 dev_err(tas_dev->dev, "ERROR:%s: not support device %d\n",
690 __func__, fw_hdr->device);
691 offset = -1;
692 goto out;
693 }
694 offset += 4;
695 fw_hdr->ndev = deviceNumber[fw_hdr->device];
696 if (fw_hdr->ndev != 1) {
697 dev_err(tas_dev->dev,
698 "%s: calbin must be 1, but currently ndev(%u)\n",
699 __func__, fw_hdr->ndev);
700 offset = -1;
701 }
702
703 out:
704 return offset;
705 }
706

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#2 lore raw
In reply to Shenghao Ding
Thank you for the patch! Perhaps something to improve:

Hi Shenghao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on linus/master v6.2-rc6 next-20230131] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shenghao-Ding/ASoC-tas2781-Add-tas2781-driver/20230131-212221
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20230131131701.7097-1-13916275206%40139.com
patch subject: [PATCH v2] ASoC: tas2781: Add tas2781 driver.
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20230201/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/d0782b52a1274657458fa49356eacb7c56eddf6b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Shenghao-Ding/ASoC-tas2781-Add-tas2781-driver/20230131-212221 git checkout d0782b52a1274657458fa49356eacb7c56eddf6b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash sound/soc/

If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

sound/soc/codecs/tas2781-dsp.c:591:5: warning: no previous prototype for 'fw_parse_variable_header_git' [-Wmissing-prototypes]
591 | int fw_parse_variable_header_git(struct tasdevice_priv *tas_dev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:650:5: warning: no previous prototype for 'fw_parse_variable_header_cal' [-Wmissing-prototypes]
650 | int fw_parse_variable_header_cal(struct tasdevice_priv *tas_dev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,

                    from include/linux/acpi.h:15,
                    from include/linux/i2c.h:13,
                    from sound/soc/codecs/tas2781-dsp.c:16:
   sound/soc/codecs/tas2781-dsp.c: In function 'fw_parse_block_data':
>> sound/soc/codecs/tas2781-dsp.c:809:25: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     809 |                         "%s: File Size(%lu) error offset = %d n = %d\n",
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ^~~
   include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
     144 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   sound/soc/codecs/tas2781-dsp.c:808:17: note: in expansion of macro 'dev_err'
     808 |                 dev_err(tas_fmw->dev,
         |                 ^~~~~~~
   sound/soc/codecs/tas2781-dsp.c:809:42: note: format string is defined here
     809 |                         "%s: File Size(%lu) error offset = %d n = %d\n",
         |                                        ~~^
         |                                          |
         |                                          long unsigned int
         |                                        %u
   sound/soc/codecs/tas2781-dsp.c: In function 'fw_parse_header':
>> sound/soc/codecs/tas2781-dsp.c:1199:39: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
    1199 |                 dev_err(tas_dev->dev, "File size not match, %ld %u", fmw->size,
         |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ^~~
   include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
     144 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   sound/soc/codecs/tas2781-dsp.c:1199:17: note: in expansion of macro 'dev_err'
    1199 |                 dev_err(tas_dev->dev, "File size not match, %ld %u", fmw->size,
         |                 ^~~~~~~
   sound/soc/codecs/tas2781-dsp.c:1199:63: note: format string is defined here
    1199 |                 dev_err(tas_dev->dev, "File size not match, %ld %u", fmw->size,
         |                                                             ~~^
         |                                                               |
         |                                                               long int
         |                                                             %d
   sound/soc/codecs/tas2781-dsp.c: In function 'tas2781_load_calibration':
   sound/soc/codecs/tas2781-dsp.c:1819:33: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
    1819 |                                 "%s: file read error: size = %ld\n",
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ^~~
   include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
     144 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   sound/soc/codecs/tas2781-dsp.c:1818:25: note: in expansion of macro 'dev_err'
    1818 |                         dev_err(tas_dev->dev,
         |                         ^~~~~~~
   sound/soc/codecs/tas2781-dsp.c:1819:64: note: format string is defined here
    1819 |                                 "%s: file read error: size = %ld\n",
         |                                                              ~~^
         |                                                                |
         |                                                                long int
         |                                                              %d

vim +809 sound/soc/codecs/tas2781-dsp.c

740
741 static int fw_parse_block_data(struct tasdevice_fw *tas_fmw,
742 struct tasdevice_block *block, const struct firmware *fmw, int offset)
743 {
744 unsigned char *data = (unsigned char *)fmw->data;
745 int n;
746
747 if (offset + 4 > fmw->size) {
748 dev_err(tas_fmw->dev, "%s: mnType error\n", __func__);
749 offset = -1;
750 goto out;
751 }
752 block->type = SMS_HTONL(data[offset], data[offset + 1],
753 data[offset + 2], data[offset + 3]);
754 offset += 4;
755
756 if (tas_fmw->fw_hdr.fixed_hdr.drv_ver >=
757 PPC_DRIVER_CRCCHK) {
758 if (offset + 1 > fmw->size) {
759 dev_err(tas_fmw->dev, "%s: mbPChkSumPresent error\n",
760 __func__);
761 offset = -1;
762 goto out;
763 }
764 block->is_pchksum_present = data[offset];
765 offset++;
766
767 if (offset + 1 > fmw->size) {
768 dev_err(tas_fmw->dev, "%s: mnPChkSum error\n",
769 __func__);
770 offset = -1;
771 goto out;
772 }
773 block->pchksum = data[offset];
774 offset++;
775
776 if (offset + 1 > fmw->size) {
777 dev_err(tas_fmw->dev, "%s: mbYChkSumPresent error\n",
778 __func__);
779 offset = -1;
780 goto out;
781 }
782 block->is_ychksum_present = data[offset];
783 offset++;
784
785 if (offset + 1 > fmw->size) {
786 dev_err(tas_fmw->dev, "%s: mnYChkSum error\n",
787 __func__);
788 offset = -1;
789 goto out;
790 }
791 block->ychksum = data[offset];
792 offset++;
793 } else {
794 block->is_pchksum_present = 0;
795 block->is_ychksum_present = 0;
796 }
797 if (offset + 4 > fmw->size) {
798 dev_err(tas_fmw->dev, "%s: mnCommands error\n", __func__);
799 offset = -1;
800 goto out;
801 }
802 block->n_cmds = SMS_HTONL(data[offset], data[offset + 1],
803 data[offset + 2], data[offset + 3]);
804 offset += 4;
805
806 n = block->n_cmds * 4;
807 if (offset + n > fmw->size) {
808 dev_err(tas_fmw->dev,

 > 809				"%s: File Size(%lu) error offset = %d n = %d\n",

810 __func__, fmw->size, offset, n);
811 offset = -1;
812 goto out;
813 }
814 block->data = kmemdup(&data[offset], n, GFP_KERNEL);
815 if (block->data == NULL) {
816 offset = -1;
817 goto out;
818 }
819 offset += n;
820 out:
821 return offset;
822 }
823

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#3 lore raw
In reply to Shenghao Ding
Thank you for the patch! Perhaps something to improve:

Hi Shenghao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on linus/master v6.2-rc6 next-20230131] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shenghao-Ding/ASoC-tas2781-Add-tas2781-driver/20230131-212221
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20230131131701.7097-1-13916275206%40139.com
patch subject: [PATCH v2] ASoC: tas2781: Add tas2781 driver.
config: m68k-randconfig-m031-20230129 (https://download.01.org/0day-ci/archive/20230201/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>

New smatch warnings:
sound/soc/codecs/tas2781-i2c.c:220 tasdevice_process_block() warn: inconsistent indenting sound/soc/codecs/tas2781-i2c.c:471 tas2781_digital_putvol() warn: unsigned 'val' is never less than zero. sound/soc/codecs/tas2781-i2c.c:544 tas2781_amp_putvol() warn: unsigned 'val' is never less than zero. sound/soc/codecs/tas2781-i2c.c:841 tasdevice_rca_ready() error: we previously assumed 'tas_dev' could be null (see line 840) sound/soc/codecs/tas2781-i2c.c:1095 tasdevice_dapm_event() error: uninitialized symbol 'pwr_state'. sound/soc/codecs/tas2781-i2c.c:1818 tasdevice_pm_suspend() error: we previously assumed 'tas_dev' could be null (see line 1817) sound/soc/codecs/tas2781-dsp.c:1670 tasdevice_load_block() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:732 tas2781_clear_calfirmware() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:2038 tasdevice_dsp_remove() warn: inconsistent indenting

Old smatch warnings:
sound/soc/codecs/tas2781-dsp.c:1688 tasdevice_load_block() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:2042 tasdevice_dsp_remove() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:2069 tasdevice_dsp_remove() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:2073 tasdevice_dsp_remove() warn: inconsistent indenting

vim +220 sound/soc/codecs/tas2781-i2c.c

94
95 int tasdevice_process_block(void *context,
96 unsigned char *data, unsigned char dev_idx, int sublocksize)
97 {
98 struct tasdevice_priv *tas_dev =
99 (struct tasdevice_priv *)context;
100 unsigned char subblk_typ = data[1];
101 int subblk_offset = 2;
102 int chn = 0, chnend = 0;
103 int rc = 0;
104 int blktyp = dev_idx & 0xC0, idx = dev_idx & 0x3F;
105 bool is_err = false;
106
107 if (idx) {
108 chn = idx-1;
109 chnend = idx;
110 } else {
111 if (tas_dev->set_global_mode) {
112 chn = tas_dev->ndev;
113 chnend = tas_dev->ndev + 1;
114 } else {
115 chn = 0;
116 chnend = tas_dev->ndev;
117 }
118 }
119
120 for (; chn < chnend; chn++) {
121 if (tas_dev->set_global_mode == NULL &&
122 tas_dev->tasdevice[chn].is_loading == false)
123 continue;
124
125 is_err = false;
126 subblk_offset = 2;
127 switch (subblk_typ) {
128 case TASDEVICE_CMD_SING_W: {
129 int i = 0;
130 unsigned short len = SMS_HTONS(data[2], data[3]);
131
132 subblk_offset += 2;
133 if (subblk_offset + 4 * len > sublocksize) {
134 dev_err(tas_dev->dev,
135 "process_block: Out of memory\n");
136 is_err = true;
137 break;
138 }
139
140 for (i = 0; i < len; i++) {
141 rc = tasdevice_dev_write(tas_dev, chn,
142 TASDEVICE_REG(data[subblk_offset],
143 data[subblk_offset + 1],
144 data[subblk_offset + 2]),
145 data[subblk_offset + 3]);
146 if (rc < 0) {
147 is_err = true;
148 dev_err(tas_dev->dev,
149 "process_block: single write error\n");
150 }
151 subblk_offset += 4;
152 }
153 }
154 break;
155 case TASDEVICE_CMD_BURST: {
156 unsigned short len = SMS_HTONS(data[2], data[3]);
157
158 subblk_offset += 2;
159 if (subblk_offset + 4 + len > sublocksize) {
160 dev_err(tas_dev->dev,
161 "process_block: BURST Out of memory\n");
162 is_err = true;
163 break;
164 }
165 if (len % 4) {
166 dev_err(tas_dev->dev,
167 "%s: Burst len(%u) can be div by 4\n",
168 __func__, len);
169 break;
170 }
171
172 rc = tasdevice_dev_bulk_write(tas_dev, chn,
173 TASDEVICE_REG(data[subblk_offset],
174 data[subblk_offset + 1],
175 data[subblk_offset + 2]),
176 &(data[subblk_offset + 4]), len);
177 if (rc < 0) {
178 is_err = true;
179 dev_err(tas_dev->dev,
180 "%s: bulk_write error = %d\n",
181 __func__, rc);
182 }
183 subblk_offset += (len + 4);
184 }
185 break;
186 case TASDEVICE_CMD_DELAY: {
187 unsigned short delay_time = 0;
188
189 if (subblk_offset + 2 > sublocksize) {
190 dev_err(tas_dev->dev,
191 "%s: deley Out of memory\n",
192 __func__);
193 is_err = true;
194 break;
195 }
196 delay_time = SMS_HTONS(data[2], data[3]);
197 usleep_range(delay_time*1000, delay_time*1000);
198 subblk_offset += 2;
199 }
200 break;
201 case TASDEVICE_CMD_FIELD_W:
202 if (subblk_offset + 6 > sublocksize) {
203 dev_err(tas_dev->dev,
204 "process_block: bit write Out of memory\n");
205 is_err = true;
206 break;
207 }
208 rc = tasdevice_dev_update_bits(tas_dev, chn,
209 TASDEVICE_REG(data[subblk_offset + 2],
210 data[subblk_offset + 3],
211 data[subblk_offset + 4]),
212 data[subblk_offset + 1],
213 data[subblk_offset + 5]);
214 if (rc < 0) {
215 is_err = true;
216 dev_err(tas_dev->dev,
217 "process_block: update_bits error = %d\n", rc);
218 }
219 subblk_offset += 6;

 > 220				break;

221 default:
222 break;
223 };
224 if (is_err == true && blktyp != 0) {
225 if (blktyp == 0x80) {
226 tas_dev->tasdevice[chn].cur_prog = -1;
227 tas_dev->tasdevice[chn].cur_conf = -1;
228 } else
229 tas_dev->tasdevice[chn].cur_conf = -1;
230 }
231 }
232 return subblk_offset;
233 }
234

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests