Lines Matching refs:pcf
40 struct pcf50633 *pcf; member
49 static inline struct pcf50633_adc *__to_adc(struct pcf50633 *pcf) in __to_adc() argument
51 return platform_get_drvdata(pcf->adc_pdev); in __to_adc()
54 static void adc_setup(struct pcf50633 *pcf, int channel, int avg) in adc_setup() argument
59 pcf50633_reg_write(pcf, PCF50633_REG_ADCC2, 0x00); in adc_setup()
60 pcf50633_reg_write(pcf, PCF50633_REG_ADCC3, 0x01); in adc_setup()
63 pcf50633_reg_write(pcf, PCF50633_REG_ADCC1, channel | avg | in adc_setup()
67 static void trigger_next_adc_job_if_any(struct pcf50633 *pcf) in trigger_next_adc_job_if_any() argument
69 struct pcf50633_adc *adc = __to_adc(pcf); 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()
81 adc_enqueue_request(struct pcf50633 *pcf, struct pcf50633_adc_request *req) in adc_enqueue_request() argument
83 struct pcf50633_adc *adc = __to_adc(pcf); in adc_enqueue_request()
93 dev_err(pcf->dev, "ADC queue is full, dropping request\n"); in adc_enqueue_request()
99 trigger_next_adc_job_if_any(pcf); in adc_enqueue_request()
107 static void pcf50633_adc_sync_read_callback(struct pcf50633 *pcf, void *param, in pcf50633_adc_sync_read_callback() argument
116 int pcf50633_adc_sync_read(struct pcf50633 *pcf, int mux, int avg) in pcf50633_adc_sync_read() argument
123 ret = pcf50633_adc_async_read(pcf, mux, avg, in pcf50633_adc_sync_read()
134 int pcf50633_adc_async_read(struct pcf50633 *pcf, int mux, int avg, in pcf50633_adc_async_read() argument
150 return adc_enqueue_request(pcf, req); in pcf50633_adc_async_read()
154 static int adc_result(struct pcf50633 *pcf) in adc_result() argument
159 adcs1 = pcf50633_reg_read(pcf, PCF50633_REG_ADCS1); in adc_result()
160 adcs3 = pcf50633_reg_read(pcf, PCF50633_REG_ADCS3); in adc_result()
163 dev_dbg(pcf->dev, "adc result = %d\n", result); in adc_result()
171 struct pcf50633 *pcf = adc->pcf; in pcf50633_adc_irq() local
180 dev_err(pcf->dev, "pcf50633-adc irq: ADC queue empty!\n"); in pcf50633_adc_irq()
188 res = adc_result(pcf); in pcf50633_adc_irq()
189 trigger_next_adc_job_if_any(pcf); in pcf50633_adc_irq()
193 req->callback(pcf, req->callback_param, res); in pcf50633_adc_irq()
205 adc->pcf = dev_to_pcf50633(pdev->dev.parent); in pcf50633_adc_probe()
208 pcf50633_register_irq(adc->pcf, PCF50633_IRQ_ADCRDY, in pcf50633_adc_probe()
221 pcf50633_free_irq(adc->pcf, PCF50633_IRQ_ADCRDY); in pcf50633_adc_remove()
227 dev_err(adc->pcf->dev, in pcf50633_adc_remove()