rtc-nct3018y.c (2e21dee6a46a66e4c2ced778485e1044101edee4) rtc-nct3018y.c (babfeb9cbe7ebc657bd5b3e4f9fde79f560b6acc)
1// SPDX-License-Identifier: GPL-2.0
2// Copyright (c) 2022 Nuvoton Technology Corporation
3
4#include <linux/bcd.h>
5#include <linux/clk-provider.h>
6#include <linux/err.h>
7#include <linux/i2c.h>
8#include <linux/module.h>

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

97 int flags;
98
99 if (alarm_enable) {
100 dev_dbg(&client->dev, "%s:NCT3018Y_REG_CTRL\n", __func__);
101 flags = i2c_smbus_read_byte_data(client, NCT3018Y_REG_CTRL);
102 if (flags < 0)
103 return flags;
104 *alarm_enable = flags & NCT3018Y_BIT_AIE;
1// SPDX-License-Identifier: GPL-2.0
2// Copyright (c) 2022 Nuvoton Technology Corporation
3
4#include <linux/bcd.h>
5#include <linux/clk-provider.h>
6#include <linux/err.h>
7#include <linux/i2c.h>
8#include <linux/module.h>

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

97 int flags;
98
99 if (alarm_enable) {
100 dev_dbg(&client->dev, "%s:NCT3018Y_REG_CTRL\n", __func__);
101 flags = i2c_smbus_read_byte_data(client, NCT3018Y_REG_CTRL);
102 if (flags < 0)
103 return flags;
104 *alarm_enable = flags & NCT3018Y_BIT_AIE;
105 dev_dbg(&client->dev, "%s:alarm_enable:%x\n", __func__, *alarm_enable);
106
105 }
106
107 if (alarm_flag) {
108 dev_dbg(&client->dev, "%s:NCT3018Y_REG_ST\n", __func__);
109 flags = i2c_smbus_read_byte_data(client, NCT3018Y_REG_ST);
110 if (flags < 0)
111 return flags;
112 *alarm_flag = flags & NCT3018Y_BIT_AF;
107 }
108
109 if (alarm_flag) {
110 dev_dbg(&client->dev, "%s:NCT3018Y_REG_ST\n", __func__);
111 flags = i2c_smbus_read_byte_data(client, NCT3018Y_REG_ST);
112 if (flags < 0)
113 return flags;
114 *alarm_flag = flags & NCT3018Y_BIT_AF;
115 dev_dbg(&client->dev, "%s:alarm_flag:%x\n", __func__, *alarm_flag);
113 }
114
116 }
117
115 dev_dbg(&client->dev, "%s:alarm_enable:%x alarm_flag:%x\n",
116 __func__, *alarm_enable, *alarm_flag);
117
118 return 0;
119}
120
121static irqreturn_t nct3018y_irq(int irq, void *dev_id)
122{
123 struct nct3018y *nct3018y = i2c_get_clientdata(dev_id);
124 struct i2c_client *client = nct3018y->client;
125 int err;

--- 467 unchanged lines hidden ---
118 return 0;
119}
120
121static irqreturn_t nct3018y_irq(int irq, void *dev_id)
122{
123 struct nct3018y *nct3018y = i2c_get_clientdata(dev_id);
124 struct i2c_client *client = nct3018y->client;
125 int err;

--- 467 unchanged lines hidden ---