rtc-rv3032.c (9d4d8572a539ef807e21c196f145aa365fd52f0e) | rtc-rv3032.c (94428ac9aae9cf27e59879bd5c5a4a57c033eb59) |
---|---|
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 --- 15 unchanged lines hidden (view full) --- 900 rv3032_clkout_register_clk(rv3032, client); 901#endif 902 903 rv3032_hwmon_register(&client->dev); 904 905 return 0; 906} 907 | 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 --- 15 unchanged lines hidden (view full) --- 901 rv3032_clkout_register_clk(rv3032, client); 902#endif 903 904 rv3032_hwmon_register(&client->dev); 905 906 return 0; 907} 908 |
908static const struct of_device_id rv3032_of_match[] = { | 909static const __maybe_unused struct of_device_id rv3032_of_match[] = { |
909 { .compatible = "microcrystal,rv3032", }, 910 { } 911}; 912MODULE_DEVICE_TABLE(of, rv3032_of_match); 913 914static struct i2c_driver rv3032_driver = { 915 .driver = { 916 .name = "rtc-rv3032", 917 .of_match_table = of_match_ptr(rv3032_of_match), 918 }, 919 .probe_new = rv3032_probe, 920}; 921module_i2c_driver(rv3032_driver); 922 923MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@bootlin.com>"); 924MODULE_DESCRIPTION("Micro Crystal RV3032 RTC driver"); 925MODULE_LICENSE("GPL v2"); | 910 { .compatible = "microcrystal,rv3032", }, 911 { } 912}; 913MODULE_DEVICE_TABLE(of, rv3032_of_match); 914 915static struct i2c_driver rv3032_driver = { 916 .driver = { 917 .name = "rtc-rv3032", 918 .of_match_table = of_match_ptr(rv3032_of_match), 919 }, 920 .probe_new = rv3032_probe, 921}; 922module_i2c_driver(rv3032_driver); 923 924MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@bootlin.com>"); 925MODULE_DESCRIPTION("Micro Crystal RV3032 RTC driver"); 926MODULE_LICENSE("GPL v2"); |