aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds2404.c
Commit message (Collapse)AuthorAgeFilesLines
* rtc: ds2404: drop needless struct ds2404::rtc memberAndré Draszik2025-03-051-7/+7
| | | | | | | | | | | | The memory pointed to by the ::rtc member is managed via devres, and no code in this driver uses it past _probe(). We can drop it from the structure and just use a local temporary variable, reducing runtime memory consumption by a few bytes. Signed-off-by: AndrĂ© Draszik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: ds2404: Convert to GPIO descriptorsLinus Walleij2023-08-161-100/+69
| | | | | | | | | | | | | | | | | | | | | | | This converts the DS2404 to use GPIO descriptors instead of hard-coded global GPIO numbers. The platform data can be deleted because there are no in-tree users and it only contained GPIO numbers which are now passed using descriptor tables (or device tree or ACPI). The driver was rewritten to use a state container for the device driver state (struct ds2404 *chip) and pass that around instead of using a global singleton storage for the GPIO handles. When declaring GPIO descriptor tables or other hardware descriptions for the RTC driver, implementers should take care to flag the RESET line as active low, such as by using the GPIOD_ACTIVE_LOW flag in the descriptor table. Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: rework rtc_register_device() resource managementBartosz Golaszewski2020-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | rtc_register_device() is a managed interface but it doesn't use devres by itself - instead it marks an rtc_device as "registered" and the devres callback for devm_rtc_allocate_device() takes care of resource release. This doesn't correspond with the design behind devres where managed structures should not be aware of being managed. The correct solution here is to register a separate devres callback for unregistering the device. While at it: rename rtc_register_device() to devm_rtc_register_device() and add it to the list of managed interfaces in devres.rst. This way we can avoid any potential confusion of driver developers who may expect there to exist a corresponding unregister function. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: ds2404: use hw endiannes variableNicholas Mc Guire2019-05-231-2/+3
| | | | | | | | | | | Converting from hardware to host endiannes was done using reassignment to the same variable which makes sparse unhappy as it can not verify the endiannes handling properly. To allow sparse to verify endiannes handling an explicit __le32 is introduced. Note that this patch does not change the generated binary (x86_64 and ppc64 binary diff). Signed-off-by: Nicholas Mc Guire <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: ds2404: simplify .probe and remove .removeAlexandre Belloni2019-04-191-18/+7
| | | | | | Use devm_add_action_or_reset to simplify .probe and remove .remove Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: ds2404: remove ds2404_chip_opsAlexandre Belloni2019-04-191-19/+3
| | | | | | | There is only one ds2404_chip_ops struct that is implemented, remove the unnecessary indirection. Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: ds2404: convert to SPDX identifierAlexandre Belloni2019-04-191-8/+2
| | | | | | Use SPDX-License-Identifier instead of a verbose license text. Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: ds2404: use .set_timeAlexandre Belloni2019-04-191-3/+3
| | | | | | Use .set_time instead of the deprecated .set_mmss. Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: ds2404: switch to rtc_time64_to_tmAlexandre Belloni2019-04-191-1/+1
| | | | | | | Call the 64bit version of rtc_time_to_tm now that the range is enforced by the core. Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: ds2404: set rangeAlexandre Belloni2019-04-191-5/+9
| | | | | | | | | The real-time clock is a 5-byte binary counter. It is incremented 256 times per second. The least significant byte is a count of fractional seconds. The upper four bytes are a count of seconds. The realtime clock can accumulate 136 years of seconds before rolling over. Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-1/+1
| | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: ds2404: move rtc-ds2404.h to platform_dataAlexandre Belloni2016-06-271-1/+1
| | | | | | rtc-ds2404.h belongs to include/linux/platform_data/ Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: rtc-ds2404: constify ds2404_chip_ops structuresJulia Lawall2016-01-111-2/+2
| | | | | | | | | The ds2404_chip_ops structure is never modified, so declare it as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0
| | | | | | | A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <[email protected]>
* drivers/rtc/rtc-ds2404.c: use dev_get_platdata()Jingoo Han2013-11-131-1/+1
| | | | | | | | | | Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. This is a cosmetic change to make the code simpler and enhance the readability. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* rtc: rtc-ds2404: use devm_*() functionsJingoo Han2013-04-301-9/+3
| | | | | | | | Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* rtc: rtc-ds2404: use dev_err() instead of printk()Jingoo Han2013-02-221-2/+2
| | | | | | | | | | Fix the checkpatch warning as below: WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* drivers/rtc/rtc-ds2404.c: use module_platform_driver macroSrinivas Kandagatla2013-02-221-13/+1
| | | | | | | | Remove removes some code duplication by using module_platform_driver(). Signed-off-by: Srinivas Kandagatla <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* rtc: add Dallas DS2404 driverSven Schnelle2012-10-051-0/+303
[[email protected]: fix warning] Signed-off-by: Sven Schnelle <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>