Lines Matching +full:write +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0-only
8 * http://www.issi.com/US/product-analog-fxled-driver.shtml
9 * http://www.si-en.com/product.asp?parentid=890
38 u8 channel; /* 1-based, max priv->cdef->channels */
50 * struct is31fl32xx_chipdef - chip-specific attributes
59 * @enable_bits_per_led_control_register: number of LEDs enable bits in each
66 * If non-NULL, @reset_func will be called during probing to set all
84 int (*sw_shutdown_func)(struct is31fl32xx_priv *priv, bool enable);
122 bool enable);
141 dev_dbg(&priv->client->dev, "writing register 0x%02X=0x%02X", reg, val); in is31fl32xx_write()
143 ret = i2c_smbus_write_byte_data(priv->client, reg, val); in is31fl32xx_write()
145 dev_err(&priv->client->dev, in is31fl32xx_write()
146 "register write to 0x%02X failed (error %d)", in is31fl32xx_write()
156 * do write ensure those will have no effect.
167 for (i = 0; i < priv->cdef->channels; i++) { in is31fl3216_reset()
168 ret = is31fl32xx_write(priv, priv->cdef->pwm_register_base+i, in is31fl3216_reset()
173 ret = is31fl32xx_write(priv, priv->cdef->pwm_update_reg, 0); in is31fl3216_reset()
187 * Custom Software-Shutdown function for IS31FL3216 because it does not have
189 * We don't bother doing a read/modify/write on the CONFIG register because
193 bool enable) in is31fl3216_software_shutdown() argument
195 u8 value = enable ? IS31FL3216_CONFIG_SSD_ENABLE : in is31fl3216_software_shutdown()
203 * - All referenced data is read-only after probe()
204 * - The I2C core has a mutex on to protect the bus
205 * - There are no read/modify/write operations
206 * - Intervening operations between the write of the PWM register
210 * PWM_REG_1 write 16
211 * UPDATE_REG write 0
212 * PWM_REG_2 write 128
213 * UPDATE_REG write 0
215 * PWM_REG_1 write 16
216 * PWM_REG_2 write 128
217 * UPDATE_REG write 0
218 * UPDATE_REG write 0
227 const struct is31fl32xx_chipdef *cdef = led_data->priv->cdef; in is31fl32xx_brightness_set()
231 dev_dbg(led_cdev->dev, "%s: %d\n", __func__, brightness); in is31fl32xx_brightness_set()
233 /* NOTE: led_data->channel is 1-based */ in is31fl32xx_brightness_set()
234 if (cdef->pwm_registers_reversed) in is31fl32xx_brightness_set()
235 pwm_register_offset = cdef->channels - led_data->channel; in is31fl32xx_brightness_set()
237 pwm_register_offset = led_data->channel - 1; in is31fl32xx_brightness_set()
239 ret = is31fl32xx_write(led_data->priv, in is31fl32xx_brightness_set()
240 cdef->pwm_register_base + pwm_register_offset, in is31fl32xx_brightness_set()
245 return is31fl32xx_write(led_data->priv, cdef->pwm_update_reg, 0); in is31fl32xx_brightness_set()
250 const struct is31fl32xx_chipdef *cdef = priv->cdef; in is31fl32xx_reset_regs()
253 if (cdef->reset_reg != IS31FL32XX_REG_NONE) { in is31fl32xx_reset_regs()
254 ret = is31fl32xx_write(priv, cdef->reset_reg, 0); in is31fl32xx_reset_regs()
259 if (cdef->reset_func) in is31fl32xx_reset_regs()
260 return cdef->reset_func(priv); in is31fl32xx_reset_regs()
266 bool enable) in is31fl32xx_software_shutdown() argument
268 const struct is31fl32xx_chipdef *cdef = priv->cdef; in is31fl32xx_software_shutdown()
271 if (cdef->shutdown_reg != IS31FL32XX_REG_NONE) { in is31fl32xx_software_shutdown()
272 u8 value = enable ? IS31FL32XX_SHUTDOWN_SSD_ENABLE : in is31fl32xx_software_shutdown()
274 ret = is31fl32xx_write(priv, cdef->shutdown_reg, value); in is31fl32xx_software_shutdown()
279 if (cdef->sw_shutdown_func) in is31fl32xx_software_shutdown()
280 return cdef->sw_shutdown_func(priv, enable); in is31fl32xx_software_shutdown()
287 const struct is31fl32xx_chipdef *cdef = priv->cdef; in is31fl32xx_init_regs()
295 * Set enable bit for all channels. in is31fl32xx_init_regs()
298 if (cdef->led_control_register_base != IS31FL32XX_REG_NONE) { in is31fl32xx_init_regs()
300 GENMASK(cdef->enable_bits_per_led_control_register-1, 0); in is31fl32xx_init_regs()
301 u8 num_regs = cdef->channels / in is31fl32xx_init_regs()
302 cdef->enable_bits_per_led_control_register; in is31fl32xx_init_regs()
307 cdef->led_control_register_base+i, in is31fl32xx_init_regs()
318 if (cdef->global_control_reg != IS31FL32XX_REG_NONE) { in is31fl32xx_init_regs()
319 ret = is31fl32xx_write(priv, cdef->global_control_reg, 0x00); in is31fl32xx_init_regs()
331 struct led_classdev *cdev = &led_data->cdev; in is31fl32xx_parse_child_dt()
336 if (ret || reg < 1 || reg > led_data->priv->cdef->channels) { in is31fl32xx_parse_child_dt()
340 return -EINVAL; in is31fl32xx_parse_child_dt()
342 led_data->channel = reg; in is31fl32xx_parse_child_dt()
344 cdev->brightness_set_blocking = is31fl32xx_brightness_set; in is31fl32xx_parse_child_dt()
355 for (i = 0; i < priv->num_leds; i++) { in is31fl32xx_find_led_data()
356 if (priv->leds[i].channel == channel) in is31fl32xx_find_led_data()
357 return &priv->leds[i]; in is31fl32xx_find_led_data()
371 &priv->leds[priv->num_leds]; in is31fl32xx_parse_dt()
374 led_data->priv = priv; in is31fl32xx_parse_dt()
382 led_data->channel); in is31fl32xx_parse_dt()
387 return -EINVAL; in is31fl32xx_parse_dt()
392 ret = devm_led_classdev_register_ext(dev, &led_data->cdev, in is31fl32xx_parse_dt()
400 priv->num_leds++; in is31fl32xx_parse_dt()
410 { .compatible = "si-en,sn3218", .data = &is31fl3218_cdef, },
412 { .compatible = "si-en,sn3216", .data = &is31fl3216_cdef, },
421 struct device *dev = &client->dev; in is31fl32xx_probe()
430 return -EINVAL; in is31fl32xx_probe()
435 return -ENOMEM; in is31fl32xx_probe()
437 priv->client = client; in is31fl32xx_probe()
438 priv->cdef = cdef; in is31fl32xx_probe()
459 dev_err(&client->dev, "Failed to reset registers on removal (%pe)\n", in is31fl32xx_remove()
464 * i2c-core (and modalias) requires that id_table be properly filled,