Lines Matching +full:- +full:100
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (c) 2009-2010 Analog Devices, Inc.
8 * AD5258 1 64 1, 10, 50, 100
9 * AD5259 1 256 5, 10, 50, 100
10 * AD5251 2 64 1, 10, 50, 100
11 * AD5252 2 256 1, 10, 50, 100
13 * AD5253 4 64 1, 10, 50, 100
14 * AD5254 4 256 1, 10, 50, 100
15 * AD5160 1 256 5, 10, 50, 100
16 * AD5161 1 256 5, 10, 50, 100
17 * AD5162 2 256 2.5, 10, 50, 100
18 * AD5165 1 256 100
21 * AD5203 4 64 10, 100
22 * AD5204 4 256 10, 50, 100
23 * AD5206 6 256 10, 50, 100
24 * AD5207 2 256 10, 50, 100
25 * AD5231 1 1024 10, 50, 100
26 * AD5232 2 256 10, 50, 100
27 * AD5233 4 64 10, 50, 100
32 * AD5290 1 256 10, 50, 100
33 * AD5291 1 256 20, 50, 100 (20-TP)
34 * AD5292 1 1024 20, 50, 100 (20-TP)
35 * AD5293 1 1024 20, 50, 100
36 * AD7376 1 128 10, 50, 100, 1M
37 * AD8400 1 256 1, 10, 50, 100
38 * AD8402 2 256 1, 10, 50, 100
39 * AD8403 4 256 1, 10, 50, 100
41 * AD5241 1 256 10, 100, 1M
42 * AD5246 1 128 5, 10, 50, 100
43 * AD5247 1 128 5, 10, 50, 100
44 * AD5245 1 256 5, 10, 50, 100
45 * AD5243 2 256 2.5, 10, 50, 100
46 * AD5248 2 256 2.5, 10, 50, 100
51 * AD5273 1 64 1, 10, 50, 100 (OTP)
52 * AD5171 1 64 5, 10, 50, 100 (OTP)
53 * AD5170 1 256 2.5, 10, 50, 100 (OTP)
54 * AD5172 2 256 2.5, 10, 50, 100 (OTP)
55 * AD5173 2 256 2.5, 10, 50, 100 (OTP)
56 * AD5270 1 1024 20, 50, 100 (50-TP)
57 * AD5271 1 256 20, 50, 100 (50-TP)
58 * AD5272 1 1024 20, 50, 100 (50-TP)
59 * AD5274 1 256 20, 50, 100 (50-TP)
61 * See Documentation/misc-devices/ad525x_dpot.rst for more info.
68 * Copyright (c) 2006-2011 Michael Hennerich <michael.hennerich@analog.com>
98 return dpot->bdata.bops->read_d8(dpot->bdata.client); in dpot_read_d8()
103 return dpot->bdata.bops->read_r8d8(dpot->bdata.client, reg); in dpot_read_r8d8()
108 return dpot->bdata.bops->read_r8d16(dpot->bdata.client, reg); in dpot_read_r8d16()
113 return dpot->bdata.bops->write_d8(dpot->bdata.client, val); in dpot_write_d8()
118 return dpot->bdata.bops->write_r8d8(dpot->bdata.client, reg, val); in dpot_write_r8d8()
123 return dpot->bdata.bops->write_r8d16(dpot->bdata.client, reg, val); in dpot_write_r8d16()
133 if (dpot->feat & F_RDACS_WONLY) in dpot_read_spi()
134 return dpot->rdac_cache[reg & DPOT_RDAC_MASK]; in dpot_read_spi()
135 if (dpot->uid == DPOT_UID(AD5291_ID) || in dpot_read_spi()
136 dpot->uid == DPOT_UID(AD5292_ID) || in dpot_read_spi()
137 dpot->uid == DPOT_UID(AD5293_ID)) { in dpot_read_spi()
145 if (dpot->uid == DPOT_UID(AD5291_ID)) in dpot_read_spi()
149 } else if (dpot->uid == DPOT_UID(AD5270_ID) || in dpot_read_spi()
150 dpot->uid == DPOT_UID(AD5271_ID)) { in dpot_read_spi()
158 if (dpot->uid == DPOT_UID(AD5271_ID)) in dpot_read_spi()
169 if (dpot->feat & F_SPI_16BIT) in dpot_read_spi()
171 else if (dpot->feat & F_SPI_24BIT) in dpot_read_spi()
174 return -EFAULT; in dpot_read_spi()
182 switch (dpot->uid) { in dpot_read_i2c()
219 if (dpot->uid == DPOT_UID(AD5274_ID)) in dpot_read_i2c()
223 if ((reg & DPOT_REG_TOL) || (dpot->max_pos > 256)) in dpot_read_i2c()
233 if (dpot->feat & F_SPI) in dpot_read()
244 if (dpot->feat & F_RDACS_WONLY) in dpot_write_spi()
245 dpot->rdac_cache[reg & DPOT_RDAC_MASK] = value; in dpot_write_spi()
247 if (dpot->feat & F_AD_APPDATA) { in dpot_write_spi()
248 if (dpot->feat & F_SPI_8BIT) { in dpot_write_spi()
250 DPOT_MAX_POS(dpot->devid)) | in dpot_write_spi()
253 } else if (dpot->feat & F_SPI_16BIT) { in dpot_write_spi()
255 DPOT_MAX_POS(dpot->devid)) | in dpot_write_spi()
262 if (dpot->uid == DPOT_UID(AD5291_ID) || in dpot_write_spi()
263 dpot->uid == DPOT_UID(AD5292_ID) || in dpot_write_spi()
264 dpot->uid == DPOT_UID(AD5293_ID)) { in dpot_write_spi()
269 if (dpot->uid == DPOT_UID(AD5291_ID)) in dpot_write_spi()
275 } else if (dpot->uid == DPOT_UID(AD5270_ID) || in dpot_write_spi()
276 dpot->uid == DPOT_UID(AD5271_ID)) { in dpot_write_spi()
281 if (dpot->uid == DPOT_UID(AD5271_ID)) in dpot_write_spi()
308 if (dpot->uid == DPOT_UID(AD5291_ID) || in dpot_write_spi()
309 dpot->uid == DPOT_UID(AD5292_ID)) { in dpot_write_spi()
312 } else if (dpot->uid == DPOT_UID(AD5270_ID) || in dpot_write_spi()
313 dpot->uid == DPOT_UID(AD5271_ID)) { in dpot_write_spi()
320 if (dpot->feat & F_SPI_16BIT) in dpot_write_spi()
322 else if (dpot->feat & F_SPI_24BIT) in dpot_write_spi()
325 return -EFAULT; in dpot_write_spi()
333 switch (dpot->uid) { in dpot_write_i2c()
353 return -EFAULT; in dpot_write_i2c()
364 return -EFAULT; in dpot_write_i2c()
372 return -EFAULT; in dpot_write_i2c()
385 if (dpot->uid == DPOT_UID(AD5274_ID)) in dpot_write_i2c()
394 if (dpot->max_pos > 256) in dpot_write_i2c()
405 if (dpot->feat & F_SPI) in dpot_write()
422 test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask) ? in sysfs_show_reg()
426 mutex_lock(&data->update_lock); in sysfs_show_reg()
428 mutex_unlock(&data->update_lock); in sysfs_show_reg()
431 return -EINVAL; in sysfs_show_reg()
434 * the tolerance is a two-byte value where the MSB in sysfs_show_reg()
443 return sprintf(buf, "%u\n", value & data->rdac_mask); in sysfs_show_reg()
456 set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask); in sysfs_set_reg()
458 clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask); in sysfs_set_reg()
464 !test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)) in sysfs_set_reg()
465 return -EPERM; in sysfs_set_reg()
471 if (value > data->rdac_mask) in sysfs_set_reg()
472 value = data->rdac_mask; in sysfs_set_reg()
474 mutex_lock(&data->update_lock); in sysfs_set_reg()
480 mutex_unlock(&data->update_lock); in sysfs_set_reg()
491 mutex_lock(&data->update_lock); in sysfs_do_cmd()
493 mutex_unlock(&data->update_lock); in sysfs_do_cmd()
498 /* ------------------------------------------------------------------------- */
610 /* ------------------------------------------------------------------------- */
641 int err = sysfs_create_file(&dev->kobj, in ad_dpot_add_files()
644 err |= sysfs_create_file(&dev->kobj, in ad_dpot_add_files()
647 err |= sysfs_create_file(&dev->kobj, in ad_dpot_add_files()
650 err |= sysfs_create_file(&dev->kobj, in ad_dpot_add_files()
652 err |= sysfs_create_file(&dev->kobj, in ad_dpot_add_files()
666 sysfs_remove_file(&dev->kobj, in ad_dpot_remove_files()
669 sysfs_remove_file(&dev->kobj, in ad_dpot_remove_files()
672 sysfs_remove_file(&dev->kobj, in ad_dpot_remove_files()
675 sysfs_remove_file(&dev->kobj, in ad_dpot_remove_files()
677 sysfs_remove_file(&dev->kobj, in ad_dpot_remove_files()
692 err = -ENOMEM; in ad_dpot_probe()
697 mutex_init(&data->update_lock); in ad_dpot_probe()
699 data->bdata = *bdata; in ad_dpot_probe()
700 data->devid = devid; in ad_dpot_probe()
702 data->max_pos = 1 << DPOT_MAX_POS(devid); in ad_dpot_probe()
703 data->rdac_mask = data->max_pos - 1; in ad_dpot_probe()
704 data->feat = DPOT_FEAT(devid); in ad_dpot_probe()
705 data->uid = DPOT_UID(devid); in ad_dpot_probe()
706 data->wipers = DPOT_WIPERS(devid); in ad_dpot_probe()
709 if (data->wipers & (1 << i)) { in ad_dpot_probe()
710 err = ad_dpot_add_files(dev, data->feat, i); in ad_dpot_probe()
713 /* power-up midscale */ in ad_dpot_probe()
714 if (data->feat & F_RDACS_WONLY) in ad_dpot_probe()
715 data->rdac_cache[i] = data->max_pos / 2; in ad_dpot_probe()
718 if (data->feat & F_CMD_INC) in ad_dpot_probe()
719 err = sysfs_create_group(&dev->kobj, &ad525x_group_commands); in ad_dpot_probe()
726 dev_info(dev, "%s %d-Position Digital Potentiometer registered\n", in ad_dpot_probe()
727 name, data->max_pos); in ad_dpot_probe()
733 if (data->wipers & (1 << i)) in ad_dpot_probe()
734 ad_dpot_remove_files(dev, data->feat, i); in ad_dpot_probe()
752 if (data->wipers & (1 << i)) in ad_dpot_remove()
753 ad_dpot_remove_files(dev, data->feat, i); in ad_dpot_remove()