lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0436f74-4396-90e3-76fb-9b00abe4e925@amd.com>
Date:   Mon, 18 Nov 2019 14:28:07 +0530
From:   vishnu <vravulap@....com>
To:     Julia Lawall <julia.lawall@...6.fr>,
        Ravulapati Vishnu vardhan rao 
        <Vishnuvardhanrao.Ravulapati@....com>
Cc:     Alexander.Deucher@....com, djkurtz@...gle.com,
        Akshu.Agrawal@....com, Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>,
        Vijendar Mukunda <Vijendar.Mukunda@....com>,
        Maruthi Bayyavarapu <maruthi.bayyavarapu@....com>,
        Colin Ian King <colin.king@...onical.com>,
        YueHaibing <yuehaibing@...wei.com>,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
        Sanju R Mehta <sanju.mehta@....com>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." 
        <alsa-devel@...a-project.org>,
        open list <linux-kernel@...r.kernel.org>,
        kbuild-all@...ts.01.org
Subject: Re: [RESEND PATCH v5 6/6] ASoC: amd: Added ACP3x system resume and
 runtime pm (fwd)



On 17/11/19 4:40 PM, Julia Lawall wrote:
> Line 179 needs to cleanup everything that needed to be cleaned up in the
> previous error handling code (line 173) as well as adding an iounmap.  But
> maybe you could have used a devm function to avoid the need for the
> iounmap.
> 
> Also functions should have blank lines between them.  That is why this
> report contains lots of function definitions, and not just the one with
> the problem.
> 
> julia


Hi Julia,

This is not latest version.I have already send V6 version.
The comment which you gave is for v5 old version.


Thanks,
Vishnu

> ---------- Forwarded message ----------
> Date: Sun, 17 Nov 2019 13:55:47 +0800
> From: kbuild test robot <lkp@...el.com>
> To: kbuild@...ts.01.org
> Cc: Julia Lawall <julia.lawall@...6.fr>
> Subject: Re: [RESEND PATCH v5 6/6] ASoC: amd: Added ACP3x system resume and
>      runtime pm
> 
> CC: kbuild-all@...ts.01.org
> In-Reply-To: <1573629249-13272-7-git-send-email-Vishnuvardhanrao.Ravulapati@....com>
> References: <1573629249-13272-7-git-send-email-Vishnuvardhanrao.Ravulapati@....com>
> CC:
> 
> Hi Ravulapati,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on asoc/for-next]
> [cannot apply to v5.4-rc7 next-20191115]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Ravulapati-Vishnu-vardhan-rao/ASoC-amd-Create-multiple-I2S-platform-device-Endpoint/20191113-230604
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
> :::::: branch date: 4 days ago
> :::::: commit date: 4 days ago
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@...el.com>
> Reported-by: Julia Lawall <julia.lawall@...6.fr>
> 
>>> sound/soc/amd/raven/pci-acp3x.c:179:2-8: ERROR: missing iounmap; ioremap on line 170 and execution via conditional on line 178
> 
> # https://github.com/0day-ci/linux/commit/bfd341330019202bd0a17caa808937c88d536e58
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout bfd341330019202bd0a17caa808937c88d536e58
> vim +179 sound/soc/amd/raven/pci-acp3x.c
> 
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12   24
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   25  static int acp3x_power_on(void __iomem *acp3x_base)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   26  {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   27  	u32 val;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   28  	u32 timeout = 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   29  	int ret = 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   30
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   31  	val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   32
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   33  	if (val == 0)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   34  		return val;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   35
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   36  	if (!((val & ACP_PGFSM_STATUS_MASK) ==
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   37  				ACP_POWER_ON_IN_PROGRESS))
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   38  		rv_writel(ACP_PGFSM_CNTL_POWER_ON_MASK,
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   39  			acp3x_base + mmACP_PGFSM_CONTROL);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   40  	while (++timeout < DELAY) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   41  		val  = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   42  		if (!val)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   43  			break;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   44  		udelay(1);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   45  		if (timeout > 500) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   46  			pr_err("ACP is Not Powered ON\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   47  			return -ETIMEDOUT;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   48  		}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   49  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   50  }
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   51  static int acp3x_power_off(void __iomem *acp3x_base)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   52  {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   53  	u32 val;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   54  	u32 timeout = 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   55
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   56  	rv_writel(ACP_PGFSM_CNTL_POWER_OFF_MASK,
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   57  			acp3x_base + mmACP_PGFSM_CONTROL);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   58  	while (++timeout < DELAY) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   59  		val  = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   60  		if ((val & ACP_PGFSM_STATUS_MASK) == ACP_POWERED_OFF)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   61  			return 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   62  		udelay(1);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   63  		if (timeout > 500) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   64  			pr_err("ACP is Not Powered OFF\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   65  			return -ETIMEDOUT;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   66  		}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   67  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   68  }
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   69  static int acp3x_reset(void __iomem *acp3x_base)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   70  {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   71  	u32 val, timeout;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   72
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   73  	rv_writel(1, acp3x_base + mmACP_SOFT_RESET);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   74  	timeout = 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   75  	while (++timeout < DELAY) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   76  		val = rv_readl(acp3x_base + mmACP_SOFT_RESET);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   77  		if ((val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK) ||
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   78  							timeout > 100) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   79  			if (val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   80  				break;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   81  			return -ENODEV;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   82  		}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   83  		cpu_relax();
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   84  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   85  	rv_writel(0, acp3x_base + mmACP_SOFT_RESET);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   86  	timeout = 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   87  	while (++timeout < DELAY) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   88  		val = rv_readl(acp3x_base + mmACP_SOFT_RESET);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   89  		if (!val)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   90  			break;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   91  		if (timeout > 100)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   92  			return -ENODEV;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   93  		cpu_relax();
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   94  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   95  	return 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   96  }
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   97  static int acp3x_init(void __iomem *acp3x_base)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   98  {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13   99  	int ret;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  100
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  101  	/* power on */
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  102  	ret = acp3x_power_on(acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  103  	if (ret) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  104  		pr_err("ACP3x power on failed\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  105  		return ret;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  106  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  107  	/* Reset */
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  108  	ret = acp3x_reset(acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  109  	if (ret) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  110  		pr_err("ACP3x reset failed\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  111  		return ret;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  112  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  113  	return 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  114  }
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  115  static int acp3x_deinit(void __iomem *acp3x_base)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  116  {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  117  	int ret;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  118
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  119  	/* Reset */
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  120  	ret = acp3x_reset(acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  121  	if (ret) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  122  		pr_err("ACP3x reset failed\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  123  		return ret;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  124  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  125  	/* power off */
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  126  	ret = acp3x_power_off(acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  127  	if (ret) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  128  		pr_err("ACP3x power off failed\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  129  		return ret;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  130  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  131  	return 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  132  }
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  133  static int snd_acp3x_probe(struct pci_dev *pci,
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  134  			   const struct pci_device_id *pci_id)
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  135  {
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  136  	int ret;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  137  	u32 addr, val, i;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  138  	struct acp3x_dev_data *adata;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  139  	struct platform_device_info pdevinfo[ACP3x_DEVS];
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  140  	unsigned int irqflags;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  141
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  142  	if (pci_enable_device(pci)) {
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  143  		dev_err(&pci->dev, "pci_enable_device failed\n");
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  144  		return -ENODEV;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  145  	}
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  146
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  147  	ret = pci_request_regions(pci, "AMD ACP3x audio");
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  148  	if (ret < 0) {
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  149  		dev_err(&pci->dev, "pci_request_regions failed\n");
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  150  		goto disable_pci;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  151  	}
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  152
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  153  	adata = devm_kzalloc(&pci->dev, sizeof(struct acp3x_dev_data),
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  154  			     GFP_KERNEL);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  155  	if (!adata) {
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  156  		ret = -ENOMEM;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  157  		goto release_regions;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  158  	}
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  159
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  160  	/* check for msi interrupt support */
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  161  	ret = pci_enable_msi(pci);
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  162  	if (ret)
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  163  		/* msi is not enabled */
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  164  		irqflags = IRQF_SHARED;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  165  	else
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  166  		/* msi is enabled */
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  167  		irqflags = 0;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  168
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  169  	addr = pci_resource_start(pci, 0);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12 @170  	adata->acp3x_base = ioremap(addr, pci_resource_len(pci, 0));
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  171  	if (!adata->acp3x_base) {
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  172  		ret = -ENOMEM;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  173  		goto release_regions;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  174  	}
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  175  	pci_set_master(pci);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  176  	pci_set_drvdata(pci, adata);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  177  	ret = acp3x_init(adata->acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13 @178  	if (ret)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13 @179  		return -ENODEV;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  180
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  181
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  182  	val = rv_readl(adata->acp3x_base + mmACP_I2S_PIN_CONFIG);
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  183  	switch (val) {
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  184  	case I2S_MODE:
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  185  		adata->res = devm_kzalloc(&pci->dev,
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  186  					  sizeof(struct resource) * 4,
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  187  					  GFP_KERNEL);
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  188  		if (!adata->res) {
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  189  			ret = -ENOMEM;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  190  			goto unmap_mmio;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  191  		}
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  192
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  193  		adata->res[0].name = "acp3x_i2s_iomem";
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  194  		adata->res[0].flags = IORESOURCE_MEM;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  195  		adata->res[0].start = addr;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  196  		adata->res[0].end = addr + (ACP3x_REG_END - ACP3x_REG_START);
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  197
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  198  		adata->res[1].name = "acp3x_i2s_sp";
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  199  		adata->res[1].flags = IORESOURCE_MEM;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  200  		adata->res[1].start = addr + ACP3x_I2STDM_REG_START;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  201  		adata->res[1].end = addr + ACP3x_I2STDM_REG_END;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  202
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  203  		adata->res[2].name = "acp3x_i2s_bt";
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  204  		adata->res[2].flags = IORESOURCE_MEM;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  205  		adata->res[2].start = addr + ACP3x_BT_TDM_REG_START;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  206  		adata->res[2].end = addr + ACP3x_BT_TDM_REG_END;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  207
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  208  		adata->res[3].name = "acp3x_i2s_irq";
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  209  		adata->res[3].flags = IORESOURCE_IRQ;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  210  		adata->res[3].start = pci->irq;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  211  		adata->res[3].end = adata->res[3].start;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  212
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  213  		adata->acp3x_audio_mode = ACP3x_I2S_MODE;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  214
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  215  		memset(&pdevinfo, 0, sizeof(pdevinfo));
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  216  		pdevinfo[0].name = "acp3x_rv_i2s_dma";
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  217  		pdevinfo[0].id = 0;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  218  		pdevinfo[0].parent = &pci->dev;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  219  		pdevinfo[0].num_res = 4;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  220  		pdevinfo[0].res = &adata->res[0];
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  221  		pdevinfo[0].data = &irqflags;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  222  		pdevinfo[0].size_data = sizeof(irqflags);
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  223
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  224  		pdevinfo[1].name = "acp3x_i2s_playcap";
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  225  		pdevinfo[1].id = 0;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  226  		pdevinfo[1].parent = &pci->dev;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  227  		pdevinfo[1].num_res = 1;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  228  		pdevinfo[1].res = &adata->res[1];
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  229
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  230  		pdevinfo[2].name = "acp3x_i2s_playcap";
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  231  		pdevinfo[2].id = 1;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  232  		pdevinfo[2].parent = &pci->dev;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  233  		pdevinfo[2].num_res = 1;
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  234  		pdevinfo[2].res = &adata->res[2];
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  235  		for (i = 0; i < ACP3x_DEVS ; i++) {
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  236  			adata->pdev[i] =
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  237  				platform_device_register_full(&pdevinfo[i]);
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  238  			if (IS_ERR(adata->pdev[i])) {
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  239  				dev_err(&pci->dev, "cannot register %s device\n",
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  240  					pdevinfo[i].name);
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  241  				ret = PTR_ERR(adata->pdev[i]);
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  242  				goto unmap_mmio;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  243  			}
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  244  		}
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  245  		break;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  246  	default:
> 00347e4ea8ca4c Colin Ian King                2018-11-16  247  		dev_err(&pci->dev, "Invalid ACP audio mode : %d\n", val);
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  248  		ret = -ENODEV;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  249  		goto unmap_mmio;
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  250  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  251  	pm_runtime_set_autosuspend_delay(&pci->dev, 10000);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  252  	pm_runtime_use_autosuspend(&pci->dev);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  253  	pm_runtime_set_active(&pci->dev);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  254  	pm_runtime_put_noidle(&pci->dev);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  255  	pm_runtime_enable(&pci->dev);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  256  	return 0;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  257
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  258  unmap_mmio:
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  259  	ret = acp3x_deinit(adata->acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  260  	if (ret)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  261  		dev_err(&pci->dev, "ACP de-init failed\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  262  	else
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  263  		dev_info(&pci->dev, "ACP de-initialized\n");
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  264  	pci_disable_msi(pci);
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  265  	for (i = 0 ; i < ACP3x_DEVS ; i++)
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  266  		platform_device_unregister(adata->pdev[i]);
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  267  	kfree(adata->res);
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  268  	iounmap(adata->acp3x_base);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  269  release_regions:
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  270  	pci_release_regions(pci);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  271  disable_pci:
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  272  	pci_disable_device(pci);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  273
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  274  	return ret;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  275  }
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  276  static int  snd_acp3x_suspend(struct device *dev)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  277  {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  278  	int status;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  279  	struct acp3x_dev_data *adata = dev_get_drvdata(dev);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  280
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  281  	status = acp3x_deinit(adata->acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  282  	if (status)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  283  		dev_err(dev, "ACP de-init failed\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  284  	else
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  285  		dev_info(dev, "ACP de-initialized\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  286
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  287  	return 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  288  }
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  289  static int  snd_acp3x_resume(struct device *dev)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  290  {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  291  	int status;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  292  	struct acp3x_dev_data *adata = dev_get_drvdata(dev);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  293
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  294  	status = acp3x_init(adata->acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  295  	if (status) {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  296  		dev_err(dev, "ACP init failed\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  297  		return status;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  298  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  299  	return 0;
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  300  }
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  301  static const struct dev_pm_ops acp3x_pm = {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  302  	.runtime_suspend = snd_acp3x_suspend,
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  303  	.runtime_resume =  snd_acp3x_resume,
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  304  	.resume =       snd_acp3x_resume,
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  305  };
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  306  static void snd_acp3x_remove(struct pci_dev *pci)
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  307  {
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  308  	int i, ret;
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  309  	struct acp3x_dev_data *adata = pci_get_drvdata(pci);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  310
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  311  	if (adata->acp3x_audio_mode == ACP3x_I2S_MODE) {
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  312  		for (i = 0 ; i <  ACP3x_DEVS ; i++)
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  313  			platform_device_unregister(adata->pdev[i]);
> 79701559637a30 Ravulapati Vishnu vardhan rao 2019-11-13  314  	}
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  315  	ret = acp3x_deinit(adata->acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  316  	if (ret)
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  317  		dev_err(&pci->dev, "ACP de-init failed\n");
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  318  	else
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  319  		dev_info(&pci->dev, "ACP de-initialized\n");
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  320  	iounmap(adata->acp3x_base);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  321  	pm_runtime_disable(&pci->dev);
> bfd34133001920 Ravulapati Vishnu vardhan rao 2019-11-13  322  	pm_runtime_get_noresume(&pci->dev);
> 7894a7e7ea3de6 Vijendar Mukunda              2018-11-12  323  	pci_disable_msi(pci);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  324  	pci_release_regions(pci);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  325  	pci_disable_device(pci);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  326  }
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  327  static const struct pci_device_id snd_acp3x_ids[] = {
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  328  	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x15e2),
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  329  	.class = PCI_CLASS_MULTIMEDIA_OTHER << 8,
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  330  	.class_mask = 0xffffff },
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  331  	{ 0, },
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  332  };
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  333  MODULE_DEVICE_TABLE(pci, snd_acp3x_ids);
> e30d9128def6ca Maruthi Srinivas Bayyavarapu  2018-11-12  334
> 
> ---
> 0-DAY kernel test infrastructure                 Open Source Technology Center
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ