Lines Matching +full:nxp +full:- +full:i

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Copyright 2022 NXP
23 /* Auto-increment disabled. Normal mode */
81 struct pca995x_chip *chip = led->chip; in pca995x_brightness_set()
82 const struct pca995x_chipdef *chipdef = chip->chipdef; in pca995x_brightness_set()
86 pwmout_addr = chipdef->pwm_base + led->led_no; in pca995x_brightness_set()
87 ledout_addr = PCA995X_LEDOUT0 + (led->led_no / PCA995X_OUTPUTS_PER_REG); in pca995x_brightness_set()
88 shift = PCA995X_LDRX_BITS * (led->led_no % PCA995X_OUTPUTS_PER_REG); in pca995x_brightness_set()
92 return regmap_update_bits(chip->regmap, ledout_addr, in pca995x_brightness_set()
96 return regmap_update_bits(chip->regmap, ledout_addr, in pca995x_brightness_set()
100 ret = regmap_write(chip->regmap, pwmout_addr, brightness); in pca995x_brightness_set()
108 return regmap_update_bits(chip->regmap, ledout_addr, in pca995x_brightness_set()
123 struct device *dev = &client->dev; in pca995x_probe()
127 int i, j, reg, ret; in pca995x_probe() local
129 chipdef = device_get_match_data(&client->dev); in pca995x_probe()
132 return -ENODEV; in pca995x_probe()
136 return -ENOMEM; in pca995x_probe()
138 chip->chipdef = chipdef; in pca995x_probe()
139 chip->regmap = devm_regmap_init_i2c(client, &pca995x_regmap); in pca995x_probe()
140 if (IS_ERR(chip->regmap)) in pca995x_probe()
141 return PTR_ERR(chip->regmap); in pca995x_probe()
151 return -EINVAL; in pca995x_probe()
153 led = &chip->leds[reg]; in pca995x_probe()
155 led->chip = chip; in pca995x_probe()
156 led->led_no = reg; in pca995x_probe()
157 led->ldev.brightness_set_blocking = pca995x_brightness_set; in pca995x_probe()
158 led->ldev.max_brightness = 255; in pca995x_probe()
161 for (i = 0; i < PCA995X_MAX_OUTPUTS; i++) { in pca995x_probe()
164 if (!led_fwnodes[i]) in pca995x_probe()
167 init_data.fwnode = led_fwnodes[i]; in pca995x_probe()
170 &chip->leds[i].ldev, in pca995x_probe()
173 for (j = i; j < PCA995X_MAX_OUTPUTS; j++) in pca995x_probe()
177 chip->leds[i].ldev.name); in pca995x_probe()
181 /* Disable LED all-call address and set normal mode */ in pca995x_probe()
182 ret = regmap_write(chip->regmap, PCA995X_MODE1, PCA995X_MODE1_CFG); in pca995x_probe()
187 return regmap_write(chip->regmap, chipdef->irefall, PCA995X_IREFALL_HALF_CFG); in pca995x_probe()
199 { .compatible = "nxp,pca9952", .data = &pca9952_chipdef },
200 { .compatible = "nxp,pca9955b", . data = &pca9955b_chipdef },
201 { .compatible = "nxp,pca9956b", .data = &pca9956b_chipdef },
208 .name = "leds-pca995x",
216 MODULE_AUTHOR("Isai Gaspar <isaiezequiel.gaspar@nxp.com>");