Lines Matching +full:en +full:- +full:global
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
39 u8 channel; /* 1-based, max priv->cdef->channels */
51 * struct is31fl32xx_chipdef - chip-specific attributes
55 * @global_control_reg : address of Global Control register (optional)
67 * If non-NULL, @reset_func will be called during probing to set all
142 dev_dbg(&priv->client->dev, "writing register 0x%02X=0x%02X", reg, val); in is31fl32xx_write()
144 ret = i2c_smbus_write_byte_data(priv->client, reg, val); in is31fl32xx_write()
146 dev_err(&priv->client->dev, in is31fl32xx_write()
168 for (i = 0; i < priv->cdef->channels; i++) { in is31fl3216_reset()
169 ret = is31fl32xx_write(priv, priv->cdef->pwm_register_base+i, in is31fl3216_reset()
174 ret = is31fl32xx_write(priv, priv->cdef->pwm_update_reg, 0); in is31fl3216_reset()
188 * Custom Software-Shutdown function for IS31FL3216 because it does not have
204 * - All referenced data is read-only after probe()
205 * - The I2C core has a mutex on to protect the bus
206 * - There are no read/modify/write operations
207 * - Intervening operations between the write of the PWM register
228 const struct is31fl32xx_chipdef *cdef = led_data->priv->cdef; in is31fl32xx_brightness_set()
232 dev_dbg(led_cdev->dev, "%s: %d\n", __func__, brightness); in is31fl32xx_brightness_set()
234 /* NOTE: led_data->channel is 1-based */ in is31fl32xx_brightness_set()
235 if (cdef->pwm_registers_reversed) in is31fl32xx_brightness_set()
236 pwm_register_offset = cdef->channels - led_data->channel; in is31fl32xx_brightness_set()
238 pwm_register_offset = led_data->channel - 1; in is31fl32xx_brightness_set()
240 ret = is31fl32xx_write(led_data->priv, in is31fl32xx_brightness_set()
241 cdef->pwm_register_base + pwm_register_offset, in is31fl32xx_brightness_set()
246 return is31fl32xx_write(led_data->priv, cdef->pwm_update_reg, 0); in is31fl32xx_brightness_set()
251 const struct is31fl32xx_chipdef *cdef = priv->cdef; in is31fl32xx_reset_regs()
254 if (cdef->reset_reg != IS31FL32XX_REG_NONE) { in is31fl32xx_reset_regs()
255 ret = is31fl32xx_write(priv, cdef->reset_reg, 0); in is31fl32xx_reset_regs()
260 if (cdef->reset_func) in is31fl32xx_reset_regs()
261 return cdef->reset_func(priv); in is31fl32xx_reset_regs()
269 const struct is31fl32xx_chipdef *cdef = priv->cdef; in is31fl32xx_software_shutdown()
272 if (cdef->shutdown_reg != IS31FL32XX_REG_NONE) { in is31fl32xx_software_shutdown()
275 ret = is31fl32xx_write(priv, cdef->shutdown_reg, value); in is31fl32xx_software_shutdown()
280 if (cdef->sw_shutdown_func) in is31fl32xx_software_shutdown()
281 return cdef->sw_shutdown_func(priv, enable); in is31fl32xx_software_shutdown()
288 const struct is31fl32xx_chipdef *cdef = priv->cdef; in is31fl32xx_init_regs()
299 if (cdef->led_control_register_base != IS31FL32XX_REG_NONE) { in is31fl32xx_init_regs()
301 GENMASK(cdef->enable_bits_per_led_control_register-1, 0); in is31fl32xx_init_regs()
302 u8 num_regs = cdef->channels / in is31fl32xx_init_regs()
303 cdef->enable_bits_per_led_control_register; in is31fl32xx_init_regs()
308 cdef->led_control_register_base+i, in is31fl32xx_init_regs()
319 if (cdef->global_control_reg != IS31FL32XX_REG_NONE) { in is31fl32xx_init_regs()
320 ret = is31fl32xx_write(priv, cdef->global_control_reg, 0x00); in is31fl32xx_init_regs()
332 struct led_classdev *cdev = &led_data->cdev; in is31fl32xx_parse_child_dt()
337 if (ret || reg < 1 || reg > led_data->priv->cdef->channels) { in is31fl32xx_parse_child_dt()
341 return -EINVAL; in is31fl32xx_parse_child_dt()
343 led_data->channel = reg; in is31fl32xx_parse_child_dt()
345 cdev->brightness_set_blocking = is31fl32xx_brightness_set; in is31fl32xx_parse_child_dt()
356 for (i = 0; i < priv->num_leds; i++) { in is31fl32xx_find_led_data()
357 if (priv->leds[i].channel == channel) in is31fl32xx_find_led_data()
358 return &priv->leds[i]; in is31fl32xx_find_led_data()
373 &priv->leds[priv->num_leds]; in is31fl32xx_parse_dt()
376 led_data->priv = priv; in is31fl32xx_parse_dt()
384 led_data->channel); in is31fl32xx_parse_dt()
389 ret = -EINVAL; in is31fl32xx_parse_dt()
395 ret = devm_led_classdev_register_ext(dev, &led_data->cdev, in is31fl32xx_parse_dt()
403 priv->num_leds++; in is31fl32xx_parse_dt()
417 { .compatible = "si-en,sn3218", .data = &is31fl3218_cdef, },
419 { .compatible = "si-en,sn3216", .data = &is31fl3216_cdef, },
429 struct device *dev = &client->dev; in is31fl32xx_probe()
438 return -EINVAL; in is31fl32xx_probe()
443 return -ENOMEM; in is31fl32xx_probe()
445 priv->client = client; in is31fl32xx_probe()
446 priv->cdef = cdef; in is31fl32xx_probe()
467 dev_err(&client->dev, "Failed to reset registers on removal (%pe)\n", in is31fl32xx_remove()
472 * i2c-core (and modalias) requires that id_table be properly filled,