Lines Matching +full:ainc +full:-

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2001-2004 Aurelien Jarno <aurelien@aurel32.net>
33 * | 0 |AOEF| AIP | 0 |AINC| AICH |
65 #define REG_TO_SIGNED(reg) (((reg) & 0x80) ? ((reg) - 256) : (reg))
98 return sprintf(buf, "%d\n", data->aout * 10); in out0_output_show()
116 return -EINVAL; in out0_output_store()
118 data->aout = val; in out0_output_store()
119 i2c_smbus_write_byte_data(client, data->control, data->aout); in out0_output_store()
129 return sprintf(buf, "%u\n", !(!(data->control & PCF8591_CONTROL_AOEF))); in out0_enable_show()
145 mutex_lock(&data->update_lock); in out0_enable_store()
147 data->control |= PCF8591_CONTROL_AOEF; in out0_enable_store()
149 data->control &= ~PCF8591_CONTROL_AOEF; in out0_enable_store()
150 i2c_smbus_write_byte(client, data->control); in out0_enable_store()
151 mutex_unlock(&data->update_lock); in out0_enable_store()
188 data = devm_kzalloc(&client->dev, sizeof(struct pcf8591_data), in pcf8591_probe()
191 return -ENOMEM; in pcf8591_probe()
194 mutex_init(&data->update_lock); in pcf8591_probe()
200 err = sysfs_create_group(&client->dev.kobj, &pcf8591_attr_group); in pcf8591_probe()
206 err = device_create_file(&client->dev, &dev_attr_in2_input); in pcf8591_probe()
213 err = device_create_file(&client->dev, &dev_attr_in3_input); in pcf8591_probe()
218 data->hwmon_dev = hwmon_device_register(&client->dev); in pcf8591_probe()
219 if (IS_ERR(data->hwmon_dev)) { in pcf8591_probe()
220 err = PTR_ERR(data->hwmon_dev); in pcf8591_probe()
227 sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group_opt); in pcf8591_probe()
228 sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group); in pcf8591_probe()
236 hwmon_device_unregister(data->hwmon_dev); in pcf8591_remove()
237 sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group_opt); in pcf8591_remove()
238 sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group); in pcf8591_remove()
245 data->control = PCF8591_INIT_CONTROL; in pcf8591_init_client()
246 data->aout = PCF8591_INIT_AOUT; in pcf8591_init_client()
248 i2c_smbus_write_byte_data(client, data->control, data->aout); in pcf8591_init_client()
263 mutex_lock(&data->update_lock); in pcf8591_read_channel()
265 if ((data->control & PCF8591_CONTROL_AICH_MASK) != channel) { in pcf8591_read_channel()
266 data->control = (data->control & ~PCF8591_CONTROL_AICH_MASK) in pcf8591_read_channel()
268 i2c_smbus_write_byte(client, data->control); in pcf8591_read_channel()
278 mutex_unlock(&data->update_lock); in pcf8591_read_channel()