rtc-rv3032.c (715a1284d89a740b197b3bad5eb20d36a397382f) rtc-rv3032.c (19588d50a2d67c3ca40f4609f59cbda9e55bdfb5)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * RTC driver for the Micro Crystal RV3032
4 *
5 * Copyright (C) 2020 Micro Crystal SA
6 *
7 * Alexandre Belloni <alexandre.belloni@bootlin.com>
8 *

--- 790 unchanged lines hidden (view full) ---

799 struct rv3032_data *rv3032 = dev_get_drvdata(dev);
800
801 if (!IS_REACHABLE(CONFIG_HWMON))
802 return;
803
804 devm_hwmon_device_register_with_info(dev, "rv3032", rv3032, &rv3032_hwmon_chip_info, NULL);
805}
806
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * RTC driver for the Micro Crystal RV3032
4 *
5 * Copyright (C) 2020 Micro Crystal SA
6 *
7 * Alexandre Belloni <alexandre.belloni@bootlin.com>
8 *

--- 790 unchanged lines hidden (view full) ---

799 struct rv3032_data *rv3032 = dev_get_drvdata(dev);
800
801 if (!IS_REACHABLE(CONFIG_HWMON))
802 return;
803
804 devm_hwmon_device_register_with_info(dev, "rv3032", rv3032, &rv3032_hwmon_chip_info, NULL);
805}
806
807static struct rtc_class_ops rv3032_rtc_ops = {
807static const struct rtc_class_ops rv3032_rtc_ops = {
808 .read_time = rv3032_get_time,
809 .set_time = rv3032_set_time,
810 .read_offset = rv3032_read_offset,
811 .set_offset = rv3032_set_offset,
812 .ioctl = rv3032_ioctl,
808 .read_time = rv3032_get_time,
809 .set_time = rv3032_set_time,
810 .read_offset = rv3032_read_offset,
811 .set_offset = rv3032_set_offset,
812 .ioctl = rv3032_ioctl,
813 .read_alarm = rv3032_get_alarm,
814 .set_alarm = rv3032_set_alarm,
815 .alarm_irq_enable = rv3032_alarm_irq_enable,
813};
814
815static const struct regmap_config regmap_config = {
816 .reg_bits = 8,
817 .val_bits = 8,
818 .max_register = 0xCA,
819};
820

--- 42 unchanged lines hidden (view full) ---

863 if (client->irq > 0) {
864 ret = devm_request_threaded_irq(&client->dev, client->irq,
865 NULL, rv3032_handle_irq,
866 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
867 "rv3032", rv3032);
868 if (ret) {
869 dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
870 client->irq = 0;
816};
817
818static const struct regmap_config regmap_config = {
819 .reg_bits = 8,
820 .val_bits = 8,
821 .max_register = 0xCA,
822};
823

--- 42 unchanged lines hidden (view full) ---

866 if (client->irq > 0) {
867 ret = devm_request_threaded_irq(&client->dev, client->irq,
868 NULL, rv3032_handle_irq,
869 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
870 "rv3032", rv3032);
871 if (ret) {
872 dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
873 client->irq = 0;
871 } else {
872 rv3032_rtc_ops.read_alarm = rv3032_get_alarm;
873 rv3032_rtc_ops.set_alarm = rv3032_set_alarm;
874 rv3032_rtc_ops.alarm_irq_enable = rv3032_alarm_irq_enable;
875 }
876 }
874 }
875 }
876 if (!client->irq)
877 clear_bit(RTC_FEATURE_ALARM, rv3032->rtc->features);
877
878 ret = regmap_update_bits(rv3032->regmap, RV3032_CTRL1,
879 RV3032_CTRL1_WADA, RV3032_CTRL1_WADA);
880 if (ret)
881 return ret;
882
883 rv3032_trickle_charger_setup(&client->dev, rv3032);
884

--- 41 unchanged lines hidden ---
878
879 ret = regmap_update_bits(rv3032->regmap, RV3032_CTRL1,
880 RV3032_CTRL1_WADA, RV3032_CTRL1_WADA);
881 if (ret)
882 return ret;
883
884 rv3032_trickle_charger_setup(&client->dev, rv3032);
885

--- 41 unchanged lines hidden ---