Re: [PATCH 1/6] iio: ad7949: Support internal Vref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I read your patch series and it seems really good. Thank you for the improvements. :)
But I have one comment about it there:

Le 01/05/2019 à 23:16, Adam Michaelis a écrit :
@@ -223,10 +247,18 @@ static int ad7949_spi_init(struct ad7949_adc_chip *ad7949_adc)
  {
  	int ret;
  	int val;
+	u16 adc_config = 0;
- /* Sequencer disabled, CFG readback disabled, IN0 as default channel */
  	ad7949_adc->current_channel = 0;
-	ret = ad7949_spi_write_cfg(ad7949_adc, 0x3C79, AD7949_MASK_TOTAL);
+	ad7949_adc->cfg = 0;
+
+	adc_config = (0x3c << 8);
+	adc_config |= ((ad7949_adc->current_channel & 0x07) << 7);
+	adc_config |= (1 << 6);
+	adc_config |= (ad7949_adc->ref_sel << 3);
+	adc_config |= 1;
+
+	ret = ad7949_spi_write_cfg(ad7949_adc, adc_config, AD7949_MASK_TOTAL);

That should be great to replace some _magic constants_ by a more explicit name, shouldn't it? Especially (0x3c << 8) and (1 << 6 parts).

Regards,

Charles-Antoine Couret




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux