Lines Matching refs:ret
170 #define AD9523_CLK_DIST_DIV_PHASE_REV(x) ((ret >> 18) & 0x3F)
172 #define AD9523_CLK_DIST_DIV_REV(x) (((ret >> 8) & 0x3FF) + 1)
290 int ret; in ad9523_read() local
311 ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); in ad9523_read()
312 if (ret < 0) in ad9523_read()
313 dev_err(&indio_dev->dev, "read failed (%d)", ret); in ad9523_read()
315 ret = be32_to_cpu(st->data[1].d32) & (0xFFFFFF >> in ad9523_read()
318 return ret; in ad9523_read()
325 int ret; in ad9523_write() local
341 ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); in ad9523_write()
343 if (ret < 0) in ad9523_write()
344 dev_err(&indio_dev->dev, "write failed (%d)", ret); in ad9523_write()
346 return ret; in ad9523_write()
358 int ret; in ad9523_vco_out_map() local
363 ret = ad9523_read(indio_dev, AD9523_PLL1_OUTPUT_CHANNEL_CTRL); in ad9523_vco_out_map()
364 if (ret < 0) in ad9523_vco_out_map()
368 ret |= mask; in ad9523_vco_out_map()
371 ret &= ~mask; in ad9523_vco_out_map()
373 ret = ad9523_write(indio_dev, in ad9523_vco_out_map()
374 AD9523_PLL1_OUTPUT_CHANNEL_CTRL, ret); in ad9523_vco_out_map()
377 ret = ad9523_read(indio_dev, AD9523_PLL1_OUTPUT_CTRL); in ad9523_vco_out_map()
378 if (ret < 0) in ad9523_vco_out_map()
382 ret |= mask; in ad9523_vco_out_map()
384 ret &= ~mask; in ad9523_vco_out_map()
385 ret = ad9523_write(indio_dev, AD9523_PLL1_OUTPUT_CTRL, ret); in ad9523_vco_out_map()
388 ret = ad9523_read(indio_dev, AD9523_PLL1_OUTPUT_CHANNEL_CTRL); in ad9523_vco_out_map()
389 if (ret < 0) in ad9523_vco_out_map()
393 ret |= mask; in ad9523_vco_out_map()
395 ret &= ~mask; in ad9523_vco_out_map()
396 ret = ad9523_write(indio_dev, in ad9523_vco_out_map()
397 AD9523_PLL1_OUTPUT_CHANNEL_CTRL, ret); in ad9523_vco_out_map()
405 return ret; in ad9523_vco_out_map()
436 int ret, tmp; in ad9523_store_eeprom() local
438 ret = ad9523_write(indio_dev, AD9523_EEPROM_CTRL1, in ad9523_store_eeprom()
440 if (ret < 0) in ad9523_store_eeprom()
441 return ret; in ad9523_store_eeprom()
442 ret = ad9523_write(indio_dev, AD9523_EEPROM_CTRL2, in ad9523_store_eeprom()
444 if (ret < 0) in ad9523_store_eeprom()
445 return ret; in ad9523_store_eeprom()
450 ret = ad9523_read(indio_dev, in ad9523_store_eeprom()
452 if (ret < 0) in ad9523_store_eeprom()
453 return ret; in ad9523_store_eeprom()
454 } while ((ret & AD9523_EEPROM_DATA_XFER_IN_PROGRESS) && tmp--); in ad9523_store_eeprom()
456 ret = ad9523_write(indio_dev, AD9523_EEPROM_CTRL1, 0); in ad9523_store_eeprom()
457 if (ret < 0) in ad9523_store_eeprom()
458 return ret; in ad9523_store_eeprom()
460 ret = ad9523_read(indio_dev, AD9523_EEPROM_ERROR_READBACK); in ad9523_store_eeprom()
461 if (ret < 0) in ad9523_store_eeprom()
462 return ret; in ad9523_store_eeprom()
464 if (ret & AD9523_EEPROM_ERROR_READBACK_FAIL) { in ad9523_store_eeprom()
466 ret = -EIO; in ad9523_store_eeprom()
469 return ret; in ad9523_store_eeprom()
474 int ret, tmp; in ad9523_sync() local
476 ret = ad9523_read(indio_dev, AD9523_STATUS_SIGNALS); in ad9523_sync()
477 if (ret < 0) in ad9523_sync()
478 return ret; in ad9523_sync()
480 tmp = ret; in ad9523_sync()
483 ret = ad9523_write(indio_dev, AD9523_STATUS_SIGNALS, tmp); in ad9523_sync()
484 if (ret < 0) in ad9523_sync()
485 return ret; in ad9523_sync()
490 ret = ad9523_write(indio_dev, AD9523_STATUS_SIGNALS, tmp); in ad9523_sync()
491 if (ret < 0) in ad9523_sync()
492 return ret; in ad9523_sync()
504 int ret; in ad9523_store() local
506 ret = strtobool(buf, &state); in ad9523_store()
507 if (ret < 0) in ad9523_store()
508 return ret; in ad9523_store()
516 ret = ad9523_sync(indio_dev); in ad9523_store()
519 ret = ad9523_store_eeprom(indio_dev); in ad9523_store()
522 ret = -ENODEV; in ad9523_store()
526 return ret ? ret : len; in ad9523_store()
535 int ret; in ad9523_show() local
538 ret = ad9523_read(indio_dev, AD9523_READBACK_0); in ad9523_show()
539 if (ret >= 0) { in ad9523_show()
540 ret = sprintf(buf, "%d\n", !!(ret & (1 << in ad9523_show()
545 return ret; in ad9523_show()
624 int ret; in ad9523_read_raw() local
627 ret = ad9523_read(indio_dev, AD9523_CHANNEL_CLOCK_DIST(chan->channel)); in ad9523_read_raw()
630 if (ret < 0) in ad9523_read_raw()
631 return ret; in ad9523_read_raw()
635 *val = !(ret & AD9523_CLK_DIST_PWR_DOWN_EN); in ad9523_read_raw()
639 AD9523_CLK_DIST_DIV_REV(ret); in ad9523_read_raw()
642 code = (AD9523_CLK_DIST_DIV_PHASE_REV(ret) * 3141592) / in ad9523_read_raw()
643 AD9523_CLK_DIST_DIV_REV(ret); in ad9523_read_raw()
660 int ret, tmp, code; in ad9523_write_raw() local
663 ret = ad9523_read(indio_dev, AD9523_CHANNEL_CLOCK_DIST(chan->channel)); in ad9523_write_raw()
664 if (ret < 0) in ad9523_write_raw()
667 reg = ret; in ad9523_write_raw()
678 ret = -EINVAL; in ad9523_write_raw()
681 ret = ad9523_set_clock_provider(indio_dev, chan->channel, val); in ad9523_write_raw()
682 if (ret < 0) in ad9523_write_raw()
691 tmp = (code * AD9523_CLK_DIST_DIV_REV(ret)) / 3141592; in ad9523_write_raw()
697 ret = -EINVAL; in ad9523_write_raw()
701 ret = ad9523_write(indio_dev, AD9523_CHANNEL_CLOCK_DIST(chan->channel), in ad9523_write_raw()
703 if (ret < 0) in ad9523_write_raw()
709 return ret; in ad9523_write_raw()
716 int ret; in ad9523_reg_access() local
720 ret = ad9523_write(indio_dev, reg | AD9523_R1B, writeval); in ad9523_reg_access()
723 ret = ad9523_read(indio_dev, reg | AD9523_R1B); in ad9523_reg_access()
724 if (ret < 0) in ad9523_reg_access()
726 *readval = ret; in ad9523_reg_access()
727 ret = 0; in ad9523_reg_access()
733 return ret; in ad9523_reg_access()
750 int ret, i; in ad9523_setup() local
752 ret = ad9523_write(indio_dev, AD9523_SERIAL_PORT_CONFIG, in ad9523_setup()
756 if (ret < 0) in ad9523_setup()
757 return ret; in ad9523_setup()
759 ret = ad9523_write(indio_dev, AD9523_READBACK_CTRL, in ad9523_setup()
761 if (ret < 0) in ad9523_setup()
762 return ret; in ad9523_setup()
764 ret = ad9523_io_update(indio_dev); in ad9523_setup()
765 if (ret < 0) in ad9523_setup()
766 return ret; in ad9523_setup()
771 ret = ad9523_write(indio_dev, AD9523_PLL1_REF_A_DIVIDER, in ad9523_setup()
773 if (ret < 0) in ad9523_setup()
774 return ret; in ad9523_setup()
776 ret = ad9523_write(indio_dev, AD9523_PLL1_REF_B_DIVIDER, in ad9523_setup()
778 if (ret < 0) in ad9523_setup()
779 return ret; in ad9523_setup()
781 ret = ad9523_write(indio_dev, AD9523_PLL1_FEEDBACK_DIVIDER, in ad9523_setup()
783 if (ret < 0) in ad9523_setup()
784 return ret; in ad9523_setup()
786 ret = ad9523_write(indio_dev, AD9523_PLL1_CHARGE_PUMP_CTRL, in ad9523_setup()
791 if (ret < 0) in ad9523_setup()
792 return ret; in ad9523_setup()
794 ret = ad9523_write(indio_dev, AD9523_PLL1_INPUT_RECEIVERS_CTRL, in ad9523_setup()
802 if (ret < 0) in ad9523_setup()
803 return ret; in ad9523_setup()
805 ret = ad9523_write(indio_dev, AD9523_PLL1_REF_CTRL, in ad9523_setup()
814 if (ret < 0) in ad9523_setup()
815 return ret; in ad9523_setup()
817 ret = ad9523_write(indio_dev, AD9523_PLL1_MISC_CTRL, in ad9523_setup()
820 if (ret < 0) in ad9523_setup()
821 return ret; in ad9523_setup()
823 ret = ad9523_write(indio_dev, AD9523_PLL1_LOOP_FILTER_CTRL, in ad9523_setup()
825 if (ret < 0) in ad9523_setup()
826 return ret; in ad9523_setup()
831 ret = ad9523_write(indio_dev, AD9523_PLL2_CHARGE_PUMP, in ad9523_setup()
834 if (ret < 0) in ad9523_setup()
835 return ret; in ad9523_setup()
837 ret = ad9523_write(indio_dev, AD9523_PLL2_FEEDBACK_DIVIDER_AB, in ad9523_setup()
840 if (ret < 0) in ad9523_setup()
841 return ret; in ad9523_setup()
843 ret = ad9523_write(indio_dev, AD9523_PLL2_CTRL, in ad9523_setup()
847 if (ret < 0) in ad9523_setup()
848 return ret; in ad9523_setup()
854 ret = ad9523_write(indio_dev, AD9523_PLL2_VCO_CTRL, in ad9523_setup()
856 if (ret < 0) in ad9523_setup()
857 return ret; in ad9523_setup()
859 ret = ad9523_write(indio_dev, AD9523_PLL2_VCO_DIVIDER, in ad9523_setup()
866 if (ret < 0) in ad9523_setup()
867 return ret; in ad9523_setup()
879 ret = ad9523_write(indio_dev, AD9523_PLL2_R2_DIVIDER, in ad9523_setup()
881 if (ret < 0) in ad9523_setup()
882 return ret; in ad9523_setup()
884 ret = ad9523_write(indio_dev, AD9523_PLL2_LOOP_FILTER_CTRL, in ad9523_setup()
890 if (ret < 0) in ad9523_setup()
891 return ret; in ad9523_setup()
897 ret = ad9523_write(indio_dev, in ad9523_setup()
910 if (ret < 0) in ad9523_setup()
911 return ret; in ad9523_setup()
913 ret = ad9523_vco_out_map(indio_dev, chan->channel_num, in ad9523_setup()
915 if (ret < 0) in ad9523_setup()
916 return ret; in ad9523_setup()
937 ret = ad9523_write(indio_dev, AD9523_POWER_DOWN_CTRL, 0); in ad9523_setup()
938 if (ret < 0) in ad9523_setup()
939 return ret; in ad9523_setup()
941 ret = ad9523_write(indio_dev, AD9523_STATUS_SIGNALS, in ad9523_setup()
943 if (ret < 0) in ad9523_setup()
944 return ret; in ad9523_setup()
946 ret = ad9523_io_update(indio_dev); in ad9523_setup()
947 if (ret < 0) in ad9523_setup()
948 return ret; in ad9523_setup()
958 int ret; in ad9523_probe() local
973 ret = regulator_enable(st->reg); in ad9523_probe()
974 if (ret) in ad9523_probe()
975 return ret; in ad9523_probe()
990 ret = ad9523_setup(indio_dev); in ad9523_probe()
991 if (ret < 0) in ad9523_probe()
994 ret = iio_device_register(indio_dev); in ad9523_probe()
995 if (ret) in ad9523_probe()
1006 return ret; in ad9523_probe()