• Home
  • Raw
  • Download

Lines Matching refs:info

163 	void (*init_hw)(struct exynos_adc *info);
164 void (*exit_hw)(struct exynos_adc *info);
165 void (*clear_irq)(struct exynos_adc *info);
166 void (*start_conv)(struct exynos_adc *info, unsigned long addr);
169 static void exynos_adc_unprepare_clk(struct exynos_adc *info) in exynos_adc_unprepare_clk() argument
171 if (info->data->needs_sclk) in exynos_adc_unprepare_clk()
172 clk_unprepare(info->sclk); in exynos_adc_unprepare_clk()
173 clk_unprepare(info->clk); in exynos_adc_unprepare_clk()
176 static int exynos_adc_prepare_clk(struct exynos_adc *info) in exynos_adc_prepare_clk() argument
180 ret = clk_prepare(info->clk); in exynos_adc_prepare_clk()
182 dev_err(info->dev, "failed preparing adc clock: %d\n", ret); in exynos_adc_prepare_clk()
186 if (info->data->needs_sclk) { in exynos_adc_prepare_clk()
187 ret = clk_prepare(info->sclk); in exynos_adc_prepare_clk()
189 clk_unprepare(info->clk); in exynos_adc_prepare_clk()
190 dev_err(info->dev, in exynos_adc_prepare_clk()
199 static void exynos_adc_disable_clk(struct exynos_adc *info) in exynos_adc_disable_clk() argument
201 if (info->data->needs_sclk) in exynos_adc_disable_clk()
202 clk_disable(info->sclk); in exynos_adc_disable_clk()
203 clk_disable(info->clk); in exynos_adc_disable_clk()
206 static int exynos_adc_enable_clk(struct exynos_adc *info) in exynos_adc_enable_clk() argument
210 ret = clk_enable(info->clk); in exynos_adc_enable_clk()
212 dev_err(info->dev, "failed enabling adc clock: %d\n", ret); in exynos_adc_enable_clk()
216 if (info->data->needs_sclk) { in exynos_adc_enable_clk()
217 ret = clk_enable(info->sclk); in exynos_adc_enable_clk()
219 clk_disable(info->clk); in exynos_adc_enable_clk()
220 dev_err(info->dev, in exynos_adc_enable_clk()
229 static void exynos_adc_v1_init_hw(struct exynos_adc *info) in exynos_adc_v1_init_hw() argument
233 if (info->data->needs_adc_phy) in exynos_adc_v1_init_hw()
234 regmap_write(info->pmu_map, info->data->phy_offset, 1); in exynos_adc_v1_init_hw()
241 writel(con1, ADC_V1_CON(info->regs)); in exynos_adc_v1_init_hw()
244 writel(info->delay, ADC_V1_DLY(info->regs)); in exynos_adc_v1_init_hw()
247 static void exynos_adc_v1_exit_hw(struct exynos_adc *info) in exynos_adc_v1_exit_hw() argument
251 if (info->data->needs_adc_phy) in exynos_adc_v1_exit_hw()
252 regmap_write(info->pmu_map, info->data->phy_offset, 0); in exynos_adc_v1_exit_hw()
254 con = readl(ADC_V1_CON(info->regs)); in exynos_adc_v1_exit_hw()
256 writel(con, ADC_V1_CON(info->regs)); in exynos_adc_v1_exit_hw()
259 static void exynos_adc_v1_clear_irq(struct exynos_adc *info) in exynos_adc_v1_clear_irq() argument
261 writel(1, ADC_V1_INTCLR(info->regs)); in exynos_adc_v1_clear_irq()
264 static void exynos_adc_v1_start_conv(struct exynos_adc *info, in exynos_adc_v1_start_conv() argument
269 writel(addr, ADC_V1_MUX(info->regs)); in exynos_adc_v1_start_conv()
271 con1 = readl(ADC_V1_CON(info->regs)); in exynos_adc_v1_start_conv()
272 writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); in exynos_adc_v1_start_conv()
310 static void exynos_adc_s3c2416_start_conv(struct exynos_adc *info, in exynos_adc_s3c2416_start_conv() argument
316 con1 = readl(ADC_V1_CON(info->regs)); in exynos_adc_s3c2416_start_conv()
318 writel(con1, ADC_V1_CON(info->regs)); in exynos_adc_s3c2416_start_conv()
321 writel(addr, ADC_S3C2410_MUX(info->regs)); in exynos_adc_s3c2416_start_conv()
323 con1 = readl(ADC_V1_CON(info->regs)); in exynos_adc_s3c2416_start_conv()
324 writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); in exynos_adc_s3c2416_start_conv()
336 static void exynos_adc_s3c2443_start_conv(struct exynos_adc *info, in exynos_adc_s3c2443_start_conv() argument
342 writel(addr, ADC_S3C2410_MUX(info->regs)); in exynos_adc_s3c2443_start_conv()
344 con1 = readl(ADC_V1_CON(info->regs)); in exynos_adc_s3c2443_start_conv()
345 writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); in exynos_adc_s3c2443_start_conv()
357 static void exynos_adc_s3c64xx_start_conv(struct exynos_adc *info, in exynos_adc_s3c64xx_start_conv() argument
362 con1 = readl(ADC_V1_CON(info->regs)); in exynos_adc_s3c64xx_start_conv()
365 writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); in exynos_adc_s3c64xx_start_conv()
387 static void exynos_adc_v2_init_hw(struct exynos_adc *info) in exynos_adc_v2_init_hw() argument
391 if (info->data->needs_adc_phy) in exynos_adc_v2_init_hw()
392 regmap_write(info->pmu_map, info->data->phy_offset, 1); in exynos_adc_v2_init_hw()
395 writel(con1, ADC_V2_CON1(info->regs)); in exynos_adc_v2_init_hw()
399 writel(con2, ADC_V2_CON2(info->regs)); in exynos_adc_v2_init_hw()
402 writel(1, ADC_V2_INT_EN(info->regs)); in exynos_adc_v2_init_hw()
405 static void exynos_adc_v2_exit_hw(struct exynos_adc *info) in exynos_adc_v2_exit_hw() argument
409 if (info->data->needs_adc_phy) in exynos_adc_v2_exit_hw()
410 regmap_write(info->pmu_map, info->data->phy_offset, 0); in exynos_adc_v2_exit_hw()
412 con = readl(ADC_V2_CON1(info->regs)); in exynos_adc_v2_exit_hw()
414 writel(con, ADC_V2_CON1(info->regs)); in exynos_adc_v2_exit_hw()
417 static void exynos_adc_v2_clear_irq(struct exynos_adc *info) in exynos_adc_v2_clear_irq() argument
419 writel(1, ADC_V2_INT_ST(info->regs)); in exynos_adc_v2_clear_irq()
422 static void exynos_adc_v2_start_conv(struct exynos_adc *info, in exynos_adc_v2_start_conv() argument
427 con2 = readl(ADC_V2_CON2(info->regs)); in exynos_adc_v2_start_conv()
430 writel(con2, ADC_V2_CON2(info->regs)); in exynos_adc_v2_start_conv()
432 con1 = readl(ADC_V2_CON1(info->regs)); in exynos_adc_v2_start_conv()
433 writel(con1 | ADC_CON_EN_START, ADC_V2_CON1(info->regs)); in exynos_adc_v2_start_conv()
461 static void exynos_adc_exynos7_init_hw(struct exynos_adc *info) in exynos_adc_exynos7_init_hw() argument
466 writel(con1, ADC_V2_CON1(info->regs)); in exynos_adc_exynos7_init_hw()
468 con2 = readl(ADC_V2_CON2(info->regs)); in exynos_adc_exynos7_init_hw()
471 writel(con2, ADC_V2_CON2(info->regs)); in exynos_adc_exynos7_init_hw()
474 writel(1, ADC_V2_INT_EN(info->regs)); in exynos_adc_exynos7_init_hw()
540 struct exynos_adc *info = iio_priv(indio_dev); in exynos_read_raw() local
545 ret = regulator_get_voltage(info->vdd); in exynos_read_raw()
551 *val2 = info->data->mask; in exynos_read_raw()
558 mutex_lock(&info->lock); in exynos_read_raw()
559 reinit_completion(&info->completion); in exynos_read_raw()
562 if (info->data->start_conv) in exynos_read_raw()
563 info->data->start_conv(info, chan->address); in exynos_read_raw()
565 timeout = wait_for_completion_timeout(&info->completion, in exynos_read_raw()
569 if (info->data->init_hw) in exynos_read_raw()
570 info->data->init_hw(info); in exynos_read_raw()
573 *val = info->value; in exynos_read_raw()
578 mutex_unlock(&info->lock); in exynos_read_raw()
585 struct exynos_adc *info = iio_priv(indio_dev); in exynos_read_s3c64xx_ts() local
589 mutex_lock(&info->lock); in exynos_read_s3c64xx_ts()
590 info->read_ts = true; in exynos_read_s3c64xx_ts()
592 reinit_completion(&info->completion); in exynos_read_s3c64xx_ts()
595 ADC_V1_TSC(info->regs)); in exynos_read_s3c64xx_ts()
598 info->data->start_conv(info, ADC_S3C2410_MUX_TS); in exynos_read_s3c64xx_ts()
600 timeout = wait_for_completion_timeout(&info->completion, in exynos_read_s3c64xx_ts()
604 if (info->data->init_hw) in exynos_read_s3c64xx_ts()
605 info->data->init_hw(info); in exynos_read_s3c64xx_ts()
608 *x = info->ts_x; in exynos_read_s3c64xx_ts()
609 *y = info->ts_y; in exynos_read_s3c64xx_ts()
613 info->read_ts = false; in exynos_read_s3c64xx_ts()
614 mutex_unlock(&info->lock); in exynos_read_s3c64xx_ts()
621 struct exynos_adc *info = dev_id; in exynos_adc_isr() local
622 u32 mask = info->data->mask; in exynos_adc_isr()
625 if (info->read_ts) { in exynos_adc_isr()
626 info->ts_x = readl(ADC_V1_DATX(info->regs)); in exynos_adc_isr()
627 info->ts_y = readl(ADC_V1_DATY(info->regs)); in exynos_adc_isr()
628 writel(ADC_TSC_WAIT4INT | ADC_S3C2443_TSC_UD_SEN, ADC_V1_TSC(info->regs)); in exynos_adc_isr()
630 info->value = readl(ADC_V1_DATX(info->regs)) & mask; in exynos_adc_isr()
634 if (info->data->clear_irq) in exynos_adc_isr()
635 info->data->clear_irq(info); in exynos_adc_isr()
637 complete(&info->completion); in exynos_adc_isr()
651 struct exynos_adc *info = dev_id; in exynos_ts_isr() local
652 struct iio_dev *dev = dev_get_drvdata(info->dev); in exynos_ts_isr()
657 while (READ_ONCE(info->ts_enabled)) { in exynos_ts_isr()
664 input_report_key(info->input, BTN_TOUCH, 0); in exynos_ts_isr()
665 input_sync(info->input); in exynos_ts_isr()
669 input_report_abs(info->input, ABS_X, x & ADC_DATX_MASK); in exynos_ts_isr()
670 input_report_abs(info->input, ABS_Y, y & ADC_DATY_MASK); in exynos_ts_isr()
671 input_report_key(info->input, BTN_TOUCH, 1); in exynos_ts_isr()
672 input_sync(info->input); in exynos_ts_isr()
677 writel(0, ADC_V1_CLRINTPNDNUP(info->regs)); in exynos_ts_isr()
686 struct exynos_adc *info = iio_priv(indio_dev); in exynos_adc_reg_access() local
691 *readval = readl(info->regs + reg); in exynos_adc_reg_access()
735 struct exynos_adc *info = input_get_drvdata(dev); in exynos_adc_ts_open() local
737 WRITE_ONCE(info->ts_enabled, true); in exynos_adc_ts_open()
738 enable_irq(info->tsirq); in exynos_adc_ts_open()
745 struct exynos_adc *info = input_get_drvdata(dev); in exynos_adc_ts_close() local
747 WRITE_ONCE(info->ts_enabled, false); in exynos_adc_ts_close()
748 disable_irq(info->tsirq); in exynos_adc_ts_close()
751 static int exynos_adc_ts_init(struct exynos_adc *info) in exynos_adc_ts_init() argument
755 if (info->tsirq <= 0) in exynos_adc_ts_init()
758 info->input = input_allocate_device(); in exynos_adc_ts_init()
759 if (!info->input) in exynos_adc_ts_init()
762 info->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in exynos_adc_ts_init()
763 info->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); in exynos_adc_ts_init()
765 input_set_abs_params(info->input, ABS_X, 0, 0x3FF, 0, 0); in exynos_adc_ts_init()
766 input_set_abs_params(info->input, ABS_Y, 0, 0x3FF, 0, 0); in exynos_adc_ts_init()
768 info->input->name = "S3C24xx TouchScreen"; in exynos_adc_ts_init()
769 info->input->id.bustype = BUS_HOST; in exynos_adc_ts_init()
770 info->input->open = exynos_adc_ts_open; in exynos_adc_ts_init()
771 info->input->close = exynos_adc_ts_close; in exynos_adc_ts_init()
773 input_set_drvdata(info->input, info); in exynos_adc_ts_init()
775 ret = input_register_device(info->input); in exynos_adc_ts_init()
777 input_free_device(info->input); in exynos_adc_ts_init()
781 ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr, in exynos_adc_ts_init()
783 "touchscreen", info); in exynos_adc_ts_init()
785 input_unregister_device(info->input); in exynos_adc_ts_init()
792 struct exynos_adc *info = NULL; in exynos_adc_probe() local
806 info = iio_priv(indio_dev); in exynos_adc_probe()
808 info->data = exynos_adc_get_data(pdev); in exynos_adc_probe()
809 if (!info->data) { in exynos_adc_probe()
814 info->regs = devm_platform_ioremap_resource(pdev, 0); in exynos_adc_probe()
815 if (IS_ERR(info->regs)) in exynos_adc_probe()
816 return PTR_ERR(info->regs); in exynos_adc_probe()
819 if (info->data->needs_adc_phy) { in exynos_adc_probe()
820 info->pmu_map = syscon_regmap_lookup_by_phandle( in exynos_adc_probe()
823 if (IS_ERR(info->pmu_map)) { in exynos_adc_probe()
825 return PTR_ERR(info->pmu_map); in exynos_adc_probe()
838 info->irq = irq; in exynos_adc_probe()
845 info->tsirq = irq; in exynos_adc_probe()
847 info->tsirq = -1; in exynos_adc_probe()
850 info->dev = &pdev->dev; in exynos_adc_probe()
852 init_completion(&info->completion); in exynos_adc_probe()
854 info->clk = devm_clk_get(&pdev->dev, "adc"); in exynos_adc_probe()
855 if (IS_ERR(info->clk)) { in exynos_adc_probe()
857 PTR_ERR(info->clk)); in exynos_adc_probe()
858 return PTR_ERR(info->clk); in exynos_adc_probe()
861 if (info->data->needs_sclk) { in exynos_adc_probe()
862 info->sclk = devm_clk_get(&pdev->dev, "sclk"); in exynos_adc_probe()
863 if (IS_ERR(info->sclk)) { in exynos_adc_probe()
866 PTR_ERR(info->sclk)); in exynos_adc_probe()
867 return PTR_ERR(info->sclk); in exynos_adc_probe()
871 info->vdd = devm_regulator_get(&pdev->dev, "vdd"); in exynos_adc_probe()
872 if (IS_ERR(info->vdd)) in exynos_adc_probe()
873 return dev_err_probe(&pdev->dev, PTR_ERR(info->vdd), in exynos_adc_probe()
876 ret = regulator_enable(info->vdd); in exynos_adc_probe()
880 ret = exynos_adc_prepare_clk(info); in exynos_adc_probe()
884 ret = exynos_adc_enable_clk(info); in exynos_adc_probe()
891 indio_dev->info = &exynos_adc_iio_info; in exynos_adc_probe()
894 indio_dev->num_channels = info->data->num_channels; in exynos_adc_probe()
896 mutex_init(&info->lock); in exynos_adc_probe()
898 ret = request_irq(info->irq, exynos_adc_isr, in exynos_adc_probe()
899 0, dev_name(&pdev->dev), info); in exynos_adc_probe()
902 info->irq); in exynos_adc_probe()
910 if (info->data->init_hw) in exynos_adc_probe()
911 info->data->init_hw(info); in exynos_adc_probe()
914 info->delay = pdata->delay; in exynos_adc_probe()
916 info->delay = 10000; in exynos_adc_probe()
919 ret = exynos_adc_ts_init(info); in exynos_adc_probe()
935 input_unregister_device(info->input); in exynos_adc_probe()
936 free_irq(info->tsirq, info); in exynos_adc_probe()
941 free_irq(info->irq, info); in exynos_adc_probe()
943 if (info->data->exit_hw) in exynos_adc_probe()
944 info->data->exit_hw(info); in exynos_adc_probe()
945 exynos_adc_disable_clk(info); in exynos_adc_probe()
947 exynos_adc_unprepare_clk(info); in exynos_adc_probe()
949 regulator_disable(info->vdd); in exynos_adc_probe()
956 struct exynos_adc *info = iio_priv(indio_dev); in exynos_adc_remove() local
958 if (IS_REACHABLE(CONFIG_INPUT) && info->input) { in exynos_adc_remove()
959 free_irq(info->tsirq, info); in exynos_adc_remove()
960 input_unregister_device(info->input); in exynos_adc_remove()
965 free_irq(info->irq, info); in exynos_adc_remove()
966 if (info->data->exit_hw) in exynos_adc_remove()
967 info->data->exit_hw(info); in exynos_adc_remove()
968 exynos_adc_disable_clk(info); in exynos_adc_remove()
969 exynos_adc_unprepare_clk(info); in exynos_adc_remove()
970 regulator_disable(info->vdd); in exynos_adc_remove()
978 struct exynos_adc *info = iio_priv(indio_dev); in exynos_adc_suspend() local
980 if (info->data->exit_hw) in exynos_adc_suspend()
981 info->data->exit_hw(info); in exynos_adc_suspend()
982 exynos_adc_disable_clk(info); in exynos_adc_suspend()
983 regulator_disable(info->vdd); in exynos_adc_suspend()
991 struct exynos_adc *info = iio_priv(indio_dev); in exynos_adc_resume() local
994 ret = regulator_enable(info->vdd); in exynos_adc_resume()
998 ret = exynos_adc_enable_clk(info); in exynos_adc_resume()
1002 if (info->data->init_hw) in exynos_adc_resume()
1003 info->data->init_hw(info); in exynos_adc_resume()