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->dev || bd->pdata->dev == info->device; in bd6107_backlight_check_fb()
118 struct bd6107_platform_data *pdata = dev_get_platdata(&client->dev); in bd6107_probe()
119 struct backlight_device *backlight; in bd6107_probe() local
125 dev_err(&client->dev, "No platform data\n"); in bd6107_probe()
126 return -EINVAL; in bd6107_probe()
129 if (!i2c_check_functionality(client->adapter, in bd6107_probe()
131 dev_warn(&client->dev, in bd6107_probe()
133 return -EIO; in bd6107_probe()
136 bd = devm_kzalloc(&client->dev, sizeof(*bd), GFP_KERNEL); in bd6107_probe()
138 return -ENOMEM; in bd6107_probe()
140 bd->client = client; in bd6107_probe()
141 bd->pdata = pdata; in bd6107_probe()
144 * Request the reset GPIO line with GPIOD_OUT_HIGH meaning asserted, in bd6107_probe()
149 bd->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); in bd6107_probe()
150 if (IS_ERR(bd->reset)) { in bd6107_probe()
151 dev_err(&client->dev, "unable to request reset GPIO\n"); in bd6107_probe()
152 ret = PTR_ERR(bd->reset); in bd6107_probe()
159 props.brightness = clamp_t(unsigned int, pdata->def_value, 0, in bd6107_probe()
162 backlight = devm_backlight_device_register(&client->dev, in bd6107_probe()
163 dev_name(&client->dev), in bd6107_probe()
164 &bd->client->dev, bd, in bd6107_probe()
166 if (IS_ERR(backlight)) { in bd6107_probe()
167 dev_err(&client->dev, "failed to register backlight\n"); in bd6107_probe()
168 return PTR_ERR(backlight); in bd6107_probe()
171 backlight_update_status(backlight); in bd6107_probe()
172 i2c_set_clientdata(client, backlight); in bd6107_probe()
179 struct backlight_device *backlight = i2c_get_clientdata(client); in bd6107_remove() local
181 backlight->props.brightness = 0; in bd6107_remove()
182 backlight_update_status(backlight); in bd6107_remove()
202 MODULE_DESCRIPTION("Rohm BD6107 Backlight Driver");