Message ID | 200903251827.35232.matthias.fuchs@esd-electronics.com |
---|---|
State | Not Applicable, archived |
Headers | show |
Hi Matthias, thanks for testing. More below... Matthias Fuchs wrote: >> This patch adds support for the Epson RX-8025SA/NB RTC chips. It >> includes support for alarms, periodic interrupts (1 Hz) and clock >> precision adjustment. >> >> For clock precision adjustment, the SYSFS file "clock_adjust_ppb" gets >> created in "/sys/class/rtc/rtcX/device". It permits to set and get the >> clock adjustment in ppb (parts per billion), e.g.: >> >> # echo -183000 > /sys/class/rtc/rtc0/device/clock_adjust_ppb >> # cat /sys/class/rtc/rtc0/device/clock_adjust_ppb >> -183000 >> >> This allows to compensate temperature dependent clock drifts. According >> to the RX8025 SA/NB application manual, the frequency and temperature >> characteristics can be approximated using the following equation: >> >> df = a * (ut - t)**2 >> >> df: Frequency deviation in any temperature >> a : Coefficient = (-35 +-5) * 10**-9 >> ut: Ultimate temperature in degree = +25 +-5 degree >> t : Any temperature in degree >> >> >> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> >> Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com> >> Signed-off-by: Yuri Tikhonov <yur@emcraft.com> >> Signed-off-by: Dmitry Rakhchev <rda@emcraft.com> > > Hi Wolfgang, > > your drivers works fine on my powerpc system after one tiny fixup. > Please take a look. I am not sure if there is a better way to do this. > > Matthias > > > [PATCH] rtc: Fix RX8025 rtc driver without interrupt > > This patch fixes the RX8025 rtc driver in case no interrupt > is passed. Checking for irq < 0 is not suitable on all platforms. > At least on powerpc systems irq == 0 means NO irq. > So check against NO_IRQ. Good catch. > > Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu> > --- > drivers/rtc/rtc-rx8025.c | 10 +++++++--- > 1 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c > index e274db8..1d068a4 100644 > --- a/drivers/rtc/rtc-rx8025.c > +++ b/drivers/rtc/rtc-rx8025.c > @@ -28,6 +28,10 @@ > #include <linux/miscdevice.h> > #include <linux/uaccess.h> > > +#ifndef NO_IRQ > +#define NO_IRQ (-1) > +#endif Do we really need the three lines above. > /* registers */ > #define RX8025_REG_SEC 0x00 > #define RX8025_REG_MIN 0x01 > @@ -799,7 +803,7 @@ static int __devinit rx8025_probe(struct i2c_client *client, > } > > dev_info(&client->dev, "IRQ %d supplied\n", client->irq); > - if (client->irq >= 0) { > + if (client->irq != NO_IRQ) { > err = request_irq(client->irq, rx8025_irq, 0, > "rx8025", client); > if (err) { > @@ -831,7 +835,7 @@ static int __devinit rx8025_probe(struct i2c_client *client, > rtc_device_unregister(rx8025->rtc); > > errout_irq: > - if (client->irq >= 0) > + if (client->irq != NO_IRQ) > free_irq(client->irq, client); > > errout_free: > @@ -846,7 +850,7 @@ static int __devexit rx8025_remove(struct i2c_client *client) > { > struct rx8025_data *rx8025 = i2c_get_clientdata(client); > > - if (client->irq >= 0) { > + if (client->irq != NO_IRQ) { > mutex_lock(&rx8025->mutex); > rx8025->exiting = 1; > mutex_unlock(&rx8025->mutex); I will add you fix and resubmit. Thanks, Wolfgang. --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
Matthias Fuchs wrote: >> This patch adds support for the Epson RX-8025SA/NB RTC chips. It >> includes support for alarms, periodic interrupts (1 Hz) and clock >> precision adjustment. >> >> For clock precision adjustment, the SYSFS file "clock_adjust_ppb" gets >> created in "/sys/class/rtc/rtcX/device". It permits to set and get the >> clock adjustment in ppb (parts per billion), e.g.: >> >> # echo -183000 > /sys/class/rtc/rtc0/device/clock_adjust_ppb >> # cat /sys/class/rtc/rtc0/device/clock_adjust_ppb >> -183000 >> >> This allows to compensate temperature dependent clock drifts. According >> to the RX8025 SA/NB application manual, the frequency and temperature >> characteristics can be approximated using the following equation: >> >> df = a * (ut - t)**2 >> >> df: Frequency deviation in any temperature >> a : Coefficient = (-35 +-5) * 10**-9 >> ut: Ultimate temperature in degree = +25 +-5 degree >> t : Any temperature in degree >> >> >> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> >> Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com> >> Signed-off-by: Yuri Tikhonov <yur@emcraft.com> >> Signed-off-by: Dmitry Rakhchev <rda@emcraft.com> > > Hi Wolfgang, > > your drivers works fine on my powerpc system after one tiny fixup. > Please take a look. I am not sure if there is a better way to do this. > > Matthias > > > [PATCH] rtc: Fix RX8025 rtc driver without interrupt > > This patch fixes the RX8025 rtc driver in case no interrupt > is passed. Checking for irq < 0 is not suitable on all platforms. > At least on powerpc systems irq == 0 means NO irq. > So check against NO_IRQ. > > Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu> > --- > drivers/rtc/rtc-rx8025.c | 10 +++++++--- > 1 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c > index e274db8..1d068a4 100644 > --- a/drivers/rtc/rtc-rx8025.c > +++ b/drivers/rtc/rtc-rx8025.c > @@ -28,6 +28,10 @@ > #include <linux/miscdevice.h> > #include <linux/uaccess.h> > > +#ifndef NO_IRQ > +#define NO_IRQ (-1) > +#endif > + > /* registers */ > #define RX8025_REG_SEC 0x00 > #define RX8025_REG_MIN 0x01 > @@ -799,7 +803,7 @@ static int __devinit rx8025_probe(struct i2c_client *client, > } > > dev_info(&client->dev, "IRQ %d supplied\n", client->irq); > - if (client->irq >= 0) { > + if (client->irq != NO_IRQ) { > err = request_irq(client->irq, rx8025_irq, 0, > "rx8025", client); > if (err) { > @@ -831,7 +835,7 @@ static int __devinit rx8025_probe(struct i2c_client *client, > rtc_device_unregister(rx8025->rtc); > > errout_irq: > - if (client->irq >= 0) > + if (client->irq != NO_IRQ) > free_irq(client->irq, client); > > errout_free: > @@ -846,7 +850,7 @@ static int __devexit rx8025_remove(struct i2c_client *client) > { > struct rx8025_data *rx8025 = i2c_get_clientdata(client); > > - if (client->irq >= 0) { > + if (client->irq != NO_IRQ) { > mutex_lock(&rx8025->mutex); > rx8025->exiting = 1; > mutex_unlock(&rx8025->mutex); I just send v2 of this patch with your fixes. Alessandro, could you please consider this patch for inclusion into 2.6.30. Thanks, Wolfgang. --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
> > Hi Matthias, > > thanks for testing. More below... > > Matthias Fuchs wrote: > >> This patch adds support for the Epson RX-8025SA/NB RTC chips. It > >> includes support for alarms, periodic interrupts (1 Hz) and clock > >> precision adjustment. > >> > >> For clock precision adjustment, the SYSFS file "clock_adjust_ppb" gets > >> created in "/sys/class/rtc/rtcX/device". It permits to set and get the > >> clock adjustment in ppb (parts per billion), e.g.: > >> > >> # echo -183000 > /sys/class/rtc/rtc0/device/clock_adjust_ppb > >> # cat /sys/class/rtc/rtc0/device/clock_adjust_ppb > >> -183000 > >> > >> This allows to compensate temperature dependent clock drifts. According > >> to the RX8025 SA/NB application manual, the frequency and temperature > >> characteristics can be approximated using the following equation: > >> > >> df = a * (ut - t)**2 > >> > >> df: Frequency deviation in any temperature > >> a : Coefficient = (-35 +-5) * 10**-9 > >> ut: Ultimate temperature in degree = +25 +-5 degree > >> t : Any temperature in degree > >> > >> > >> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> > >> Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com> > >> Signed-off-by: Yuri Tikhonov <yur@emcraft.com> > >> Signed-off-by: Dmitry Rakhchev <rda@emcraft.com> > > > > Hi Wolfgang, > > > > your drivers works fine on my powerpc system after one tiny fixup. > > Please take a look. I am not sure if there is a better way to do this. > > > > Matthias > > > > > > [PATCH] rtc: Fix RX8025 rtc driver without interrupt > > > > This patch fixes the RX8025 rtc driver in case no interrupt > > is passed. Checking for irq < 0 is not suitable on all platforms. > > At least on powerpc systems irq == 0 means NO irq. > > So check against NO_IRQ. > > Good catch. > > > > > Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu> > > --- > > drivers/rtc/rtc-rx8025.c | 10 +++++++--- > > 1 files changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c > > index e274db8..1d068a4 100644 > > --- a/drivers/rtc/rtc-rx8025.c > > +++ b/drivers/rtc/rtc-rx8025.c > > @@ -28,6 +28,10 @@ > > #include <linux/miscdevice.h> > > #include <linux/uaccess.h> > > > > +#ifndef NO_IRQ > > +#define NO_IRQ (-1) > > +#endif > > Do we really need the three lines above. At least arch/powerpc defines NO_IRQ to 0 and other define it to -1. So it seems to be architecture dependant. But I am not sure if it really should be used until all architectures implement it. Probably not a discussion for this list :-) So let's you your pragmatic approach :-) Matthias --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c index e274db8..1d068a4 100644 --- a/drivers/rtc/rtc-rx8025.c +++ b/drivers/rtc/rtc-rx8025.c @@ -28,6 +28,10 @@ #include <linux/miscdevice.h> #include <linux/uaccess.h> +#ifndef NO_IRQ +#define NO_IRQ (-1) +#endif + /* registers */ #define RX8025_REG_SEC 0x00 #define RX8025_REG_MIN 0x01 @@ -799,7 +803,7 @@ static int __devinit rx8025_probe(struct i2c_client *client, } dev_info(&client->dev, "IRQ %d supplied\n", client->irq); - if (client->irq >= 0) { + if (client->irq != NO_IRQ) { err = request_irq(client->irq, rx8025_irq, 0, "rx8025", client); if (err) { @@ -831,7 +835,7 @@ static int __devinit rx8025_probe(struct i2c_client *client, rtc_device_unregister(rx8025->rtc); errout_irq: - if (client->irq >= 0) + if (client->irq != NO_IRQ) free_irq(client->irq, client); errout_free: @@ -846,7 +850,7 @@ static int __devexit rx8025_remove(struct i2c_client *client) { struct rx8025_data *rx8025 = i2c_get_clientdata(client); - if (client->irq >= 0) { + if (client->irq != NO_IRQ) { mutex_lock(&rx8025->mutex); rx8025->exiting = 1; mutex_unlock(&rx8025->mutex);