@@ -104,6 +104,7 @@ static int rpi_panel_v2_i2c_probe(struct i2c_client *i2c)
104
104
return - ENOMEM ;
105
105
106
106
mutex_init (& state -> lock );
107
+ i2c_set_clientdata (i2c , state );
107
108
108
109
regmap = devm_regmap_init_i2c (i2c , & rpi_panel_regmap_config );
109
110
if (IS_ERR (regmap )) {
@@ -168,6 +169,21 @@ static int rpi_panel_v2_i2c_probe(struct i2c_client *i2c)
168
169
return ret ;
169
170
}
170
171
172
+ static void rpi_panel_v2_i2c_remove (struct i2c_client * client )
173
+ {
174
+ struct rpi_panel_v2_lcd * state = i2c_get_clientdata (client );
175
+
176
+ mutex_destroy (& state -> lock );
177
+ }
178
+
179
+ static void rpi_panel_v2_i2c_shutdown (struct i2c_client * client )
180
+ {
181
+ struct rpi_panel_v2_lcd * state = i2c_get_clientdata (client );
182
+
183
+ regmap_write (state -> regmap , REG_PWM , 0 );
184
+ regmap_write (state -> regmap , REG_POWERON , 0 );
185
+ }
186
+
171
187
static const struct of_device_id rpi_panel_v2_dt_ids [] = {
172
188
{ .compatible = "raspberrypi,v2-touchscreen-panel-regulator" },
173
189
{},
@@ -180,6 +196,8 @@ static struct i2c_driver rpi_panel_v2_regulator_driver = {
180
196
.of_match_table = of_match_ptr (rpi_panel_v2_dt_ids ),
181
197
},
182
198
.probe = rpi_panel_v2_i2c_probe ,
199
+ .remove = rpi_panel_v2_i2c_remove ,
200
+ .shutdown = rpi_panel_v2_i2c_shutdown ,
183
201
};
184
202
185
203
module_i2c_driver (rpi_panel_v2_regulator_driver );
0 commit comments