Lines Matching +full:i2s +full:- +full:rx
1 // SPDX-License-Identifier: GPL-2.0
3 // loongson_i2s_pci.c -- Loongson I2S controller driver
12 #include <linux/dma-mapping.h>
76 const struct fwnode_handle *fwnode = pdev->dev.fwnode; in loongson_i2s_pci_probe()
78 struct device *dev = &pdev->dev; in loongson_i2s_pci_probe()
79 struct loongson_i2s *i2s; in loongson_i2s_pci_probe() local
84 return -ENODEV; in loongson_i2s_pci_probe()
87 i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); in loongson_i2s_pci_probe()
88 if (!i2s) in loongson_i2s_pci_probe()
89 return -ENOMEM; in loongson_i2s_pci_probe()
91 i2s->rev_id = pdev->revision; in loongson_i2s_pci_probe()
92 i2s->dev = dev; in loongson_i2s_pci_probe()
93 pci_set_drvdata(pdev, i2s); in loongson_i2s_pci_probe()
101 i2s->reg_base = pcim_iomap_table(pdev)[0]; in loongson_i2s_pci_probe()
102 i2s->regmap = devm_regmap_init_mmio(dev, i2s->reg_base, in loongson_i2s_pci_probe()
104 if (IS_ERR(i2s->regmap)) in loongson_i2s_pci_probe()
105 return dev_err_probe(dev, PTR_ERR(i2s->regmap), "regmap_init_mmio failed\n"); in loongson_i2s_pci_probe()
107 tx_data = &i2s->tx_dma_data; in loongson_i2s_pci_probe()
108 rx_data = &i2s->rx_dma_data; in loongson_i2s_pci_probe()
110 tx_data->dev_addr = pci_resource_start(pdev, 0) + LS_I2S_TX_DATA; in loongson_i2s_pci_probe()
111 tx_data->order_addr = i2s->reg_base + LS_I2S_TX_ORDER; in loongson_i2s_pci_probe()
113 rx_data->dev_addr = pci_resource_start(pdev, 0) + LS_I2S_RX_DATA; in loongson_i2s_pci_probe()
114 rx_data->order_addr = i2s->reg_base + LS_I2S_RX_ORDER; in loongson_i2s_pci_probe()
116 tx_data->irq = fwnode_irq_get_byname(fwnode, "tx"); in loongson_i2s_pci_probe()
117 if (tx_data->irq < 0) in loongson_i2s_pci_probe()
118 return dev_err_probe(dev, tx_data->irq, "dma tx irq invalid\n"); in loongson_i2s_pci_probe()
120 rx_data->irq = fwnode_irq_get_byname(fwnode, "rx"); in loongson_i2s_pci_probe()
121 if (rx_data->irq < 0) in loongson_i2s_pci_probe()
122 return dev_err_probe(dev, rx_data->irq, "dma rx irq invalid\n"); in loongson_i2s_pci_probe()
124 ret = device_property_read_u32(dev, "clock-frequency", &i2s->clk_rate); in loongson_i2s_pci_probe()
126 return dev_err_probe(dev, ret, "clock-frequency property invalid\n"); in loongson_i2s_pci_probe()
130 if (i2s->rev_id == 1) { in loongson_i2s_pci_probe()
131 regmap_write(i2s->regmap, LS_I2S_CTRL, I2S_CTRL_RESET); in loongson_i2s_pci_probe()
150 .name = "loongson-i2s-pci",
159 MODULE_DESCRIPTION("Loongson I2S Master Mode ASoC Driver");