Lines Matching +full:wire +full:- +full:config
1 // SPDX-License-Identifier: GPL-2.0
3 // Register map access API - W1 (1-Wire) support
18 * 1-Wire slaves registers with addess 8 bit and data 8 bit
28 return -EINVAL; in w1_reg_a8_v8_read()
30 mutex_lock(&sl->master->bus_mutex); in w1_reg_a8_v8_read()
32 w1_write_8(sl->master, W1_CMD_READ_DATA); in w1_reg_a8_v8_read()
33 w1_write_8(sl->master, reg); in w1_reg_a8_v8_read()
34 *val = w1_read_8(sl->master); in w1_reg_a8_v8_read()
36 ret = -ENODEV; in w1_reg_a8_v8_read()
38 mutex_unlock(&sl->master->bus_mutex); in w1_reg_a8_v8_read()
50 return -EINVAL; in w1_reg_a8_v8_write()
52 mutex_lock(&sl->master->bus_mutex); in w1_reg_a8_v8_write()
54 w1_write_8(sl->master, W1_CMD_WRITE_DATA); in w1_reg_a8_v8_write()
55 w1_write_8(sl->master, reg); in w1_reg_a8_v8_write()
56 w1_write_8(sl->master, val); in w1_reg_a8_v8_write()
58 ret = -ENODEV; in w1_reg_a8_v8_write()
60 mutex_unlock(&sl->master->bus_mutex); in w1_reg_a8_v8_write()
66 * 1-Wire slaves registers with addess 8 bit and data 16 bit
77 return -EINVAL; in w1_reg_a8_v16_read()
79 mutex_lock(&sl->master->bus_mutex); in w1_reg_a8_v16_read()
81 w1_write_8(sl->master, W1_CMD_READ_DATA); in w1_reg_a8_v16_read()
82 w1_write_8(sl->master, reg); in w1_reg_a8_v16_read()
83 *val = w1_read_8(sl->master); in w1_reg_a8_v16_read()
84 *val |= w1_read_8(sl->master)<<8; in w1_reg_a8_v16_read()
86 ret = -ENODEV; in w1_reg_a8_v16_read()
88 mutex_unlock(&sl->master->bus_mutex); in w1_reg_a8_v16_read()
101 return -EINVAL; in w1_reg_a8_v16_write()
103 mutex_lock(&sl->master->bus_mutex); in w1_reg_a8_v16_write()
105 w1_write_8(sl->master, W1_CMD_WRITE_DATA); in w1_reg_a8_v16_write()
106 w1_write_8(sl->master, reg); in w1_reg_a8_v16_write()
107 w1_write_8(sl->master, val & 0x00FF); in w1_reg_a8_v16_write()
108 w1_write_8(sl->master, val>>8 & 0x00FF); in w1_reg_a8_v16_write()
110 ret = -ENODEV; in w1_reg_a8_v16_write()
112 mutex_unlock(&sl->master->bus_mutex); in w1_reg_a8_v16_write()
118 * 1-Wire slaves registers with addess 16 bit and data 16 bit
129 return -EINVAL; in w1_reg_a16_v16_read()
131 mutex_lock(&sl->master->bus_mutex); in w1_reg_a16_v16_read()
133 w1_write_8(sl->master, W1_CMD_READ_DATA); in w1_reg_a16_v16_read()
134 w1_write_8(sl->master, reg & 0x00FF); in w1_reg_a16_v16_read()
135 w1_write_8(sl->master, reg>>8 & 0x00FF); in w1_reg_a16_v16_read()
136 *val = w1_read_8(sl->master); in w1_reg_a16_v16_read()
137 *val |= w1_read_8(sl->master)<<8; in w1_reg_a16_v16_read()
139 ret = -ENODEV; in w1_reg_a16_v16_read()
141 mutex_unlock(&sl->master->bus_mutex); in w1_reg_a16_v16_read()
154 return -EINVAL; in w1_reg_a16_v16_write()
156 mutex_lock(&sl->master->bus_mutex); in w1_reg_a16_v16_write()
158 w1_write_8(sl->master, W1_CMD_WRITE_DATA); in w1_reg_a16_v16_write()
159 w1_write_8(sl->master, reg & 0x00FF); in w1_reg_a16_v16_write()
160 w1_write_8(sl->master, reg>>8 & 0x00FF); in w1_reg_a16_v16_write()
161 w1_write_8(sl->master, val & 0x00FF); in w1_reg_a16_v16_write()
162 w1_write_8(sl->master, val>>8 & 0x00FF); in w1_reg_a16_v16_write()
164 ret = -ENODEV; in w1_reg_a16_v16_write()
166 mutex_unlock(&sl->master->bus_mutex); in w1_reg_a16_v16_write()
191 const struct regmap_config *config) in regmap_get_w1_bus() argument
193 if (config->reg_bits == 8 && config->val_bits == 8) in regmap_get_w1_bus()
196 if (config->reg_bits == 8 && config->val_bits == 16) in regmap_get_w1_bus()
199 if (config->reg_bits == 16 && config->val_bits == 16) in regmap_get_w1_bus()
202 return ERR_PTR(-ENOTSUPP); in regmap_get_w1_bus()
206 const struct regmap_config *config, in __regmap_init_w1() argument
211 const struct regmap_bus *bus = regmap_get_w1_bus(w1_dev, config); in __regmap_init_w1()
216 return __regmap_init(w1_dev, bus, w1_dev, config, in __regmap_init_w1()
222 const struct regmap_config *config, in __devm_regmap_init_w1() argument
227 const struct regmap_bus *bus = regmap_get_w1_bus(w1_dev, config); in __devm_regmap_init_w1()
232 return __devm_regmap_init(w1_dev, bus, w1_dev, config, in __devm_regmap_init_w1()
237 MODULE_DESCRIPTION("Register map access API - W1 (1-Wire) support");