Merge tag 'v6.2-rc3' into next
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 10 Jan 2023 04:28:19 +0000 (20:28 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 10 Jan 2023 04:28:19 +0000 (20:28 -0800)
Merge with mainline to bring in timer_shutdown_sync() API.

1  2 
drivers/input/touchscreen/goodix.c
drivers/input/touchscreen/raydium_i2c_ts.c

index 277a46533564e9e00a075106e9e5b37034bbed8f,8a0a8078de8f7c75fe7681639fc629253d698499..b348172f19c3de1ae79c70b1a1fccfebfacd17db
@@@ -1158,6 -1158,7 +1158,7 @@@ static int goodix_configure_dev(struct 
        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);
  
        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);
@@@ -1390,7 -1401,7 +1401,7 @@@ static void goodix_ts_remove(struct i2c
                wait_for_completion(&ts->firmware_loading_complete);
  }
  
 -static int __maybe_unused goodix_suspend(struct device *dev)
 +static int goodix_suspend(struct device *dev)
  {
        struct i2c_client *client = to_i2c_client(dev);
        struct goodix_ts_data *ts = i2c_get_clientdata(client);
        return 0;
  }
  
 -static int __maybe_unused goodix_resume(struct device *dev)
 +static int goodix_resume(struct device *dev)
  {
        struct i2c_client *client = to_i2c_client(dev);
        struct goodix_ts_data *ts = i2c_get_clientdata(client);
        return 0;
  }
  
 -static SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume);
 +static DEFINE_SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume);
  
  static const struct i2c_device_id goodix_ts_id[] = {
        { "GDIX1001:00", 0 },
@@@ -1532,7 -1543,7 +1543,7 @@@ static struct i2c_driver goodix_ts_driv
                .name = "Goodix-TS",
                .acpi_match_table = ACPI_PTR(goodix_acpi_match),
                .of_match_table = of_match_ptr(goodix_of_match),
 -              .pm = &goodix_pm_ops,
 +              .pm = pm_sleep_ptr(&goodix_pm_ops),
        },
  };
  module_i2c_driver(goodix_ts_driver);
index 1e5e126c117b146ab7990465a6e815c3673154ff,d690a17240c2a285643c160e0405248f65239466..49a06d3876cf9dd7020a8b561ec214df05abc1f9
@@@ -210,12 -210,14 +210,14 @@@ static int raydium_i2c_send(struct i2c_
  
                error = raydium_i2c_xfer(client, addr, xfer, ARRAY_SIZE(xfer));
                if (likely(!error))
-                       return 0;
+                       goto out;
  
                msleep(RM_RETRY_DELAY_MS);
        } while (++tries < RM_MAX_RETRIES);
  
        dev_err(&client->dev, "%s failed: %d\n", __func__, error);
+ out:
+       kfree(tx_buf);
        return error;
  }
  
@@@ -1195,7 -1197,7 +1197,7 @@@ static int raydium_i2c_probe(struct i2c
        return 0;
  }
  
 -static void __maybe_unused raydium_enter_sleep(struct i2c_client *client)
 +static void raydium_enter_sleep(struct i2c_client *client)
  {
        static const u8 sleep_cmd[] = { 0x5A, 0xff, 0x00, 0x0f };
        int error;
                        "sleep command failed: %d\n", error);
  }
  
 -static int __maybe_unused raydium_i2c_suspend(struct device *dev)
 +static int raydium_i2c_suspend(struct device *dev)
  {
        struct i2c_client *client = to_i2c_client(dev);
        struct raydium_data *ts = i2c_get_clientdata(client);
        return 0;
  }
  
 -static int __maybe_unused raydium_i2c_resume(struct device *dev)
 +static int raydium_i2c_resume(struct device *dev)
  {
        struct i2c_client *client = to_i2c_client(dev);
        struct raydium_data *ts = i2c_get_clientdata(client);
        return 0;
  }
  
 -static SIMPLE_DEV_PM_OPS(raydium_i2c_pm_ops,
 -                       raydium_i2c_suspend, raydium_i2c_resume);
 +static DEFINE_SIMPLE_DEV_PM_OPS(raydium_i2c_pm_ops,
 +                              raydium_i2c_suspend, raydium_i2c_resume);
  
  static const struct i2c_device_id raydium_i2c_id[] = {
        { "raydium_i2c", 0 },
@@@ -1275,7 -1277,7 +1277,7 @@@ static struct i2c_driver raydium_i2c_dr
        .id_table = raydium_i2c_id,
        .driver = {
                .name = "raydium_ts",
 -              .pm = &raydium_i2c_pm_ops,
 +              .pm = pm_sleep_ptr(&raydium_i2c_pm_ops),
                .acpi_match_table = ACPI_PTR(raydium_acpi_id),
                .of_match_table = of_match_ptr(raydium_of_match),
        },