Lines Matching +full:gpio +full:- +full:backlight
1 // SPDX-License-Identifier: GPL-2.0-only
10 #include <linux/backlight.h>
13 #include <linux/gpio/consumer.h>
71 struct backlight_device *backlight; member
78 return i2c_smbus_write_byte_data(bd->client, reg, data); in bd6107_write()
81 static int bd6107_backlight_update_status(struct backlight_device *backlight) in bd6107_backlight_update_status() argument
83 struct bd6107 *bd = bl_get_data(backlight); in bd6107_backlight_update_status()
84 int brightness = backlight_get_brightness(backlight); in bd6107_backlight_update_status()
93 gpiod_set_value(bd->reset, 1); in bd6107_backlight_update_status()
95 gpiod_set_value(bd->reset, 0); in bd6107_backlight_update_status()
101 static bool bd6107_backlight_controls_device(struct backlight_device *backlight, in bd6107_backlight_controls_device() argument
104 struct bd6107 *bd = bl_get_data(backlight); in bd6107_backlight_controls_device()
106 return !bd->pdata->dev || bd->pdata->dev == display_dev; in bd6107_backlight_controls_device()
117 struct bd6107_platform_data *pdata = dev_get_platdata(&client->dev); in bd6107_probe()
118 struct backlight_device *backlight; in bd6107_probe() local
123 dev_err(&client->dev, "No platform data\n"); in bd6107_probe()
124 return -EINVAL; in bd6107_probe()
127 if (!i2c_check_functionality(client->adapter, in bd6107_probe()
129 dev_warn(&client->dev, in bd6107_probe()
131 return -EIO; in bd6107_probe()
134 bd = devm_kzalloc(&client->dev, sizeof(*bd), GFP_KERNEL); in bd6107_probe()
136 return -ENOMEM; in bd6107_probe()
138 bd->client = client; in bd6107_probe()
139 bd->pdata = pdata; in bd6107_probe()
142 * Request the reset GPIO line with GPIOD_OUT_HIGH meaning asserted, in bd6107_probe()
147 bd->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); in bd6107_probe()
148 if (IS_ERR(bd->reset)) in bd6107_probe()
149 return dev_err_probe(&client->dev, PTR_ERR(bd->reset), in bd6107_probe()
150 "unable to request reset GPIO\n"); in bd6107_probe()
155 props.brightness = clamp_t(unsigned int, pdata->def_value, 0, in bd6107_probe()
158 backlight = devm_backlight_device_register(&client->dev, in bd6107_probe()
159 dev_name(&client->dev), in bd6107_probe()
160 &bd->client->dev, bd, in bd6107_probe()
162 if (IS_ERR(backlight)) { in bd6107_probe()
163 dev_err(&client->dev, "failed to register backlight\n"); in bd6107_probe()
164 return PTR_ERR(backlight); in bd6107_probe()
167 backlight_update_status(backlight); in bd6107_probe()
168 i2c_set_clientdata(client, backlight); in bd6107_probe()
175 struct backlight_device *backlight = i2c_get_clientdata(client); in bd6107_remove() local
177 backlight->props.brightness = 0; in bd6107_remove()
178 backlight_update_status(backlight); in bd6107_remove()
198 MODULE_DESCRIPTION("Rohm BD6107 Backlight Driver");