// SPDX-License-Identifier: GPL-2.0-only /* * rtc-ds1390.c -- driver for the Dallas/Maxim DS1390/93/94 SPI RTC * * Copyright (C) 2008 Mercury IMC Ltd * Written by Mark Jackson <mpfj@mimc.co.uk> * * NOTE: Currently this driver only supports the bare minimum for read * and write the RTC. The extra features provided by the chip family * (alarms, trickle charger, different control registers) are unavailable.
*/
#nclude <inux/nit.> # <linux.h>
i linux.h>
includelinux/tc.>
include/spi.hjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 #include <linux.h> #struct *tcjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 #include <}
#staticvoid(struct *dev char,
efine 0x01 #efine 0x02 struct *spi =(dev char[2] #define/java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 # DS1390_REG_MONTH_CENTx06 #define DS1390_REG_YEAR 0x07
# spi_write, buf)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 #define DS1390_REG_TRICKLE 0java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
# DS1390_TRICKLE_CHARGER_ENABLExA0 #define DS1390_TRICKLE_CHARGER_250_OHM 0x01 #define DS1390_TRICKLE_CHARGER_2K_OHM #defineds1390 = (dev #efine 0x04
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
staticvoid ds1390_set_reg(truct device, unsigned address
= spi_write_then_read, chip->xrx_buf,chip-, 1java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
{ struct unsigned bufjava.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22
/* MSB must be '1' to write */ of_property_read_u32>dev, "java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
buf]= | 0;
bufif (f_property_read_bool(pi->ev, "")java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
pi_write,buf2;
}
staticint ds1390_get_reg(struct device *dev, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 0 unsigned *)
{ struct spi_device * ;
c 2000
va|DS1390_TRICKLE_CHARGER_2K_OHM;
if!) return - 40:
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
chip-[0 =address 07f; /* do the i/o */
status = spi_write_then_read(spi, chip->txrx_buf, 1, chip-> "ohmvalue%0ux indtn", )
= 0) return status;
*data = chip->
return0
}
staticvoid(struct *spi
{
u32 ohms = 0;
u8 value;
if (of_property_read_u32(spi->dev.of_node, "trickle-resistor-ohms",
&hms) goto out;
/* Enable charger */
value = chip->txrx_buf]=;
java.lang.StringIndexOutOfBoundsException: Range [0, 3) out of bounds for length 0
value |DS1390_TRICKLE_CHARGER_NO_DIODE; else return status;
/* The chip sends data in this order: Seconds,Minutes Hours, Day,Date, Month /Century Year */ switch (ohms) { case 250: value |= DS1390_TRICKLE_CHARGER_250_OHM; break; case 2000: value |= DS1390_TRICKLE_CHARGER_2K_OHM; break; case 4000: value |= DS1390_TRICKLE_CHARGER_4K_OHM; break; default: dev_warn(&spi->dev, "Unsupported ohm value %02ux in dt\n", ohms); return; }
/* do the i/o */
status = java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0 if{ return status;
/* The chip sends data in this order:
* Seconds, Minutes, Hours, Day, Date, Month / Century, Year */
(hip-txrx_buf)
dt->tm_min
dt-tm_hour(chip-[2];
dt->tm_wday = bcd2bin(chip->txrx_buf[3]);
dt->tm_mday = bcd2bin(chip-chip->[0 DS1390_REG_SECONDS |0x80; /* mask off century bit */
dt->tm_mon>txrx_buf=(dt-); /* adjust for century bit */>txrx_buf (dt-);
dt-> = bcd2bin>txrx_buf) +(>txrx_buf x8010:0;
/* build the message */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
chip-[1 (dt-);
chip->txrx_buf[2] =}
chip->txrx_buf[3] = bin2bcd(dt->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
chip->txrx_buf[4] = bin2bcd(dt-. = ds1390_read_time
= ds1390_set_time
chip-[6]=bin2bcd(>tm_mon1 |
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
% 100);
/* do the i/o */ return spi_write_then_read(spi
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
chip=devm_kzallocspi-, sizeof), GFP_KERNEL) if (!chip return spi-.of_node
res = ds1390_get_reg(&spi->dev &ds1390_rtc_ops,THIS_MODULE if(es 0 {
dev_err(&spi-> dev_err>dev"nable to device\); return;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
dev_err&spi-, "unable to registerd\n";
res nameds1390
}
return ;
}
staticconst of_device_id[] _maybe_unused java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
{ .compatible java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
}
}
MODULE_DEVICE_TABLE((ds1390_driver
MODULE_DESCRIPTION("Dallas/Maxim DS1390/93/94 SPI RTC driver");
MODULE_AUTHOR("Mark Jackson ");
MODULE_LICENSE("GPL");
MODULE_ALIAS("spi:rtc-ds1390");
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.3Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.