- 15 Oct, 2020 5 commits
-
-
Alexandre Belloni authored
If RV3028_CTRL1_EERD is not set (this is the default), the RTC will refresh the RAM configuration registers from the EEPROM at midnight. It is necessary to save the RAM registers back to EEPROM after modifying them. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201009153101.721149-4-alexandre.belloni@bootlin.com
-
Alexandre Belloni authored
Both rv3028_eeprom_write and rv3028_eeprom_read enable EERD before sending commands to the EEPROM and restore it afterwards. Factorize this code. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201009153101.721149-3-alexandre.belloni@bootlin.com
-
Alexandre Belloni authored
Version 1.0 of the application manual had the wrong resistor values. Fix them according to version 1.1 Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201009153101.721149-2-alexandre.belloni@bootlin.com
-
Alexandre Belloni authored
rv3028_clkout_set_rate unconditionally sets RV3028_CLKOUT_CLKOE but clk_set_rate may be called with the clock disabled. Ensure the clock is kept disabled if it was not yet enabled. Also, the actual rate was overwritten when enabling the clock, properly write to the register only once. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201009153101.721149-1-alexandre.belloni@bootlin.com
-
Fei Shao authored
Removing the struct member "dev" in mt6397 RTC driver because it's not initialized and the only usage is for one debugging message. Also fixed a typo in the error message. Signed-off-by:
Fei Shao <fshao@chromium.org> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201008093414.1911699-1-fshao@chromium.org
-
- 29 Sep, 2020 3 commits
-
-
Liu Shixin authored
Simplify the return expression. Signed-off-by:
Liu Shixin <liushixin2@huawei.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200921082449.2591981-1-liushixin2@huawei.com
-
Liu Shixin authored
Simplify the return expression. Signed-off-by:
Liu Shixin <liushixin2@huawei.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by:
Kevin Hilman <khilman@baylibre.com> Link: https://lore.kernel.org/r/20200919100856.1639319-1-liushixin2@huawei.com
-
Bartosz Golaszewski authored
Since the switch to using regmap this function no longer takes the I2C client struct as argument nor do we even interact with the client anywhere other than when creating the regmap. Rename it to a less misleading name: "rx8010_init()". Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200917114656.9036-1-brgl@bgdev.pl
-
- 24 Sep, 2020 8 commits
-
-
Bastian Krause authored
The ds1307 charger infrastructure now allows to add a rx8130 charger setup that.. - does not depend on trickle-resistor-ohms - does not use DS13XX_TRICKLE_CHARGER_MAGIC trickle-charge select (TCS) bits - keeps previous no-charge behavior for device trees without aux-voltage-chargeable Make that happen. Signed-off-by:
Bastian Krause <bst@pengutronix.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200917183246.19446-9-bst@pengutronix.de
-
Bastian Krause authored
Prefer aux-voltage-chargeable over trickle-diode-disable and set diode accordingly. This is then passed to the chip's appropriate charge setup function. Signed-off-by:
Bastian Krause <bst@pengutronix.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200917183246.19446-8-bst@pengutronix.de
-
Bastian Krause authored
Some RTC's batteries and supercaps were charged by default until now. In contrast other RTCs allow charging but the driver did not configure them to do so until now. These must not be charged by default to stay backwards compatible. In order to do that, store the charge default per chip. Signed-off-by:
Bastian Krause <bst@pengutronix.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200917183246.19446-7-bst@pengutronix.de
-
Bastian Krause authored
Make trickle-resistor-ohms optional for charging setups that do not require specifying ROUT bits (specifying the resistor value between Vcc and Vbackup). In order to allow specifying that, introduce requires_trickle_resistor per chip. Signed-off-by:
Bastian Krause <bst@pengutronix.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200917183246.19446-6-bst@pengutronix.de
-
Bastian Krause authored
DS13XX_TRICKLE_CHARGER_MAGIC sets the trickle-charge select (TCS) bits (7..4). The datasheet of Maxim Integrated's DS1339 [1] for instance reads: "To prevent accidental enabling, only a pattern on 1010 enables the trickle charger. All other patterns disable the trickle charger." Since not all RTCs connected to a backup battery or supercap use these bits DS13XX_TRICKLE_CHARGER_MAGIC should not get applied for all charger setups unconditionally. Epson's RX8130 is such an example: Instead of TCS bits "SMPTSEL1", "SMPTSEL0", "CHGEN" and "INIEN" are expected as bit 7..4. DS1339 and DS1340 are currently the only RTCs in the ds1307 driver that apply DS13XX_TRICKLE_CHARGER_MAGIC to their setup register value. So apply DS13XX_TRICKLE_CHARGER_MAGIC in do_trickle_setup_ds1339() which is used by both RTCs. [1] https://datasheets.maximintegrated.com/en/ds/DS1339-DS1339U.pdf [2] https://support.epson.biz/td/api/doc_check.php?dl=app_RX8130CESigned-off-by:
Bastian Krause <bst@pengutronix.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200917183246.19446-5-bst@pengutronix.de
-
Bastian Krause authored
Epson's RX8130 was not charged before. A related patch will allow optional charging. Signed-off-by:
Bastian Krause <bst@pengutronix.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by:
Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20200917183246.19446-4-bst@pengutronix.de
-
Bastian Krause authored
trickle-diode-disable is deprecated, so reflect that in the driver's binding and add the new aux-voltage-chargeable. Signed-off-by:
Bastian Krause <bst@pengutronix.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by:
Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20200917183246.19446-3-bst@pengutronix.de
-
Bastian Krause authored
Some RTCs can be equipped with a chargeable battery or supercap. Every RTC allowing this whose driver's implement it are charged by default. To disable this the trickle-diode-disable flag exists. If a driver did not support charging and some time later one wants to add that feature, there is currently no way to do it without breaking dt backwards compatibility. RTCs on boards without the trickle-diode-disable flag in their device tree would suddenly charge their battery/supercap which is a change in behavior. Change that by introducing aux-voltage-chargeable, not as a flag but as a uint32 enum allowing to set "do not charge" (0) or "charge" (1). This dt property is optional, so we can now distinguish these cases. Care must be taken to support the old behavior for device trees without aux-voltage-chargeable nonetheless to stay compatible. Signed-off-by:
Bastian Krause <bst@pengutronix.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by:
Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20200917183246.19446-2-bst@pengutronix.de
-
- 15 Sep, 2020 18 commits
-
-
Biwen Li authored
Fix a bug when not specify interrupts property in dts as follows, rtc-pcf2127-i2c 1-0051: failed to request alarm irq rtc-pcf2127-i2c: probe of 1-0051 failed with error -22 Signed-off-by:
Biwen Li <biwen.li@nxp.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200915073213.12779-1-biwen.li@oss.nxp.com
-
Thomas Bogendoerfer authored
ds1685_rtc_begin_data_access() tried to access an extended register before enabling access to it by switching to bank 1. Depending on content in NVRAM this could lead to an endless loop. While at it fix also switch back to bank 0 in ds1685_rtc_end_data_access(). Signed-off-by:
Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by:
Joshua Kinard <kumba@gentoo.org> Link: https://lore.kernel.org/r/20200910084124.138560-1-tsbogend@alpha.franken.de
-
Rikard Falkeborn authored
The only usage of st_rtc_ops is to assign its address to the ops field in the rtc_device struct. which is a const pointer. Make it const to allow the compiler to put it in read-only memory. Signed-off-by:
Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200913122644.35515-1-rikard.falkeborn@gmail.com
-
Bartosz Golaszewski authored
We don't need to check the time range manually in set_time(), we can use range_min and range_max exposed by struct rtc_device. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-15-brgl@bgdev.pl
-
Bartosz Golaszewski authored
This driver requires SMBUS to work. We can relax this requirement if we switch to using i2c regmap and let the regmap sub-system figure out how to talk to the bus. This also has the advantage of shrinking the code for register updates. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-14-brgl@bgdev.pl
-
Bartosz Golaszewski authored
We should generally use probe_new instead of probe when registering i2c drivers. Convert rx8010 to using it. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-13-brgl@bgdev.pl
-
Bartosz Golaszewski authored
Use devm_rtc_allocate_device() + rtc_register_device() instead of the deprecated devm_rtc_device_register(). Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-12-brgl@bgdev.pl
-
Bartosz Golaszewski authored
Using the size of the variable is preferred over using the size of its type when allocating memory. Convert the call to devm_kzalloc() in probe(). Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-11-brgl@bgdev.pl
-
Bartosz Golaszewski authored
Simple 'dev' looks better then repeated &client->dev and has the added benefit of avoiding unnecessary line breaks. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-10-brgl@bgdev.pl
-
Bartosz Golaszewski authored
The 'err' local variable in rx8010_init_client() doesn't need to be initialized. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-9-brgl@bgdev.pl
-
Bartosz Golaszewski authored
The time buffer len is used directly in this driver. For readability it's better to define it as the difference between the date register offsets and use sizeof() whenever referencing it. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-8-brgl@bgdev.pl
-
Bartosz Golaszewski authored
All other functions in this driver use 'err' for integer return values. Do the same in rx8010_set_time() for consistency. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-7-brgl@bgdev.pl
-
Bartosz Golaszewski authored
The define values in this driver are close to their names and they are separated by spaces. Use tabs instead and align all defines. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-6-brgl@bgdev.pl
-
Bartosz Golaszewski authored
Move local variables of the same type into a single line for better readability. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-5-brgl@bgdev.pl
-
Bartosz Golaszewski authored
Remove brackets wherever they guard a single line. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-4-brgl@bgdev.pl
-
Bartosz Golaszewski authored
Remove an unnecessary newline after requesting the interrupt. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-3-brgl@bgdev.pl
-
Bartosz Golaszewski authored
The way the driver is implemented is buggy for the (admittedly unlikely) use case where there are two RTCs with one having an interrupt configured and the second not. This is caused by the fact that we use a global rtc_class_ops struct which we modify depending on whether the irq number is present or not. Fix it by using two const ops structs with and without alarm operations. While at it: not being able to request a configured interrupt is an error so don't ignore it and bail out of probe(). Fixes: ed13d89b ("rtc: Add Epson RX8010SJ RTC driver") Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200914154601.32245-2-brgl@bgdev.pl
-
Krzysztof Kozlowski authored
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200830080937.14367-1-krzk@kernel.org
-
- 20 Aug, 2020 6 commits
-
-
Peng Ma authored
Original device id would conflict with crypto driver, change it. Signed-off-by:
Peng Ma <peng.ma@nxp.com> Signed-off-by:
Ran Wang <ran.wang_1@nxp.com> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200818063609.39859-1-ran.wang_1@nxp.com
-
Chris Packham authored
Ensure the OSF flag is cleared on the DS1388 when the clock is set. Fixes: df11b323 ("rtc: ds1307: handle oscillator failure flags for ds1388 variant") Signed-off-by:
Chris Packham <chris.packham@alliedtelesis.co.nz> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200818013543.4283-1-chris.packham@alliedtelesis.co.nz
-
Chris Packham authored
Similar to the other variants the DS1388 has a bit to stop the oscillator to reduce the power consumption from VBAT. Ensure that the oscillator is enabled when the system is up. Signed-off-by:
Chris Packham <chris.packham@alliedtelesis.co.nz> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200816235731.21071-1-chris.packham@alliedtelesis.co.nz
-
Geert Uytterhoeven authored
Reduce boilerplate by using the module_platform_driver() helper. Signed-off-by:
Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200814110731.29029-4-geert+renesas@glider.be
-
Geert Uytterhoeven authored
rs5c313_rtc_init() calls platform_driver_register(), and initializes the hardware. This is wrong because of two reasons: 1. As soon as the driver has been registered, the device may be probed. If devm_rtc_device_register() is called before hardware initialization, reading the current time will fail: rs5c313 rs5c313: rs5c313_rtc_read_time: timeout error rs5c313 rs5c313: registered as rtc0 rs5c313 rs5c313: rs5c313_rtc_read_time: timeout error rs5c313 rs5c313: hctosys: unable to read the hardware clock 2. If the platform device does not exist, the driver will still write to a hardware device that may not be present. Fix this by moving the hardware initialization sequence to the driver's .probe() method. Signed-off-by:
Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200814110731.29029-3-geert+renesas@glider.be
-
Geert Uytterhoeven authored
Commit 284e2fa1 ("rtc: rtc-rs5c313: use devm_rtc_device_register()"), removed the last user of the driver-specific data. Hence there is no longer a need to set it. Signed-off-by:
Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200814110731.29029-2-geert+renesas@glider.be
-