Re: [PATCH V2] iio: adc: Add Renesas GyroADC driver

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

 



On 01/09/2017 09:07 PM, Lars-Peter Clausen wrote:
> On 01/09/2017 02:47 PM, Marek Vasut wrote:
>> On 01/09/2017 02:45 PM, Lars-Peter Clausen wrote:
>>> On 01/09/2017 01:03 AM, Marek Vasut wrote:
>>> [...]
>>>> +- renesas,gyroadc-mode:	GyroADC mode of operation, must be either of:
>>>> +			1 - MB88101A mode, 12bit sampling, 4 channels
>>>> +			2 - ADCS7476 mode, 15bit sampling, 8 channels
>>>> +			3 - MAX1162 mode,  16bit sampling, 8 channels
>>>
>>> So is this a ADC, or is this just a specialized SPI controller that
>>> interfaces to an external ADC?
>>
>> It's a special SPI controller, except one cannot access the SPI bus
>> directly. It sends out clock and reads in the data from the ADC .
> 
> OK, thanks for the clarification. The commit message does not mention this
> at the moment and makes it sound like this is a built-in ADC.
> 
> Also the renesas,gyroadc-mode property is more of a driver configuration
> setting rather than a description of the hardware, at least it is not very
> DT-ish.
> 
> I'd go with something like
> 
> 
> 	&adc {
> 		compatible = "renesas,r8a7791-gyroadc";
> 		...
> 
> 		adc@0 {
> 			reg = <0>;
> 			compatible = "maxim,max1162";

But then the max1162 ADC driver* will try to bind to this, right ?
And since the MAX1162 is an SPI device, it will fail to work as the
ADC driver does not provide any sort of SPI interface. Or is that
actually OK ?

* I dunno if that made it mainline yet, but there's a driver for
  compatible ADC, https://patchwork.kernel.org/patch/9472237/

> 			ref-supply = <&vref_max1162>;
> 		};
> 		
> 		... repeat for each front-end ADC.
> 
> 	};
> 
> That's much more idiomatic which makes it e.g. easier to understand for
> someone who does not know the specifics of the binding.
> 
> It also makes it more extensible and portable in terms of the same binding
> for similar devices.
> 
> Internally in the driver you can still use your mode variable initializing
> it based on the compatible string of the subnode.
> 
> - Lars
> 


-- 
Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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