Lines Matching defs:pcf

40 	struct pcf50633 *pcf;
49 static inline struct pcf50633_adc *__to_adc(struct pcf50633 *pcf)
51 return platform_get_drvdata(pcf->adc_pdev);
54 static void adc_setup(struct pcf50633 *pcf, int channel, int avg)
59 pcf50633_reg_write(pcf, PCF50633_REG_ADCC2, 0x00);
60 pcf50633_reg_write(pcf, PCF50633_REG_ADCC3, 0x01);
63 pcf50633_reg_write(pcf, PCF50633_REG_ADCC1, channel | avg |
67 static void trigger_next_adc_job_if_any(struct pcf50633 *pcf)
69 struct pcf50633_adc *adc = __to_adc(pcf);
77 adc_setup(pcf, adc->queue[head]->mux, adc->queue[head]->avg);
81 adc_enqueue_request(struct pcf50633 *pcf, struct pcf50633_adc_request *req)
83 struct pcf50633_adc *adc = __to_adc(pcf);
93 dev_err(pcf->dev, "ADC queue is full, dropping request\n");
99 trigger_next_adc_job_if_any(pcf);
107 static void pcf50633_adc_sync_read_callback(struct pcf50633 *pcf, void *param,
116 int pcf50633_adc_sync_read(struct pcf50633 *pcf, int mux, int avg)
123 ret = pcf50633_adc_async_read(pcf, mux, avg,
134 int pcf50633_adc_async_read(struct pcf50633 *pcf, int mux, int avg,
151 ret = adc_enqueue_request(pcf, req);
159 static int adc_result(struct pcf50633 *pcf)
164 adcs1 = pcf50633_reg_read(pcf, PCF50633_REG_ADCS1);
165 adcs3 = pcf50633_reg_read(pcf, PCF50633_REG_ADCS3);
168 dev_dbg(pcf->dev, "adc result = %d\n", result);
176 struct pcf50633 *pcf = adc->pcf;
185 dev_err(pcf->dev, "pcf50633-adc irq: ADC queue empty!\n");
193 res = adc_result(pcf);
194 trigger_next_adc_job_if_any(pcf);
198 req->callback(pcf, req->callback_param, res);
210 adc->pcf = dev_to_pcf50633(pdev->dev.parent);
213 pcf50633_register_irq(adc->pcf, PCF50633_IRQ_ADCRDY,
226 pcf50633_free_irq(adc->pcf, PCF50633_IRQ_ADCRDY);
232 dev_err(adc->pcf->dev,