Merge branch 'i2c/make_remove_callback_void-immutable' of git://git.kernel.org/pub...
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 17 Aug 2022 19:30:00 +0000 (12:30 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 17 Aug 2022 19:30:00 +0000 (12:30 -0700)
Sync up with the latest I2C code base to get updated prototype of I2C
bus remove() method.

Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
MAINTAINERS
drivers/input/keyboard/applespi.c
drivers/input/keyboard/mt6779-keypad.c
drivers/input/keyboard/tc3589x-keypad.c
drivers/input/mouse/elan_i2c_core.c
include/linux/bma150.h

index 03ebd2665d0781e69ab388fc11e08bd63803f07f..387d0448ff771856b98e186d7e408356d0812142 100644 (file)
@@ -49,6 +49,12 @@ properties:
     maximum: 256
     default: 16
 
+  mediatek,keys-per-group:
+    description: each (row, column) group has multiple keys
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 1
+    maximum: 2
+
 required:
   - compatible
   - reg
@@ -56,7 +62,7 @@ required:
   - clocks
   - clock-names
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
index 8a5012ba6ff98ac6f4a1415b3fce51423329c2d2..2910c5e50ac02365366d5504d6dd0fd3e1795f62 100644 (file)
@@ -12813,6 +12813,12 @@ S:     Supported
 F:     Documentation/devicetree/bindings/media/mediatek-jpeg-*.yaml
 F:     drivers/media/platform/mediatek/jpeg/
 
+MEDIATEK KEYPAD DRIVER
+M:     Mattijs Korpershoek <mkorpershoek@baylibre.com>
+S:     Supported
+F:     Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
+F:     drivers/input/keyboard/mt6779-keypad.c
+
 MEDIATEK MDP DRIVER
 M:     Minghsiu Tsai <minghsiu.tsai@mediatek.com>
 M:     Houlong Wei <houlong.wei@mediatek.com>
index cbc6c0d4670a2b26a9b5f75f018a7904a872b79a..fab5473ae5dac689574dbfae9b378699a1b5bc42 100644 (file)
@@ -202,7 +202,7 @@ struct command_protocol_tp_info {
 };
 
 /**
- * struct touchpad_info - touchpad info response.
+ * struct touchpad_info_protocol - touchpad info response.
  * message.type = 0x1020, message.length = 0x006e
  *
  * @unknown1:          unknown
index bf447bf598fbc826532e99b41153da6542b725f9..a05e70af1fd03069ab6e5b955e2109b4be2a1134 100644 (file)
@@ -18,6 +18,7 @@
 #define MTK_KPD_DEBOUNCE_MASK  GENMASK(13, 0)
 #define MTK_KPD_DEBOUNCE_MAX_MS        256
 #define MTK_KPD_SEL            0x0020
+#define MTK_KPD_SEL_DOUBLE_KP_MODE     BIT(0)
 #define MTK_KPD_SEL_COL        GENMASK(15, 10)
 #define MTK_KPD_SEL_ROW        GENMASK(9, 4)
 #define MTK_KPD_SEL_COLMASK(c) GENMASK((c) + 9, 10)
@@ -31,6 +32,8 @@ struct mt6779_keypad {
        struct clk *clk;
        u32 n_rows;
        u32 n_cols;
+       void (*calc_row_col)(unsigned int key,
+                            unsigned int *row, unsigned int *col);
        DECLARE_BITMAP(keymap_state, MTK_KPD_NUM_BITS);
 };
 
@@ -67,8 +70,7 @@ static irqreturn_t mt6779_keypad_irq_handler(int irq, void *dev_id)
                        continue;
 
                key = bit_nr / 32 * 16 + bit_nr % 32;
-               row = key / 9;
-               col = key % 9;
+               keypad->calc_row_col(key, &row, &col);
 
                scancode = MATRIX_SCAN_CODE(row, col, row_shift);
                /* 1: not pressed, 0: pressed */
@@ -94,12 +96,29 @@ static void mt6779_keypad_clk_disable(void *data)
        clk_disable_unprepare(data);
 }
 
+static void mt6779_keypad_calc_row_col_single(unsigned int key,
+                                             unsigned int *row,
+                                             unsigned int *col)
+{
+       *row = key / 9;
+       *col = key % 9;
+}
+
+static void mt6779_keypad_calc_row_col_double(unsigned int key,
+                                             unsigned int *row,
+                                             unsigned int *col)
+{
+       *row = key / 13;
+       *col = (key % 13) / 2;
+}
+
 static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
 {
        struct mt6779_keypad *keypad;
        void __iomem *base;
        int irq;
        u32 debounce;
+       u32 keys_per_group;
        bool wakeup;
        int error;
 
@@ -148,6 +167,23 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
+       if (device_property_read_u32(&pdev->dev, "mediatek,keys-per-group",
+                                    &keys_per_group))
+               keys_per_group = 1;
+
+       switch (keys_per_group) {
+       case 1:
+               keypad->calc_row_col = mt6779_keypad_calc_row_col_single;
+               break;
+       case 2:
+               keypad->calc_row_col = mt6779_keypad_calc_row_col_double;
+               break;
+       default:
+               dev_err(&pdev->dev,
+                       "Invalid keys-per-group: %d\n", keys_per_group);
+               return -EINVAL;
+       }
+
        wakeup = device_property_read_bool(&pdev->dev, "wakeup-source");
 
        dev_dbg(&pdev->dev, "n_row=%d n_col=%d debounce=%d\n",
@@ -166,6 +202,11 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
        regmap_write(keypad->regmap, MTK_KPD_DEBOUNCE,
                     (debounce * (1 << 5)) & MTK_KPD_DEBOUNCE_MASK);
 
+       if (keys_per_group == 2)
+               regmap_update_bits(keypad->regmap, MTK_KPD_SEL,
+                                  MTK_KPD_SEL_DOUBLE_KP_MODE,
+                                  MTK_KPD_SEL_DOUBLE_KP_MODE);
+
        regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_ROW,
                           MTK_KPD_SEL_ROWMASK(keypad->n_rows));
        regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_COL,
index 89b9575dc75dc1900cc68c59689b0ec1f21f1216..78e55318ccd63b1977cf50b2bc548a3fc5e10881 100644 (file)
@@ -70,7 +70,7 @@
 #define TC3589x_KBD_INT_CLR    0x1
 
 /**
- * struct tc35893_keypad_platform_data - platform specific keypad data
+ * struct tc3589x_keypad_platform_data - platform specific keypad data
  * @keymap_data:        matrix scan code table for keycodes
  * @krow:               mask for available rows, value is 0xFF
  * @kcol:               mask for available columns, value is 0xFF
index e1758d5ffe421831f64a198daa5db33e920c3033..d4eb59b55bf1fdf69eba7e249e8b65a222553af5 100644 (file)
@@ -1311,12 +1311,6 @@ static int elan_probe(struct i2c_client *client,
                return error;
        }
 
-       error = devm_device_add_groups(dev, elan_sysfs_groups);
-       if (error) {
-               dev_err(dev, "failed to create sysfs attributes: %d\n", error);
-               return error;
-       }
-
        error = input_register_device(data->input);
        if (error) {
                dev_err(dev, "failed to register input device: %d\n", error);
@@ -1442,6 +1436,7 @@ static struct i2c_driver elan_driver = {
                .acpi_match_table = ACPI_PTR(elan_acpi_id),
                .of_match_table = of_match_ptr(elan_of_match),
                .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+               .dev_groups = elan_sysfs_groups,
        },
        .probe          = elan_probe,
        .id_table       = elan_id,
index 31c9e323a3913d76bb6e986e86a268c8a5d2d209..4d4a62d493419486002d3a799c3b59039618f2ac 100644 (file)
@@ -33,8 +33,8 @@ struct bma150_cfg {
        unsigned char lg_hyst;          /* Low-G hysterisis */
        unsigned char lg_dur;           /* Low-G duration */
        unsigned char lg_thres;         /* Low-G threshold */
-       unsigned char range;            /* one of BMA0150_RANGE_xxx */
-       unsigned char bandwidth;        /* one of BMA0150_BW_xxx */
+       unsigned char range;            /* one of BMA150_RANGE_xxx */
+       unsigned char bandwidth;        /* one of BMA150_BW_xxx */
 };
 
 struct bma150_platform_data {