[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202211042021.3G9mhE3B-lkp@intel.com>
Date: Fri, 4 Nov 2022 20:14:12 +0800
From: kernel test robot <lkp@...el.com>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>, jic23@...nel.org,
robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: oe-kbuild-all@...ts.linux.dev,
Antoniu Miclaus <antoniu.miclaus@...log.com>
Subject: Re: [PATCH 2/4] iio: frequency: adf4377: add support for ADF4377
Hi Antoniu,
I love your patch! Perhaps something to improve:
[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on robh/for-next linus/master v6.1-rc3 next-20221104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Antoniu-Miclaus/dt-bindings-iio-frequency-add-adf4377-doc/20221104-182826
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link: https://lore.kernel.org/r/20221104092802.90725-3-antoniu.miclaus%40analog.com
patch subject: [PATCH 2/4] iio: frequency: adf4377: add support for ADF4377
config: sparc-allyesconfig
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3ededf4b65510d3944acd01c6c88717fd7669561
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Antoniu-Miclaus/dt-bindings-iio-frequency-add-adf4377-doc/20221104-182826
git checkout 3ededf4b65510d3944acd01c6c88717fd7669561
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/iio/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/iio/frequency/adf4377.c:650:5: warning: no previous prototype for 'adf4377_get_freq' [-Wmissing-prototypes]
650 | int adf4377_get_freq(struct adf4377_state *st, u64 *freq)
| ^~~~~~~~~~~~~~~~
>> drivers/iio/frequency/adf4377.c:677:5: warning: no previous prototype for 'adf4377_set_freq' [-Wmissing-prototypes]
677 | int adf4377_set_freq(struct adf4377_state *st, u64 freq)
| ^~~~~~~~~~~~~~~~
vim +/adf4377_get_freq +650 drivers/iio/frequency/adf4377.c
649
> 650 int adf4377_get_freq(struct adf4377_state *st, u64 *freq)
651 {
652 unsigned int ref_div_factor, n_int;
653 u64 clkin_freq;
654 int ret;
655
656 mutex_lock(&st->lock);
657 ret = regmap_read(st->regmap, 0x12, &ref_div_factor);
658 if (ret)
659 goto exit;
660
661 ret = regmap_bulk_read(st->regmap, 0x10, st->buf, sizeof(st->buf));
662 if (ret)
663 goto exit;
664
665 clkin_freq = clk_get_rate(st->clkin);
666 ref_div_factor = FIELD_GET(ADF4377_R_DIV_MSK, ref_div_factor);
667 n_int = FIELD_GET(ADF4377_N_INT_LSB_MSK, st->buf[0]) |
668 (FIELD_GET(ADF4377_N_INT_MSB_MSK, st->buf[1]) << 8);
669
670 *freq = div_u64(clkin_freq, ref_div_factor) * n_int;
671 exit:
672 mutex_unlock(&st->lock);
673
674 return ret;
675 }
676
> 677 int adf4377_set_freq(struct adf4377_state *st, u64 freq)
678 {
679 unsigned int read_val;
680 u64 f_vco;
681 int ret;
682
683 ret = regmap_update_bits(st->regmap, 0x1C, ADF4377_EN_DNCLK_MSK | ADF4377_EN_DRCLK_MSK,
684 FIELD_PREP(ADF4377_EN_DNCLK_MSK, ADF4377_EN_DNCLK_ON) |
685 FIELD_PREP(ADF4377_EN_DRCLK_MSK, ADF4377_EN_DRCLK_ON));
686 if (ret)
687 return ret;
688
689 ret = regmap_update_bits(st->regmap, 0x11, ADF4377_EN_AUTOCAL_MSK | ADF4377_DCLK_DIV2_MSK,
690 FIELD_PREP(ADF4377_EN_AUTOCAL_MSK, ADF4377_VCO_CALIB_EN) |
691 FIELD_PREP(ADF4377_DCLK_DIV2_MSK, st->dclk_div2));
692 if (ret)
693 return ret;
694
695 ret = regmap_update_bits(st->regmap, 0x2E, ADF4377_EN_ADC_CNV_MSK | ADF4377_EN_ADC_MSK |
696 ADF4377_ADC_A_CONV_MSK,
697 FIELD_PREP(ADF4377_EN_ADC_CNV_MSK, ADF4377_EN_ADC_CNV_EN) |
698 FIELD_PREP(ADF4377_EN_ADC_MSK, ADF4377_EN_ADC_EN) |
699 FIELD_PREP(ADF4377_ADC_A_CONV_MSK, ADF4377_ADC_A_CONV_VCO_CALIB));
700 if (ret)
701 return ret;
702
703 ret = regmap_update_bits(st->regmap, 0x20, ADF4377_EN_ADC_CLK_MSK,
704 FIELD_PREP(ADF4377_EN_ADC_CLK_MSK, ADF4377_EN_ADC_CLK_EN));
705 if (ret)
706 return ret;
707
708 ret = regmap_update_bits(st->regmap, 0x2F, ADF4377_DCLK_DIV1_MSK,
709 FIELD_PREP(ADF4377_DCLK_DIV1_MSK, st->dclk_div1));
710 if (ret)
711 return ret;
712
713 ret = regmap_update_bits(st->regmap, 0x24, ADF4377_DCLK_MODE_MSK,
714 FIELD_PREP(ADF4377_DCLK_MODE_MSK, st->dclk_mode));
715 if (ret)
716 return ret;
717
718 ret = regmap_write(st->regmap, 0x27,
719 FIELD_PREP(ADF4377_SYNTH_LOCK_TO_LSB_MSK, st->synth_lock_timeout));
720 if (ret)
721 return ret;
722
723 ret = regmap_update_bits(st->regmap, 0x28, ADF4377_SYNTH_LOCK_TO_MSB_MSK,
724 FIELD_PREP(ADF4377_SYNTH_LOCK_TO_MSB_MSK,
725 st->synth_lock_timeout >> 8));
726 if (ret)
727 return ret;
728
729 ret = regmap_write(st->regmap, 0x29,
730 FIELD_PREP(ADF4377_VCO_ALC_TO_LSB_MSK, st->vco_alc_timeout));
731 if (ret)
732 return ret;
733
734 ret = regmap_update_bits(st->regmap, 0x2A, ADF4377_VCO_ALC_TO_MSB_MSK,
735 FIELD_PREP(ADF4377_VCO_ALC_TO_MSB_MSK, st->vco_alc_timeout >> 8));
736 if (ret)
737 return ret;
738
739 ret = regmap_write(st->regmap, 0x26,
740 FIELD_PREP(ADF4377_VCO_BAND_DIV_MSK, st->vco_band_div));
741 if (ret)
742 return ret;
743
744 ret = regmap_write(st->regmap, 0x2D,
745 FIELD_PREP(ADF4377_ADC_CLK_DIV_MSK, st->adc_clk_div));
746 if (ret)
747 return ret;
748
749 st->clkout_div_sel = 0;
750
751 if (freq > ADF4377_MAX_CLKPN_FREQ || freq < ADF4377_MIN_CLKPN_FREQ) {
752 ret = -EINVAL;
753 return ret;
754 }
755
756 f_vco = freq;
757
758 while (f_vco < ADF4377_MIN_VCO_FREQ) {
759 f_vco <<= 1;
760 st->clkout_div_sel++;
761 }
762
763 st->n_int = div_u64(freq, st->f_pfd);
764
765 ret = regmap_update_bits(st->regmap, 0x11, ADF4377_EN_RDBLR_MSK | ADF4377_N_INT_MSB_MSK,
766 FIELD_PREP(ADF4377_EN_RDBLR_MSK, ADF4377_REF_DBLR_DIS) |
767 FIELD_PREP(ADF4377_N_INT_MSB_MSK, st->n_int >> 8));
768 if (ret)
769 return ret;
770
771 ret = regmap_update_bits(st->regmap, 0x12, ADF4377_R_DIV_MSK | ADF4377_CLKOUT_DIV_MSK,
772 FIELD_PREP(ADF4377_CLKOUT_DIV_MSK, st->clkout_div_sel) |
773 FIELD_PREP(ADF4377_R_DIV_MSK, st->ref_div_factor));
774 if (ret)
775 return ret;
776
777 ret = regmap_write(st->regmap, 0x10,
778 FIELD_PREP(ADF4377_N_INT_LSB_MSK, st->n_int));
779 if (ret)
780 return ret;
781
782 ret = regmap_read_poll_timeout(st->regmap, 0x49, read_val,
783 !(read_val & (ADF4377_FSM_BUSY_MSK)), 200, 200 * 100);
784 if (ret)
785 return ret;
786
787 /* Disable EN_DNCLK, EN_DRCLK */
788 ret = regmap_update_bits(st->regmap, 0x1C, ADF4377_EN_DNCLK_MSK | ADF4377_EN_DRCLK_MSK,
789 FIELD_PREP(ADF4377_EN_DNCLK_MSK, ADF4377_EN_DNCLK_OFF) |
790 FIELD_PREP(ADF4377_EN_DRCLK_MSK, ADF4377_EN_DRCLK_OFF));
791 if (ret)
792 return ret;
793
794 /* Disable EN_ADC_CLK */
795 ret = regmap_update_bits(st->regmap, 0x20, ADF4377_EN_ADC_CLK_MSK,
796 FIELD_PREP(ADF4377_EN_ADC_CLK_MSK, ADF4377_EN_ADC_CLK_DIS));
797 if (ret)
798 return ret;
799
800 /* Set output Amplitude */
801 return regmap_update_bits(st->regmap, 0x19, ADF4377_CLKOUT2_OP_MSK | ADF4377_CLKOUT1_OP_MSK,
802 FIELD_PREP(ADF4377_CLKOUT1_OP_MSK, ADF4377_CLKOUT_420MV) |
803 FIELD_PREP(ADF4377_CLKOUT2_OP_MSK, ADF4377_CLKOUT_420MV));
804 }
805
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (322336 bytes)
Powered by blists - more mailing lists