Merge branch 'next' into for-linus
[linux-block.git] / drivers / input / touchscreen / goodix.c
index 7e3e86617548d83539a91616638268d2bb9aa6d8..8a0a8078de8f7c75fe7681639fc629253d698499 100644 (file)
@@ -1158,6 +1158,7 @@ static int goodix_configure_dev(struct goodix_ts_data *ts)
        input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
        input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
 
+retry_read_config:
        /* Read configuration and apply touchscreen parameters */
        goodix_read_config(ts);
 
@@ -1165,6 +1166,16 @@ static int goodix_configure_dev(struct goodix_ts_data *ts)
        touchscreen_parse_properties(ts->input_dev, true, &ts->prop);
 
        if (!ts->prop.max_x || !ts->prop.max_y || !ts->max_touch_num) {
+               if (!ts->reset_controller_at_probe &&
+                   ts->irq_pin_access_method != IRQ_PIN_ACCESS_NONE) {
+                       dev_info(&ts->client->dev, "Config not set, resetting controller\n");
+                       /* Retry after a controller reset */
+                       ts->reset_controller_at_probe = true;
+                       error = goodix_reset(ts);
+                       if (error)
+                               return error;
+                       goto retry_read_config;
+               }
                dev_err(&ts->client->dev,
                        "Invalid config (%d, %d, %d), using defaults\n",
                        ts->prop.max_x, ts->prop.max_y, ts->max_touch_num);