Lines Matching +full:gpio +full:- +full:backlight
1 // SPDX-License-Identifier: GPL-2.0-only
10 #include <linux/backlight.h>
14 #include <linux/gpio/consumer.h>
72 struct backlight_device *backlight; member
79 return i2c_smbus_write_byte_data(bd->client, reg, data); in bd6107_write()
82 static int bd6107_backlight_update_status(struct backlight_device *backlight) in bd6107_backlight_update_status() argument
84 struct bd6107 *bd = bl_get_data(backlight); in bd6107_backlight_update_status()
85 int brightness = backlight_get_brightness(backlight); in bd6107_backlight_update_status()
94 gpiod_set_value(bd->reset, 1); in bd6107_backlight_update_status()
96 gpiod_set_value(bd->reset, 0); in bd6107_backlight_update_status()
102 static int bd6107_backlight_check_fb(struct backlight_device *backlight, in bd6107_backlight_check_fb() argument
105 struct bd6107 *bd = bl_get_data(backlight); in bd6107_backlight_check_fb()
107 return bd->pdata->fbdev == NULL || bd->pdata->fbdev == info->dev; in bd6107_backlight_check_fb()
119 struct bd6107_platform_data *pdata = dev_get_platdata(&client->dev); in bd6107_probe()
120 struct backlight_device *backlight; in bd6107_probe() local
126 dev_err(&client->dev, "No platform data\n"); in bd6107_probe()
127 return -EINVAL; in bd6107_probe()
130 if (!i2c_check_functionality(client->adapter, in bd6107_probe()
132 dev_warn(&client->dev, in bd6107_probe()
134 return -EIO; in bd6107_probe()
137 bd = devm_kzalloc(&client->dev, sizeof(*bd), GFP_KERNEL); in bd6107_probe()
139 return -ENOMEM; in bd6107_probe()
141 bd->client = client; in bd6107_probe()
142 bd->pdata = pdata; in bd6107_probe()
145 * Request the reset GPIO line with GPIOD_OUT_HIGH meaning asserted, in bd6107_probe()
150 bd->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); in bd6107_probe()
151 if (IS_ERR(bd->reset)) { in bd6107_probe()
152 dev_err(&client->dev, "unable to request reset GPIO\n"); in bd6107_probe()
153 ret = PTR_ERR(bd->reset); in bd6107_probe()
160 props.brightness = clamp_t(unsigned int, pdata->def_value, 0, in bd6107_probe()
163 backlight = devm_backlight_device_register(&client->dev, in bd6107_probe()
164 dev_name(&client->dev), in bd6107_probe()
165 &bd->client->dev, bd, in bd6107_probe()
167 if (IS_ERR(backlight)) { in bd6107_probe()
168 dev_err(&client->dev, "failed to register backlight\n"); in bd6107_probe()
169 return PTR_ERR(backlight); in bd6107_probe()
172 backlight_update_status(backlight); in bd6107_probe()
173 i2c_set_clientdata(client, backlight); in bd6107_probe()
180 struct backlight_device *backlight = i2c_get_clientdata(client); in bd6107_remove() local
182 backlight->props.brightness = 0; in bd6107_remove()
183 backlight_update_status(backlight); in bd6107_remove()
205 MODULE_DESCRIPTION("Rohm BD6107 Backlight Driver");