All of lore.kernel.org
 help / color / mirror / Atom feed
* [rtc-linux] rv3029 EEPROM handling
@ 2016-02-27 14:39 Michael Büsch
  2016-02-28  0:31 ` Alexandre Belloni
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Büsch @ 2016-02-27 14:39 UTC (permalink / raw)
  To: Gregory Hermant; +Cc: rtc-linux

[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]

Hi,

I'm currently trying to use the Linux RV3029 RTC driver for one of my
applications. So far the basic functionality works fine.
However I need a way to (initially) program the EEPROM on the RTC chip
to enable such things as temperature compensation or the trickle
charger.
As of now the Linux driver does not support that though. So I'm
wondering how we should implement that. As an initial idea I think we
could have about some sysfs attributes for these settings. Is there a
better way (more standard API) to do this?
If not, I'll do an implementation of this based on sysfs attributes.

-- 
Michael

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-27 14:39 [rtc-linux] rv3029 EEPROM handling Michael Büsch
@ 2016-02-28  0:31 ` Alexandre Belloni
  2016-02-28  8:44   ` Michael Büsch
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Belloni @ 2016-02-28  0:31 UTC (permalink / raw)
  To: Michael Büsch; +Cc: Gregory Hermant, rtc-linux

Hi,

On 27/02/2016 at 15:39:18 +0100, Michael B=C3=BCsch wrote :
> I'm currently trying to use the Linux RV3029 RTC driver for one of my
> applications. So far the basic functionality works fine.
> However I need a way to (initially) program the EEPROM on the RTC chip
> to enable such things as temperature compensation or the trickle
> charger.
> As of now the Linux driver does not support that though. So I'm
> wondering how we should implement that. As an initial idea I think we
> could have about some sysfs attributes for these settings. Is there a
> better way (more standard API) to do this?
> If not, I'll do an implementation of this based on sysfs attributes.
>=20

trickle charging is usually enabled using device tree, however, I'd
really like to see more standardization on the property names.

I'm not sure yet about the temperature compensation. I've just merged
the crystal offset modification api with a sysfs interface in rtc-next:
http://git.kernel.org/cgit/linux/kernel/git/abelloni/linux.git/commit/?h=3D=
rtc-next&id=3D5f23807caab7801c3333c68417bb13c7e2439193

But this doesn't seem enough for that particular RTC.


--=20
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-28  0:31 ` Alexandre Belloni
@ 2016-02-28  8:44   ` Michael Büsch
  2016-02-28 10:41     ` Alexandre Belloni
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Büsch @ 2016-02-28  8:44 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Gregory Hermant, rtc-linux

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]

On Sun, 28 Feb 2016 01:31:39 +0100
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> trickle charging is usually enabled using device tree, however, I'd
> really like to see more standardization on the property names.

Is there an example of an rtc driver implementing this?
For the rv3029 it's more than just enabling it. It also has a bunch of
charging resistors to choose from.

> I'm not sure yet about the temperature compensation. I've just merged
> the crystal offset modification api with a sysfs interface in rtc-next:
> http://git.kernel.org/cgit/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=5f23807caab7801c3333c68417bb13c7e2439193
> 
> But this doesn't seem enough for that particular RTC.

The rv3029 does the compensation internally. It just needs to be
enabled via a bit in its EEPROM. We could probably always set that bit
though. I'm not sure whether there is a case where one would not want
that.

-- 
Michael

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-28  8:44   ` Michael Büsch
@ 2016-02-28 10:41     ` Alexandre Belloni
  2016-02-28 11:58       ` Michael Büsch
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Belloni @ 2016-02-28 10:41 UTC (permalink / raw)
  To: Michael Büsch; +Cc: Gregory Hermant, rtc-linux

On 28/02/2016 at 09:44:52 +0100, Michael B=C3=BCsch wrote :
> On Sun, 28 Feb 2016 01:31:39 +0100
> Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
>=20
> > trickle charging is usually enabled using device tree, however, I'd
> > really like to see more standardization on the property names.
>=20
> Is there an example of an rtc driver implementing this?
> For the rv3029 it's more than just enabling it. It also has a bunch of
> charging resistors to choose from.
>=20

ds1339, ds1390 and bq32k are using trickle-resistor-ohms and
trickle-diode-disable.

> > I'm not sure yet about the temperature compensation. I've just merged
> > the crystal offset modification api with a sysfs interface in rtc-next:
> > http://git.kernel.org/cgit/linux/kernel/git/abelloni/linux.git/commit/?=
h=3Drtc-next&id=3D5f23807caab7801c3333c68417bb13c7e2439193
> >=20
> > But this doesn't seem enough for that particular RTC.
>=20
> The rv3029 does the compensation internally. It just needs to be
> enabled via a bit in its EEPROM. We could probably always set that bit
> though. I'm not sure whether there is a case where one would not want
> that.
>=20

If you want to enable it without changing the values, just enable it
unconditionally.


--=20
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-28 10:41     ` Alexandre Belloni
@ 2016-02-28 11:58       ` Michael Büsch
  2016-02-28 12:36         ` Alexandre Belloni
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Büsch @ 2016-02-28 11:58 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Gregory Hermant, rtc-linux

[-- Attachment #1: Type: text/plain, Size: 1542 bytes --]

On Sun, 28 Feb 2016 11:41:10 +0100
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> ds1339, ds1390 and bq32k are using trickle-resistor-ohms and
> trickle-diode-disable.


The rv3029 datasheet doesn't say anything about a diode (I think it
still has one though). It merely talks about resistors connected
between vdd and the battery pin.
So I'm not sure whether we should use the 'trickle-diode-disable'
property here. One other possibility would be to use
trickle-resistor-ohms=-1 or such to disable the charger.


> > The rv3029 does the compensation internally. It just needs to be
> > enabled via a bit in its EEPROM. We could probably always set that bit
> > though. I'm not sure whether there is a case where one would not want
> > that.
> >   
> 
> If you want to enable it without changing the values, just enable it
> unconditionally.


I think the internal temperature compensation should be enabled by
default and be disabled via DT property ('temp-compensation-disable'
or such).

-- 
Michael

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-28 11:58       ` Michael Büsch
@ 2016-02-28 12:36         ` Alexandre Belloni
  2016-02-28 17:14           ` Michael Büsch
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Belloni @ 2016-02-28 12:36 UTC (permalink / raw)
  To: Michael Büsch; +Cc: Gregory Hermant, rtc-linux

On 28/02/2016 at 12:58:52 +0100, Michael B=C3=BCsch wrote :
> On Sun, 28 Feb 2016 11:41:10 +0100
> Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
>=20
> > ds1339, ds1390 and bq32k are using trickle-resistor-ohms and
> > trickle-diode-disable.
>=20
>=20
> The rv3029 datasheet doesn't say anything about a diode (I think it
> still has one though). It merely talks about resistors connected
> between vdd and the battery pin.
> So I'm not sure whether we should use the 'trickle-diode-disable'
> property here. One other possibility would be to use
> trickle-resistor-ohms=3D-1 or such to disable the charger.
>=20

More simply, don't enable the trickle charger if the
trickle-resistor-ohms property is missing.

Leave out the trickle-diode-disable property

>=20
> > > The rv3029 does the compensation internally. It just needs to be
> > > enabled via a bit in its EEPROM. We could probably always set that bi=
t
> > > though. I'm not sure whether there is a case where one would not want
> > > that.
> > >  =20
> >=20
> > If you want to enable it without changing the values, just enable it
> > unconditionally.
>=20
>=20
> I think the internal temperature compensation should be enabled by
> default and be disabled via DT property ('temp-compensation-disable'
> or such).
>=20

That part is not HW related, it should not be in the device tree. I'd
really just enable the temperature compensation else, this has to be
done in sysfs



--=20
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-28 12:36         ` Alexandre Belloni
@ 2016-02-28 17:14           ` Michael Büsch
  2016-02-28 21:39             ` Alexandre Belloni
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Büsch @ 2016-02-28 17:14 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Gregory Hermant, rtc-linux

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

On Sun, 28 Feb 2016 13:36:18 +0100
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> More simply, don't enable the trickle charger if the
> trickle-resistor-ohms property is missing.
> 
> Leave out the trickle-diode-disable property

D'oh indeed. :)

The rv3029 has a clkout pin that can be configured to various
frequencies. So I added a 'clkout-hz' property for this.

> That part is not HW related, it should not be in the device tree. I'd
> really just enable the temperature compensation else, this has to be
> done in sysfs

Ok.

Just for the record:
I started an initial implementation of this here in the rv3029 branch:
git://git.bues.ch/linux.git
http://bues.ch/gitweb?p=linux.git;a=shortlog;h=refs/heads/rv3029

-- 
Michael

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-28 17:14           ` Michael Büsch
@ 2016-02-28 21:39             ` Alexandre Belloni
  2016-02-29 17:07               ` Michael Büsch
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Belloni @ 2016-02-28 21:39 UTC (permalink / raw)
  To: Michael Büsch; +Cc: Gregory Hermant, rtc-linux

On 28/02/2016 at 18:14:50 +0100, Michael B=C3=BCsch wrote :
> On Sun, 28 Feb 2016 13:36:18 +0100
> Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
>=20
> > More simply, don't enable the trickle charger if the
> > trickle-resistor-ohms property is missing.
> >=20
> > Leave out the trickle-diode-disable property
>=20
> D'oh indeed. :)
>=20
> The rv3029 has a clkout pin that can be configured to various
> frequencies. So I added a 'clkout-hz' property for this.
>=20

No, you have to use the CCF for that. For a recent example, see:
http://git.kernel.org/cgit/linux/kernel/git/abelloni/linux.git/commit/?h=3D=
rtc-next&id=3D578bb1d82bdd7fb86d5988fb775c871521a2761f

> > That part is not HW related, it should not be in the device tree. I'd
> > really just enable the temperature compensation else, this has to be
> > done in sysfs
>=20
> Ok.
>=20
> Just for the record:
> I started an initial implementation of this here in the rv3029 branch:
> git://git.bues.ch/linux.git
> http://bues.ch/gitweb?p=3Dlinux.git;a=3Dshortlog;h=3Drefs/heads/rv3029

I had a really quick look, I'll review when you post patches. Please
separate each functionality when submitting and use checkpatch.pl --strict

Also, to export the temperature, use hwmon, see:
http://git.kernel.org/cgit/linux/kernel/git/abelloni/linux.git/commit/?h=3D=
rtc-next&id=3D445c02076f1e60d2ee51503bf1288ef9f3bc8809

You may want to use regmap instead of defining your own update_bits
(rv3029c2_i2c_maskset_reg) but that is a more invasie change that you
may leave out for now.
--=20
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-28 21:39             ` Alexandre Belloni
@ 2016-02-29 17:07               ` Michael Büsch
  2016-02-29 19:52                 ` Alexandre Belloni
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Büsch @ 2016-02-29 17:07 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Gregory Hermant, rtc-linux

[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]

On Sun, 28 Feb 2016 22:39:20 +0100
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> > The rv3029 has a clkout pin that can be configured to various
> > frequencies. So I added a 'clkout-hz' property for this.
> >   
> 
> No, you have to use the CCF for that.

Oh, yes. That makes sense.

> I had a really quick look, I'll review when you post patches. Please
> separate each functionality when submitting and use checkpatch.pl --strict

Yes, of course. Thanks for the hint. I'm not submitting stuff for the
first time, though. :)

> Also, to export the temperature, use hwmon, see:
> http://git.kernel.org/cgit/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=445c02076f1e60d2ee51503bf1288ef9f3bc8809

That is a rather weird API.
Is there a special naming scheme required for the attribute?
What does the 'input' mean in 'temp1_input'? And why is it temp1
instead of temp0?

> You may want to use regmap instead of defining your own update_bits
> (rv3029c2_i2c_maskset_reg) but that is a more invasie change that you
> may leave out for now.

Ok, I will do this last.
Don't hold your breath. :)

-- 
Michael

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [rtc-linux] rv3029 EEPROM handling
  2016-02-29 17:07               ` Michael Büsch
@ 2016-02-29 19:52                 ` Alexandre Belloni
  0 siblings, 0 replies; 10+ messages in thread
From: Alexandre Belloni @ 2016-02-29 19:52 UTC (permalink / raw)
  To: Michael Büsch; +Cc: Gregory Hermant, rtc-linux

On 29/02/2016 at 18:07:49 +0100, Michael B=C3=BCsch wrote :
> > Also, to export the temperature, use hwmon, see:
> > http://git.kernel.org/cgit/linux/kernel/git/abelloni/linux.git/commit/?=
h=3Drtc-next&id=3D445c02076f1e60d2ee51503bf1288ef9f3bc8809
>=20
> That is a rather weird API.
> Is there a special naming scheme required for the attribute?
> What does the 'input' mean in 'temp1_input'? And why is it temp1
> instead of temp0?

It means that you can read the value as opposed to output it for example
on a 3d printing nozzle.

I'm not sure why it is indexed starting with 1 but probably because
usually that's how user documentation is written. You'd have to ask the
hwmon maintainers ;)

>=20
> > You may want to use regmap instead of defining your own update_bits
> > (rv3029c2_i2c_maskset_reg) but that is a more invasie change that you
> > may leave out for now.
>=20
> Ok, I will do this last.
> Don't hold your breath. :)
>=20

I'm not even sure this is a good idea but I'd need to have a look at the
code to know ;)


--=20
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

end of thread, other threads:[~2016-02-29 19:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-27 14:39 [rtc-linux] rv3029 EEPROM handling Michael Büsch
2016-02-28  0:31 ` Alexandre Belloni
2016-02-28  8:44   ` Michael Büsch
2016-02-28 10:41     ` Alexandre Belloni
2016-02-28 11:58       ` Michael Büsch
2016-02-28 12:36         ` Alexandre Belloni
2016-02-28 17:14           ` Michael Büsch
2016-02-28 21:39             ` Alexandre Belloni
2016-02-29 17:07               ` Michael Büsch
2016-02-29 19:52                 ` Alexandre Belloni

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.