Lines Matching +full:ec +full:- +full:pwm
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * e-book readers designed by the original design manufacturer Netronix, Inc.
5 * It contains RTC, battery monitoring, system power management, and PWM
22 struct ntxec *ec; member
43 res = regmap_read(rtc->ec->regmap, NTXEC_REG_READ_MINUTE_SECOND, &value); in ntxec_read_time()
47 tm->tm_min = value >> 8; in ntxec_read_time()
48 tm->tm_sec = value & 0xff; in ntxec_read_time()
50 res = regmap_read(rtc->ec->regmap, NTXEC_REG_READ_MDAY_HOUR, &value); in ntxec_read_time()
54 tm->tm_mday = value >> 8; in ntxec_read_time()
55 tm->tm_hour = value & 0xff; in ntxec_read_time()
57 res = regmap_read(rtc->ec->regmap, NTXEC_REG_READ_YEAR_MONTH, &value); in ntxec_read_time()
61 tm->tm_year = (value >> 8) + 100; in ntxec_read_time()
62 tm->tm_mon = (value & 0xff) - 1; in ntxec_read_time()
69 res = regmap_read(rtc->ec->regmap, NTXEC_REG_READ_MINUTE_SECOND, &value); in ntxec_read_time()
73 if (tm->tm_min != value >> 8 || tm->tm_sec != (value & 0xff)) in ntxec_read_time()
92 { NTXEC_REG_WRITE_YEAR, ntxec_reg8(tm->tm_year - 100) }, in ntxec_set_time()
93 { NTXEC_REG_WRITE_MONTH, ntxec_reg8(tm->tm_mon + 1) }, in ntxec_set_time()
94 { NTXEC_REG_WRITE_DAY, ntxec_reg8(tm->tm_mday) }, in ntxec_set_time()
95 { NTXEC_REG_WRITE_HOUR, ntxec_reg8(tm->tm_hour) }, in ntxec_set_time()
96 { NTXEC_REG_WRITE_MINUTE, ntxec_reg8(tm->tm_min) }, in ntxec_set_time()
97 { NTXEC_REG_WRITE_SECOND, ntxec_reg8(tm->tm_sec) }, in ntxec_set_time()
100 return regmap_multi_reg_write(rtc->ec->regmap, regs, ARRAY_SIZE(regs)); in ntxec_set_time()
113 pdev->dev.of_node = pdev->dev.parent->of_node; in ntxec_rtc_probe()
115 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); in ntxec_rtc_probe()
117 return -ENOMEM; in ntxec_rtc_probe()
119 rtc->dev = &pdev->dev; in ntxec_rtc_probe()
120 rtc->ec = dev_get_drvdata(pdev->dev.parent); in ntxec_rtc_probe()
123 dev = devm_rtc_allocate_device(&pdev->dev); in ntxec_rtc_probe()
127 dev->ops = &ntxec_rtc_ops; in ntxec_rtc_probe()
128 dev->range_min = RTC_TIMESTAMP_BEGIN_2000; in ntxec_rtc_probe()
129 dev->range_max = 9025257599LL; /* 2255-12-31 23:59:59 */ in ntxec_rtc_probe()
136 .name = "ntxec-rtc",
143 MODULE_DESCRIPTION("RTC driver for Netronix EC");
145 MODULE_ALIAS("platform:ntxec-rtc");