acp-pci.c (6f47c7ae8c7afaf9ad291d39f0d3974f191a7946) acp-pci.c (fe833e4397fbdc3ae13a60202dfc7c335b032499)
1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
2//
3// This file is provided under a dual BSD/GPLv2 license. When using or
4// redistributing this file, you may do so under either license.
5//
6// Copyright(c) 2022 Advanced Micro Devices, Inc. All rights reserved.
7//
8// Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>

--- 86 unchanged lines hidden (view full) ---

95 chip->name = "acp_asoc_acp70";
96 chip->acp_rev = ACP70_DEV;
97 break;
98 default:
99 dev_err(dev, "Unsupported device revision:0x%x\n", pci->revision);
100 ret = -EINVAL;
101 goto release_regions;
102 }
1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
2//
3// This file is provided under a dual BSD/GPLv2 license. When using or
4// redistributing this file, you may do so under either license.
5//
6// Copyright(c) 2022 Advanced Micro Devices, Inc. All rights reserved.
7//
8// Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>

--- 86 unchanged lines hidden (view full) ---

95 chip->name = "acp_asoc_acp70";
96 chip->acp_rev = ACP70_DEV;
97 break;
98 default:
99 dev_err(dev, "Unsupported device revision:0x%x\n", pci->revision);
100 ret = -EINVAL;
101 goto release_regions;
102 }
103
104 dmic_dev = platform_device_register_data(dev, "dmic-codec", PLATFORM_DEVID_NONE, NULL, 0);
105 if (IS_ERR(dmic_dev)) {
106 dev_err(dev, "failed to create DMIC device\n");
107 ret = PTR_ERR(dmic_dev);
108 goto release_regions;
109 }
110
111 addr = pci_resource_start(pci, 0);
112 chip->base = devm_ioremap(&pci->dev, addr, pci_resource_len(pci, 0));
113 if (!chip->base) {
114 ret = -ENOMEM;
115 goto unregister_dmic_dev;
116 }
117
118 ret = acp_init(chip);
119 if (ret)
120 goto unregister_dmic_dev;
121
103 dmic_dev = platform_device_register_data(dev, "dmic-codec", PLATFORM_DEVID_NONE, NULL, 0);
104 if (IS_ERR(dmic_dev)) {
105 dev_err(dev, "failed to create DMIC device\n");
106 ret = PTR_ERR(dmic_dev);
107 goto release_regions;
108 }
109
110 addr = pci_resource_start(pci, 0);
111 chip->base = devm_ioremap(&pci->dev, addr, pci_resource_len(pci, 0));
112 if (!chip->base) {
113 ret = -ENOMEM;
114 goto unregister_dmic_dev;
115 }
116
117 ret = acp_init(chip);
118 if (ret)
119 goto unregister_dmic_dev;
120
121 check_acp_config(pci, chip);
122 if (!chip->is_pdm_dev && !chip->is_i2s_config)
123 goto skip_pdev_creation;
124
122 res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL);
123 if (!res) {
124 ret = -ENOMEM;
125 goto unregister_dmic_dev;
126 }
127
128 for (i = 0; i < num_res; i++, res_acp++) {
129 res[i].name = res_acp->name;
130 res[i].flags = res_acp->flags;
131 res[i].start = addr + res_acp->start;
132 res[i].end = addr + res_acp->end;
133 if (res_acp->flags == IORESOURCE_IRQ) {
134 res[i].start = pci->irq;
135 res[i].end = res[i].start;
136 }
137 }
138
125 res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL);
126 if (!res) {
127 ret = -ENOMEM;
128 goto unregister_dmic_dev;
129 }
130
131 for (i = 0; i < num_res; i++, res_acp++) {
132 res[i].name = res_acp->name;
133 res[i].flags = res_acp->flags;
134 res[i].start = addr + res_acp->start;
135 res[i].end = addr + res_acp->end;
136 if (res_acp->flags == IORESOURCE_IRQ) {
137 res[i].start = pci->irq;
138 res[i].end = res[i].start;
139 }
140 }
141
139 ret = check_acp_pdm(pci, chip);
140 if (ret < 0)
141 goto skip_pdev_creation;
142
143 chip->flag = flag;
144 memset(&pdevinfo, 0, sizeof(pdevinfo));
145
146 pdevinfo.name = chip->name;
147 pdevinfo.id = 0;
148 pdevinfo.parent = &pci->dev;
149 pdevinfo.num_res = num_res;
150 pdevinfo.res = &res[0];

--- 92 unchanged lines hidden (view full) ---

243 .probe = acp_pci_probe,
244 .remove = acp_pci_remove,
245 .driver = {
246 .pm = &acp_pm_ops,
247 },
248};
249module_pci_driver(snd_amd_acp_pci_driver);
250
142 chip->flag = flag;
143 memset(&pdevinfo, 0, sizeof(pdevinfo));
144
145 pdevinfo.name = chip->name;
146 pdevinfo.id = 0;
147 pdevinfo.parent = &pci->dev;
148 pdevinfo.num_res = num_res;
149 pdevinfo.res = &res[0];

--- 92 unchanged lines hidden (view full) ---

242 .probe = acp_pci_probe,
243 .remove = acp_pci_remove,
244 .driver = {
245 .pm = &acp_pm_ops,
246 },
247};
248module_pci_driver(snd_amd_acp_pci_driver);
249
250MODULE_DESCRIPTION("AMD ACP common PCI support");
251MODULE_LICENSE("Dual BSD/GPL");
252MODULE_IMPORT_NS(SND_SOC_ACP_COMMON);
253MODULE_ALIAS(DRV_NAME);
251MODULE_LICENSE("Dual BSD/GPL");
252MODULE_IMPORT_NS(SND_SOC_ACP_COMMON);
253MODULE_ALIAS(DRV_NAME);