Lines Matching +full:- +full:alert

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * i2c-smbus.c - SMBus extensions to the I2C protocol
6 * Copyright (C) 2010-2019 Jean Delvare <jdelvare@suse.de>
12 #include <linux/i2c-smbus.h>
21 struct work_struct alert; member
22 struct i2c_client *ara; /* Alert response address */
38 if (!client || client->addr != data->addr) in smbus_do_alert()
40 if (client->flags & I2C_CLIENT_TEN) in smbus_do_alert()
48 if (client->dev.driver) { in smbus_do_alert()
49 driver = to_i2c_driver(client->dev.driver); in smbus_do_alert()
50 if (driver->alert) in smbus_do_alert()
51 driver->alert(client, data->type, data->data); in smbus_do_alert()
53 dev_warn(&client->dev, "no driver alert()!\n"); in smbus_do_alert()
55 dev_dbg(&client->dev, "alert with no driver\n"); in smbus_do_alert()
59 return -EBUSY; in smbus_do_alert()
63 * The alert IRQ handler needs to hand work off to a task which can issue
68 struct i2c_smbus_alert *alert = d; in smbus_alert() local
71 ara = alert->ara; in smbus_alert()
82 * Note that SMBus 2.0 reserves 10-bit addresses for future in smbus_alert()
93 dev_dbg(&ara->dev, "SMBALERT# from dev 0x%02x, flag %d\n", in smbus_alert()
96 /* Notify driver for the device which issued the alert */ in smbus_alert()
97 device_for_each_child(&ara->adapter->dev, &data, in smbus_alert()
106 struct i2c_smbus_alert *alert; in smbalert_work() local
108 alert = container_of(work, struct i2c_smbus_alert, alert); in smbalert_work()
110 smbus_alert(0, alert); in smbalert_work()
118 struct i2c_smbus_alert_setup *setup = dev_get_platdata(&ara->dev); in smbalert_probe()
119 struct i2c_smbus_alert *alert; in smbalert_probe() local
120 struct i2c_adapter *adapter = ara->adapter; in smbalert_probe()
123 alert = devm_kzalloc(&ara->dev, sizeof(struct i2c_smbus_alert), in smbalert_probe()
125 if (!alert) in smbalert_probe()
126 return -ENOMEM; in smbalert_probe()
129 irq = setup->irq; in smbalert_probe()
131 irq = fwnode_irq_get_byname(dev_fwnode(adapter->dev.parent), in smbalert_probe()
137 INIT_WORK(&alert->alert, smbalert_work); in smbalert_probe()
138 alert->ara = ara; in smbalert_probe()
141 res = devm_request_threaded_irq(&ara->dev, irq, in smbalert_probe()
144 "smbus_alert", alert); in smbalert_probe()
149 i2c_set_clientdata(ara, alert); in smbalert_probe()
150 dev_info(&adapter->dev, "supports SMBALERT#\n"); in smbalert_probe()
158 struct i2c_smbus_alert *alert = i2c_get_clientdata(ara); in smbalert_remove() local
160 cancel_work_sync(&alert->alert); in smbalert_remove()
179 * i2c_handle_smbus_alert - Handle an SMBus alert
184 * handler. It will schedule the alert work, in turn calling the
185 * corresponding I2C device driver's alert function.
192 struct i2c_smbus_alert *alert = i2c_get_clientdata(ara); in i2c_handle_smbus_alert() local
194 return schedule_work(&alert->alert); in i2c_handle_smbus_alert()
210 struct i2c_slave_host_notify_status *status = client->dev.platform_data; in i2c_slave_host_notify_cb()
218 if (status->index == 0) in i2c_slave_host_notify_cb()
219 status->addr = *val; in i2c_slave_host_notify_cb()
220 if (status->index < U8_MAX) in i2c_slave_host_notify_cb()
221 status->index++; in i2c_slave_host_notify_cb()
224 if (status->index == SMBUS_HOST_NOTIFY_LEN) in i2c_slave_host_notify_cb()
225 i2c_handle_smbus_host_notify(client->adapter, in i2c_slave_host_notify_cb()
226 status->addr); in i2c_slave_host_notify_cb()
229 status->index = 0; in i2c_slave_host_notify_cb()
241 * i2c_new_slave_host_notify_device - get a client for SMBus host-notify support
245 * Setup handling of the SMBus host-notify protocol on a given I2C bus segment.
248 * received via the SMBus host-notify address (0x8)
266 return ERR_PTR(-ENOMEM); in i2c_new_slave_host_notify_device()
288 * i2c_free_slave_host_notify_device - free the client for SMBus host-notify
301 kfree(client->dev.platform_data); in i2c_free_slave_host_notify_device()
311 * - Only works if all filled slots have the same memory type
312 * - Only works for DDR2, DDR3 and DDR4 for now
313 * - Only works on systems with 1 to 4 memory slots
343 dev_warn(&adap->dev, in i2c_register_spd()
355 dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n", in i2c_register_spd()
359 dev_warn(&adap->dev, in i2c_register_spd()
376 dev_info(&adap->dev, in i2c_register_spd()
398 dev_info(&adap->dev, in i2c_register_spd()
401 dimm_count--; in i2c_register_spd()