Lines Matching +full:bl +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-only
22 * @name : Backlight driver name (NULL will use default)
33 const char *name; member
48 #define ARCXCNN_CMD_OVP_MASK 0x0C /* --- Over Voltage Threshold */
63 #define ARCXCNN_LEDEN_ISETEXT 0x80 /* Full-scale current set extern */
89 struct backlight_device *bl; member
99 ret = i2c_smbus_read_byte_data(lp->client, reg); in arcxcnn_update_field()
101 dev_err(lp->dev, "failed to read 0x%.2x\n", reg); in arcxcnn_update_field()
109 return i2c_smbus_write_byte_data(lp->client, reg, tmp); in arcxcnn_update_field()
119 ret = i2c_smbus_write_byte_data(lp->client, in arcxcnn_set_brightness()
126 return i2c_smbus_write_byte_data(lp->client, in arcxcnn_set_brightness()
130 static int arcxcnn_bl_update_status(struct backlight_device *bl) in arcxcnn_bl_update_status() argument
132 struct arcxcnn *lp = bl_get_data(bl); in arcxcnn_bl_update_status()
133 u32 brightness = backlight_get_brightness(bl); in arcxcnn_bl_update_status()
140 /* set power-on/off/save modes */ in arcxcnn_bl_update_status()
142 (bl->props.power == 0) ? 0 : ARCXCNN_CMD_STDBY); in arcxcnn_bl_update_status()
153 const char *name = lp->pdata->name ? : "arctic_bl"; in arcxcnn_backlight_register() local
155 props = devm_kzalloc(lp->dev, sizeof(*props), GFP_KERNEL); in arcxcnn_backlight_register()
157 return -ENOMEM; in arcxcnn_backlight_register()
159 props->type = BACKLIGHT_PLATFORM; in arcxcnn_backlight_register()
160 props->max_brightness = MAX_BRIGHTNESS; in arcxcnn_backlight_register()
162 if (lp->pdata->initial_brightness > props->max_brightness) in arcxcnn_backlight_register()
163 lp->pdata->initial_brightness = props->max_brightness; in arcxcnn_backlight_register()
165 props->brightness = lp->pdata->initial_brightness; in arcxcnn_backlight_register()
167 lp->bl = devm_backlight_device_register(lp->dev, name, lp->dev, lp, in arcxcnn_backlight_register()
169 return PTR_ERR_OR_ZERO(lp->bl); in arcxcnn_backlight_register()
174 struct device *dev = lp->dev; in arcxcnn_parse_dt()
175 struct device_node *node = dev->of_node; in arcxcnn_parse_dt()
183 ret = of_property_read_string(node, "label", &lp->pdata->name); in arcxcnn_parse_dt()
185 lp->pdata->name = NULL; in arcxcnn_parse_dt()
187 ret = of_property_read_u32(node, "default-brightness", &prog_val); in arcxcnn_parse_dt()
189 lp->pdata->initial_brightness = prog_val; in arcxcnn_parse_dt()
191 ret = of_property_read_u32(node, "arc,led-config-0", &prog_val); in arcxcnn_parse_dt()
193 lp->pdata->led_config_0 = (u8)prog_val; in arcxcnn_parse_dt()
195 ret = of_property_read_u32(node, "arc,led-config-1", &prog_val); in arcxcnn_parse_dt()
197 lp->pdata->led_config_1 = (u8)prog_val; in arcxcnn_parse_dt()
199 ret = of_property_read_u32(node, "arc,dim-freq", &prog_val); in arcxcnn_parse_dt()
201 lp->pdata->dim_freq = (u8)prog_val; in arcxcnn_parse_dt()
203 ret = of_property_read_u32(node, "arc,comp-config", &prog_val); in arcxcnn_parse_dt()
205 lp->pdata->comp_config = (u8)prog_val; in arcxcnn_parse_dt()
207 ret = of_property_read_u32(node, "arc,filter-config", &prog_val); in arcxcnn_parse_dt()
209 lp->pdata->filter_config = (u8)prog_val; in arcxcnn_parse_dt()
211 ret = of_property_read_u32(node, "arc,trim-config", &prog_val); in arcxcnn_parse_dt()
213 lp->pdata->trim_config = (u8)prog_val; in arcxcnn_parse_dt()
215 ret = of_property_count_u32_elems(node, "led-sources"); in arcxcnn_parse_dt()
217 lp->pdata->leden = ARCXCNN_LEDEN_MASK; /* all on is default */ in arcxcnn_parse_dt()
223 ret = of_property_read_u32_array(node, "led-sources", sources, in arcxcnn_parse_dt()
226 dev_err(dev, "led-sources node is invalid.\n"); in arcxcnn_parse_dt()
230 lp->pdata->leden = 0; in arcxcnn_parse_dt()
236 lp->pdata->leden |= onbit; in arcxcnn_parse_dt()
246 if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) in arcxcnn_probe()
247 return -EIO; in arcxcnn_probe()
249 lp = devm_kzalloc(&cl->dev, sizeof(*lp), GFP_KERNEL); in arcxcnn_probe()
251 return -ENOMEM; in arcxcnn_probe()
253 lp->client = cl; in arcxcnn_probe()
254 lp->dev = &cl->dev; in arcxcnn_probe()
255 lp->pdata = dev_get_platdata(&cl->dev); in arcxcnn_probe()
258 ret = i2c_smbus_write_byte_data(lp->client, in arcxcnn_probe()
263 if (!lp->pdata) { in arcxcnn_probe()
264 lp->pdata = devm_kzalloc(lp->dev, in arcxcnn_probe()
265 sizeof(*lp->pdata), GFP_KERNEL); in arcxcnn_probe()
266 if (!lp->pdata) in arcxcnn_probe()
267 return -ENOMEM; in arcxcnn_probe()
269 /* Setup defaults based on power-on defaults */ in arcxcnn_probe()
270 lp->pdata->name = NULL; in arcxcnn_probe()
271 lp->pdata->initial_brightness = INIT_BRIGHT; in arcxcnn_probe()
272 lp->pdata->leden = ARCXCNN_LEDEN_MASK; in arcxcnn_probe()
274 lp->pdata->led_config_0 = i2c_smbus_read_byte_data( in arcxcnn_probe()
275 lp->client, ARCXCNN_FADECTRL); in arcxcnn_probe()
277 lp->pdata->led_config_1 = i2c_smbus_read_byte_data( in arcxcnn_probe()
278 lp->client, ARCXCNN_ILED_CONFIG); in arcxcnn_probe()
280 lp->pdata->led_config_1 |= ARCXCNN_ILED_DIM_INT; in arcxcnn_probe()
282 lp->pdata->dim_freq = i2c_smbus_read_byte_data( in arcxcnn_probe()
283 lp->client, ARCXCNN_DIMFREQ); in arcxcnn_probe()
285 lp->pdata->comp_config = i2c_smbus_read_byte_data( in arcxcnn_probe()
286 lp->client, ARCXCNN_COMP_CONFIG); in arcxcnn_probe()
288 lp->pdata->filter_config = i2c_smbus_read_byte_data( in arcxcnn_probe()
289 lp->client, ARCXCNN_FILT_CONFIG); in arcxcnn_probe()
291 lp->pdata->trim_config = i2c_smbus_read_byte_data( in arcxcnn_probe()
292 lp->client, ARCXCNN_IMAXTUNE); in arcxcnn_probe()
301 if (lp->pdata->initial_brightness > MAX_BRIGHTNESS) in arcxcnn_probe()
302 lp->pdata->initial_brightness = MAX_BRIGHTNESS; in arcxcnn_probe()
305 ret = arcxcnn_set_brightness(lp, lp->pdata->initial_brightness); in arcxcnn_probe()
310 ret = i2c_smbus_write_byte_data(lp->client, ARCXCNN_FADECTRL, in arcxcnn_probe()
311 lp->pdata->led_config_0); in arcxcnn_probe()
315 ret = i2c_smbus_write_byte_data(lp->client, ARCXCNN_ILED_CONFIG, in arcxcnn_probe()
316 lp->pdata->led_config_1); in arcxcnn_probe()
320 ret = i2c_smbus_write_byte_data(lp->client, ARCXCNN_DIMFREQ, in arcxcnn_probe()
321 lp->pdata->dim_freq); in arcxcnn_probe()
325 ret = i2c_smbus_write_byte_data(lp->client, ARCXCNN_COMP_CONFIG, in arcxcnn_probe()
326 lp->pdata->comp_config); in arcxcnn_probe()
330 ret = i2c_smbus_write_byte_data(lp->client, ARCXCNN_FILT_CONFIG, in arcxcnn_probe()
331 lp->pdata->filter_config); in arcxcnn_probe()
335 ret = i2c_smbus_write_byte_data(lp->client, ARCXCNN_IMAXTUNE, in arcxcnn_probe()
336 lp->pdata->trim_config); in arcxcnn_probe()
342 ARCXCNN_LEDEN_MASK, lp->pdata->leden); in arcxcnn_probe()
348 backlight_update_status(lp->bl); in arcxcnn_probe()
353 dev_err(lp->dev, in arcxcnn_probe()
357 dev_err(lp->dev, in arcxcnn_probe()
367 i2c_smbus_write_byte_data(lp->client, in arcxcnn_remove()
370 i2c_smbus_write_byte_data(lp->client, in arcxcnn_remove()
373 lp->bl->props.brightness = 0; in arcxcnn_remove()
375 backlight_update_status(lp->bl); in arcxcnn_remove()
392 .name = "arcxcnn_bl",