Lines Matching +full:adc +full:- +full:ts +full:- +full:wires

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Freescale MXS Low Resolution Analog-to-Digital Converter driver
16 #include <linux/mfd/mxs-lradc.h>
57 DEFINE_RES_IRQ_NAMED(MX23_LRADC_CH0_IRQ, "mxs-lradc-channel0"),
58 DEFINE_RES_IRQ_NAMED(MX23_LRADC_CH1_IRQ, "mxs-lradc-channel1"),
59 DEFINE_RES_IRQ_NAMED(MX23_LRADC_CH2_IRQ, "mxs-lradc-channel2"),
60 DEFINE_RES_IRQ_NAMED(MX23_LRADC_CH3_IRQ, "mxs-lradc-channel3"),
61 DEFINE_RES_IRQ_NAMED(MX23_LRADC_CH4_IRQ, "mxs-lradc-channel4"),
62 DEFINE_RES_IRQ_NAMED(MX23_LRADC_CH5_IRQ, "mxs-lradc-channel5"),
67 DEFINE_RES_IRQ_NAMED(MX23_LRADC_TS_IRQ, "mxs-lradc-touchscreen"),
68 DEFINE_RES_IRQ_NAMED(MX23_LRADC_CH6_IRQ, "mxs-lradc-channel6"),
69 DEFINE_RES_IRQ_NAMED(MX23_LRADC_CH7_IRQ, "mxs-lradc-channel7"),
74 DEFINE_RES_IRQ_NAMED(MX28_LRADC_TRESH0_IRQ, "mxs-lradc-thresh0"),
75 DEFINE_RES_IRQ_NAMED(MX28_LRADC_TRESH1_IRQ, "mxs-lradc-thresh1"),
76 DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH0_IRQ, "mxs-lradc-channel0"),
77 DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH1_IRQ, "mxs-lradc-channel1"),
78 DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH2_IRQ, "mxs-lradc-channel2"),
79 DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH3_IRQ, "mxs-lradc-channel3"),
80 DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH4_IRQ, "mxs-lradc-channel4"),
81 DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH5_IRQ, "mxs-lradc-channel5"),
82 DEFINE_RES_IRQ_NAMED(MX28_LRADC_BUTTON0_IRQ, "mxs-lradc-button0"),
83 DEFINE_RES_IRQ_NAMED(MX28_LRADC_BUTTON1_IRQ, "mxs-lradc-button1"),
88 DEFINE_RES_IRQ_NAMED(MX28_LRADC_TS_IRQ, "mxs-lradc-touchscreen"),
89 DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH6_IRQ, "mxs-lradc-channel6"),
90 DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH7_IRQ, "mxs-lradc-channel7"),
95 .name = "mxs-lradc-adc",
100 .name = "mxs-lradc-ts",
108 .name = "mxs-lradc-adc",
113 .name = "mxs-lradc-ts",
120 { .compatible = "fsl,imx23-lradc", .data = (void *)IMX23_LRADC, },
121 { .compatible = "fsl,imx28-lradc", .data = (void *)IMX28_LRADC, },
128 struct device *dev = &pdev->dev; in mxs_lradc_probe()
129 struct device_node *node = dev->of_node; in mxs_lradc_probe()
136 lradc = devm_kzalloc(&pdev->dev, sizeof(*lradc), GFP_KERNEL); in mxs_lradc_probe()
138 return -ENOMEM; in mxs_lradc_probe()
140 lradc->soc = (kernel_ulong_t)device_get_match_data(&pdev->dev); in mxs_lradc_probe()
142 lradc->clk = devm_clk_get(&pdev->dev, NULL); in mxs_lradc_probe()
143 if (IS_ERR(lradc->clk)) { in mxs_lradc_probe()
145 return PTR_ERR(lradc->clk); in mxs_lradc_probe()
148 ret = clk_prepare_enable(lradc->clk); in mxs_lradc_probe()
154 ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires", in mxs_lradc_probe()
158 lradc->buffer_vchans = BUFFER_VCHANS_LIMITED; in mxs_lradc_probe()
162 lradc->touchscreen_wire = MXS_LRADC_TOUCHSCREEN_4WIRE; in mxs_lradc_probe()
165 if (lradc->soc == IMX28_LRADC) { in mxs_lradc_probe()
166 lradc->touchscreen_wire = in mxs_lradc_probe()
172 dev_err(&pdev->dev, in mxs_lradc_probe()
173 "Unsupported number of touchscreen wires (%d)\n" in mxs_lradc_probe()
175 ret = -EINVAL; in mxs_lradc_probe()
179 lradc->buffer_vchans = BUFFER_VCHANS_ALL; in mxs_lradc_probe()
186 ret = -ENOMEM; in mxs_lradc_probe()
190 switch (lradc->soc) { in mxs_lradc_probe()
203 ret = -ENODEV; in mxs_lradc_probe()
207 ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, in mxs_lradc_probe()
210 dev_err(&pdev->dev, "Failed to add the ADC subdevice\n"); in mxs_lradc_probe()
214 if (!lradc->touchscreen_wire) in mxs_lradc_probe()
217 ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, in mxs_lradc_probe()
220 dev_err(&pdev->dev, in mxs_lradc_probe()
228 clk_disable_unprepare(lradc->clk); in mxs_lradc_probe()
237 clk_disable_unprepare(lradc->clk); in mxs_lradc_remove()
242 .name = "mxs-lradc",
253 MODULE_ALIAS("platform:mxs-lradc");