All of lore.kernel.org
 help / color / mirror / Atom feed
* How to set Current register in IIO driver from sysfs
@ 2016-07-09 11:52 Pratik Prajapati
  2016-07-10 13:11 ` Pratik Prajapati
  0 siblings, 1 reply; 5+ messages in thread
From: Pratik Prajapati @ 2016-07-09 11:52 UTC (permalink / raw)
  To: linux-iio

Hi,

I am trying to add support of adjusting IR led current in vcnl4000
driver (has IR led current register for doing the same).

Below is what I have done till now:

1) Added Current channel in the vcnl4000_channels structure with
separate mask IIO_CHAN_INFO_RAW
2) Reading the LED current register inside IIO_CURRENT case in vcnl4010_read_raw
3) Writing to LED current register inside IIO_CURRENT case in vcnl4010_write_raw

Is this the correct way of setting Current register in IIO subsystem?

Best Regards,
Pratik Prajapati

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to set Current register in IIO driver from sysfs
  2016-07-09 11:52 How to set Current register in IIO driver from sysfs Pratik Prajapati
@ 2016-07-10 13:11 ` Pratik Prajapati
  2016-07-10 14:39   ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Pratik Prajapati @ 2016-07-10 13:11 UTC (permalink / raw)
  To: linux-iio, jic23, linux-hwmon, linux-kernel

Including more members.

On Sat, Jul 9, 2016 at 5:22 PM, Pratik Prajapati
<pratik.prajapati12@gmail.com> wrote:
> Hi,
>
> I am trying to add support of adjusting IR led current in vcnl4000
> driver (has IR led current register for doing the same).
>
> Below is what I have done till now:
>
> 1) Added Current channel in the vcnl4000_channels structure with
> separate mask IIO_CHAN_INFO_RAW
> 2) Reading the LED current register inside IIO_CURRENT case in vcnl4010_read_raw
> 3) Writing to LED current register inside IIO_CURRENT case in vcnl4010_write_raw
>
> Is this the correct way of setting Current register in IIO subsystem?
>
> Best Regards,
> Pratik Prajapati

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to set Current register in IIO driver from sysfs
  2016-07-10 13:11 ` Pratik Prajapati
@ 2016-07-10 14:39   ` Jonathan Cameron
  2016-07-11  9:10     ` Pratik Prajapati
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2016-07-10 14:39 UTC (permalink / raw)
  To: Pratik Prajapati, linux-iio, linux-hwmon, linux-kernel

On 10/07/16 14:11, Pratik Prajapati wrote:
> Including more members.
> 
> On Sat, Jul 9, 2016 at 5:22 PM, Pratik Prajapati
> <pratik.prajapati12@gmail.com> wrote:
>> Hi,
hi Pratik,
>>
>> I am trying to add support of adjusting IR led current in vcnl4000
>> driver (has IR led current register for doing the same).
This is always a bit of a 'rough' corner when it comes to what interface
to do it with.  Strictly speaking this is typically just a regulator that
happens to be used for this special purpose.  Sometimes they are tightly
tied together with the input and sometime (on devices with more than one)
there is no explicit linkage at all.

In this particular case we seem to actually have a high frequency modulated
LED driver so it's pretty tightly tied to this use.
>>
>> Below is what I have done till now:
>>
>> 1) Added Current channel in the vcnl4000_channels structure with
>> separate mask IIO_CHAN_INFO_RAW
>> 2) Reading the LED current register inside IIO_CURRENT case in vcnl4010_read_raw
>> 3) Writing to LED current register inside IIO_CURRENT case in vcnl4010_write_raw
>>
>> Is this the correct way of setting Current register in IIO subsystem?
That's about the best option we currently have. This is exactly how it's done
in the max44000 driver for example.
 
It's not an interface anyone is terribly happy with so you are welcome to
suggestion alternatives (easy to add them as an additional interface to
existing cases - which is why we haven't been that worried about ending up
with the current less than ideal interface)
The tight coupling in this particular case might justify something more
explicitly linked to the proximity channel but as noted above it's not
always that obvious (see the health/afe parts for example which are way
too flexible in my view!)

Jonathan


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to set Current register in IIO driver from sysfs
  2016-07-10 14:39   ` Jonathan Cameron
@ 2016-07-11  9:10     ` Pratik Prajapati
  2016-07-20 21:41       ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Pratik Prajapati @ 2016-07-11  9:10 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, linux-hwmon, linux-kernel

Hi Jonathan,

Thanks for the answers.
One more question:
What are volatile registers?
I couldn't understood the difference between volatile and writable
registers from max44000 driver.

Best Regards,
Pratik

On Sun, Jul 10, 2016 at 8:09 PM, Jonathan Cameron <jic23@kernel.org> wrote:
> On 10/07/16 14:11, Pratik Prajapati wrote:
>> Including more members.
>>
>> On Sat, Jul 9, 2016 at 5:22 PM, Pratik Prajapati
>> <pratik.prajapati12@gmail.com> wrote:
>>> Hi,
> hi Pratik,
>>>
>>> I am trying to add support of adjusting IR led current in vcnl4000
>>> driver (has IR led current register for doing the same).
> This is always a bit of a 'rough' corner when it comes to what interface
> to do it with.  Strictly speaking this is typically just a regulator that
> happens to be used for this special purpose.  Sometimes they are tightly
> tied together with the input and sometime (on devices with more than one)
> there is no explicit linkage at all.
>
> In this particular case we seem to actually have a high frequency modulated
> LED driver so it's pretty tightly tied to this use.
>>>
>>> Below is what I have done till now:
>>>
>>> 1) Added Current channel in the vcnl4000_channels structure with
>>> separate mask IIO_CHAN_INFO_RAW
>>> 2) Reading the LED current register inside IIO_CURRENT case in vcnl4010_read_raw
>>> 3) Writing to LED current register inside IIO_CURRENT case in vcnl4010_write_raw
>>>
>>> Is this the correct way of setting Current register in IIO subsystem?
> That's about the best option we currently have. This is exactly how it's done
> in the max44000 driver for example.
>
> It's not an interface anyone is terribly happy with so you are welcome to
> suggestion alternatives (easy to add them as an additional interface to
> existing cases - which is why we haven't been that worried about ending up
> with the current less than ideal interface)
> The tight coupling in this particular case might justify something more
> explicitly linked to the proximity channel but as noted above it's not
> always that obvious (see the health/afe parts for example which are way
> too flexible in my view!)
>
> Jonathan
>
>
>>>
>>> Best Regards,
>>> Pratik Prajapati
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to set Current register in IIO driver from sysfs
  2016-07-11  9:10     ` Pratik Prajapati
@ 2016-07-20 21:41       ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2016-07-20 21:41 UTC (permalink / raw)
  To: Pratik Prajapati; +Cc: linux-iio, linux-hwmon, linux-kernel

On 11/07/16 10:10, Pratik Prajapati wrote:
> Hi Jonathan,
> 
> Thanks for the answers.
> One more question:
> What are volatile registers?
Volatile registers can change without software interaction.
Things like interrupt status registers, or the output register for
an ADC.  Hence they can't be cached.

Writable simply means that their value can be effected by a software
write (not necessarily all of it).

So it's perfectly possible to be both writeable and volatile.

Often what you read from a register has very little resemblance to what
you wrote to it!

Jonathan
> I couldn't understood the difference between volatile and writable
> registers from max44000 driver.
> 
> Best Regards,
> Pratik
> 
> On Sun, Jul 10, 2016 at 8:09 PM, Jonathan Cameron <jic23@kernel.org> wrote:
>> On 10/07/16 14:11, Pratik Prajapati wrote:
>>> Including more members.
>>>
>>> On Sat, Jul 9, 2016 at 5:22 PM, Pratik Prajapati
>>> <pratik.prajapati12@gmail.com> wrote:
>>>> Hi,
>> hi Pratik,
>>>>
>>>> I am trying to add support of adjusting IR led current in vcnl4000
>>>> driver (has IR led current register for doing the same).
>> This is always a bit of a 'rough' corner when it comes to what interface
>> to do it with.  Strictly speaking this is typically just a regulator that
>> happens to be used for this special purpose.  Sometimes they are tightly
>> tied together with the input and sometime (on devices with more than one)
>> there is no explicit linkage at all.
>>
>> In this particular case we seem to actually have a high frequency modulated
>> LED driver so it's pretty tightly tied to this use.
>>>>
>>>> Below is what I have done till now:
>>>>
>>>> 1) Added Current channel in the vcnl4000_channels structure with
>>>> separate mask IIO_CHAN_INFO_RAW
>>>> 2) Reading the LED current register inside IIO_CURRENT case in vcnl4010_read_raw
>>>> 3) Writing to LED current register inside IIO_CURRENT case in vcnl4010_write_raw
>>>>
>>>> Is this the correct way of setting Current register in IIO subsystem?
>> That's about the best option we currently have. This is exactly how it's done
>> in the max44000 driver for example.
>>
>> It's not an interface anyone is terribly happy with so you are welcome to
>> suggestion alternatives (easy to add them as an additional interface to
>> existing cases - which is why we haven't been that worried about ending up
>> with the current less than ideal interface)
>> The tight coupling in this particular case might justify something more
>> explicitly linked to the proximity channel but as noted above it's not
>> always that obvious (see the health/afe parts for example which are way
>> too flexible in my view!)
>>
>> Jonathan
>>
>>
>>>>
>>>> Best Regards,
>>>> Pratik Prajapati
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-20 21:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-09 11:52 How to set Current register in IIO driver from sysfs Pratik Prajapati
2016-07-10 13:11 ` Pratik Prajapati
2016-07-10 14:39   ` Jonathan Cameron
2016-07-11  9:10     ` Pratik Prajapati
2016-07-20 21:41       ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.