| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef __DRIVERS_I2C_RV3028C7_CHIP_H__ |
| 4 | #define __DRIVERS_I2C_RV3028C7_CHIP_H__ |
| 5 | |
| 6 | #include "rv3028c7.h" |
| 7 | |
| 8 | /* |
| 9 | * The RTC has three different modes in how the backup voltage is used: |
| 10 | * - OFF: Backup voltage not used |
| 11 | * - DIRECT: Switch to backup voltage if it is higher than VDD |
| 12 | * - LEVEL: Switch to backup voltage if VDD is < 2 V and VBACKUP > 2 V |
| 13 | */ |
| 14 | enum sw_mode { |
| 15 | BACKUP_SW_DIRECT = 1, |
| 16 | BACKUP_SW_OFF, |
| 17 | BACKUP_SW_LEVEL |
| 18 | }; |
| 19 | |
| 20 | /* |
| 21 | * The RTC can be used to charge a capacitor on VBACKUP. |
| 22 | * There are the following modes: |
| 23 | * - OFF: Do not charge the backup capacitor via VDD |
| 24 | * - VIA_3K: Connect the backup capacitor via 3 k resistor with VDD |
| 25 | * - VIA_5K: Connect the backup capacitor via 5 k resistor with VDD |
| 26 | * - VIA_9K: Connect the backup capacitor via 9 k resistor with VDD |
| 27 | * - VIA_15K: Connect the backup capacitor via 15 k resistor with VDD |
| 28 | */ |
| 29 | enum charge_mode { |
| 30 | CHARGE_OFF = 0, |
| 31 | CHARGE_VIA_3K, |
| 32 | CHARGE_VIA_5K, |
| 33 | CHARGE_VIA_9K, |
| 34 | CHARGE_VIA_15K |
| 35 | }; |
| 36 | |
| 37 | struct drivers_i2c_rv3028c7_config { |
| 38 | unsigned int bus_speed; /* Bus clock in Hz */ |
| 39 | unsigned char user_weekday; /* User day of the week to set */ |
| 40 | unsigned char user_day; /* User day to set */ |
| 41 | unsigned char user_month; /* User month to set */ |
| 42 | unsigned char user_year; /* User year to set (2-digit) */ |
| 43 | unsigned char set_user_date; /* Use user date from devicetree */ |
| 44 | enum sw_mode bckup_sw_mode; /* Mode for switching between VDD and VBACKUP */ |
| 45 | enum charge_mode cap_charge; /* Mode for capacitor charging */ |
| 46 | }; |
| 47 | |
| 48 | #endif /* __DRIVERS_I2C_RV3028C7_CHIP_H__ */ |