Lines Matching refs:adc
69 struct pcf50633_adc *adc = __to_adc(pcf); in trigger_next_adc_job_if_any() local
72 head = adc->queue_head; in trigger_next_adc_job_if_any()
74 if (!adc->queue[head]) in trigger_next_adc_job_if_any()
77 adc_setup(pcf, adc->queue[head]->mux, adc->queue[head]->avg); in trigger_next_adc_job_if_any()
83 struct pcf50633_adc *adc = __to_adc(pcf); in adc_enqueue_request() local
86 mutex_lock(&adc->queue_mutex); in adc_enqueue_request()
88 head = adc->queue_head; in adc_enqueue_request()
89 tail = adc->queue_tail; in adc_enqueue_request()
91 if (adc->queue[tail]) { in adc_enqueue_request()
92 mutex_unlock(&adc->queue_mutex); in adc_enqueue_request()
97 adc->queue[tail] = req; in adc_enqueue_request()
100 adc->queue_tail = (tail + 1) & (PCF50633_MAX_ADC_FIFO_DEPTH - 1); in adc_enqueue_request()
102 mutex_unlock(&adc->queue_mutex); in adc_enqueue_request()
170 struct pcf50633_adc *adc = data; in pcf50633_adc_irq() local
171 struct pcf50633 *pcf = adc->pcf; in pcf50633_adc_irq()
175 mutex_lock(&adc->queue_mutex); in pcf50633_adc_irq()
176 head = adc->queue_head; in pcf50633_adc_irq()
178 req = adc->queue[head]; in pcf50633_adc_irq()
181 mutex_unlock(&adc->queue_mutex); in pcf50633_adc_irq()
184 adc->queue[head] = NULL; in pcf50633_adc_irq()
185 adc->queue_head = (head + 1) & in pcf50633_adc_irq()
191 mutex_unlock(&adc->queue_mutex); in pcf50633_adc_irq()
199 struct pcf50633_adc *adc; in pcf50633_adc_probe() local
201 adc = devm_kzalloc(&pdev->dev, sizeof(*adc), GFP_KERNEL); in pcf50633_adc_probe()
202 if (!adc) in pcf50633_adc_probe()
205 adc->pcf = dev_to_pcf50633(pdev->dev.parent); in pcf50633_adc_probe()
206 platform_set_drvdata(pdev, adc); in pcf50633_adc_probe()
208 pcf50633_register_irq(adc->pcf, PCF50633_IRQ_ADCRDY, in pcf50633_adc_probe()
209 pcf50633_adc_irq, adc); in pcf50633_adc_probe()
211 mutex_init(&adc->queue_mutex); in pcf50633_adc_probe()
218 struct pcf50633_adc *adc = platform_get_drvdata(pdev); in pcf50633_adc_remove() local
221 pcf50633_free_irq(adc->pcf, PCF50633_IRQ_ADCRDY); in pcf50633_adc_remove()
223 mutex_lock(&adc->queue_mutex); in pcf50633_adc_remove()
224 head = adc->queue_head; in pcf50633_adc_remove()
226 if (WARN_ON(adc->queue[head])) in pcf50633_adc_remove()
227 dev_err(adc->pcf->dev, in pcf50633_adc_remove()
231 kfree(adc->queue[i]); in pcf50633_adc_remove()
233 mutex_unlock(&adc->queue_mutex); in pcf50633_adc_remove()