[PATCH v5 2/3] iio: adc: sophgo-saradc: Add driver for Sophgo CV1800B SARADC

Thomas Bonnefille thomas.bonnefille at bootlin.com
Wed Sep 4 13:38:18 PDT 2024


Hello, thank you for these fixes, I just wanted to add something below.

Le 03/09/2024 à 9:05 PM, Jonathan Cameron a écrit :
> On Mon, 2 Sep 2024 23:36:59 +0300
> Andy Shevchenko <andy.shevchenko at gmail.com> wrote:
> 
>> Thu, Aug 29, 2024 at 02:31:51PM +0200, Thomas Bonnefille kirjoitti:
>>> This adds a driver for the Sophgo CV1800B SARADC.

...

>>> +		init_completion(&saradc->completion);
>>> +		ret = devm_request_irq(&pdev->dev, saradc->irq,
>>> +				       cv1800b_adc_interrupt_handler, 0,
>>> +				       dev_name(&pdev->dev), saradc);
>>> +		if (ret)
>>> +			return ret;
>>> +
>>> +		writel(1, saradc->regs + CV1800B_ADC_INTR_EN_REG);
>>
>> BIT(0)
> 
> Maybe on that - would need to compare with datasheet to know how it's
> described. In theory that might not be a mask.

Indeed, in this case "CV1800B_ADC_INTR_EN_REG" is the register that 
enables the interrupts.
So here what I dis is to set this register to 1 (ON).

> 
>>
>>> +	}
>>> +
>>> +	ret = devm_mutex_init(&pdev->dev, &saradc->lock);
>>> +	if (ret)
>>> +		return ret;
>>
>> + blank line?
> That one I'd done already.
> Anyhow tweaked and pushed out again.
> 
> 
> Jonathan
> 
>>
>>> +	writel(FIELD_PREP(CV1800B_MASK_STARTUP_CYCLE, 15) |
>>> +	       FIELD_PREP(CV1800B_MASK_SAMPLE_WINDOW, 15) |
>>> +	       FIELD_PREP(CV1800B_MASK_CLKDIV, 1) |
>>> +	       FIELD_PREP(CV1800B_MASK_COMPARE_CYCLE, 15),
>>> +	       saradc->regs + CV1800B_ADC_CYC_SET_REG);
>>> +
>>> +	return devm_iio_device_register(&pdev->dev, indio_dev);
>>> +}
>>
> 
Thomas



More information about the linux-riscv mailing list