Lines Matching +full:multi +full:- +full:attr
1 // SPDX-License-Identifier: GPL-2.0
3 * The Gateworks System Controller (GSC) is a multi-function
6 * system functions such as push-button monitoring, multiple ADC's for
40 * -EAGAIN returned when the i2c host controller is busy in gsc_write()
41 * -EIO returned when i2c device is busy in gsc_write()
43 if (ret != -EAGAIN && ret != -EIO) in gsc_write()
59 * -EAGAIN returned when the i2c host controller is busy in gsc_read()
60 * -EIO returned when i2c device is busy in gsc_read()
62 if (ret != -EAGAIN && ret != -EIO) in gsc_read()
72 * gsc_powerdown - API to use GSC to power down board for a specific time
74 * secs - number of seconds to remain powered off
81 dev_info(&gsc->i2c->dev, "GSC powerdown for %ld seconds\n", in gsc_powerdown()
85 ret = regmap_bulk_write(gsc->regmap, GSC_TIME_ADD, regs, 4); in gsc_powerdown()
89 ret = regmap_update_bits(gsc->regmap, GSC_CTRL_1, in gsc_powerdown()
95 ret = regmap_update_bits(gsc->regmap, GSC_CTRL_1, in gsc_powerdown()
105 static ssize_t gsc_show(struct device *dev, struct device_attribute *attr, in gsc_show() argument
109 const char *name = attr->attr.name; in gsc_show()
113 rz = sprintf(buf, "%d\n", gsc->fwver); in gsc_show()
115 rz = sprintf(buf, "0x%04x\n", gsc->fwcrc); in gsc_show()
122 static ssize_t gsc_store(struct device *dev, struct device_attribute *attr, in gsc_store() argument
126 const char *name = attr->attr.name; in gsc_store()
147 &attr_fwver.attr,
148 &attr_fwcrc.attr,
149 &attr_pwrdown.attr,
187 .name = "gateworks-gsc",
199 struct device *dev = &client->dev; in gsc_probe()
207 return -ENOMEM; in gsc_probe()
209 gsc->dev = &client->dev; in gsc_probe()
210 gsc->i2c = client; in gsc_probe()
213 gsc->regmap = devm_regmap_init(dev, &gsc_regmap_bus, client, in gsc_probe()
215 if (IS_ERR(gsc->regmap)) in gsc_probe()
216 return PTR_ERR(gsc->regmap); in gsc_probe()
218 if (regmap_read(gsc->regmap, GSC_FW_VER, ®)) in gsc_probe()
219 return -EIO; in gsc_probe()
220 gsc->fwver = reg; in gsc_probe()
222 regmap_read(gsc->regmap, GSC_FW_CRC, ®); in gsc_probe()
223 gsc->fwcrc = reg; in gsc_probe()
224 regmap_read(gsc->regmap, GSC_FW_CRC + 1, ®); in gsc_probe()
225 gsc->fwcrc |= reg << 8; in gsc_probe()
227 gsc->i2c_hwmon = devm_i2c_new_dummy_device(dev, client->adapter, in gsc_probe()
229 if (IS_ERR(gsc->i2c_hwmon)) { in gsc_probe()
231 return PTR_ERR(gsc->i2c_hwmon); in gsc_probe()
234 ret = devm_regmap_add_irq_chip(dev, gsc->regmap, client->irq, in gsc_probe()
242 gsc->fwver, gsc->fwcrc); in gsc_probe()
244 ret = sysfs_create_group(&dev->kobj, &attr_group); in gsc_probe()
250 sysfs_remove_group(&dev->kobj, &attr_group); in gsc_probe()
259 sysfs_remove_group(&client->dev.kobj, &attr_group); in gsc_remove()
264 .name = "gateworks-gsc",