Say Y here to enable support for external accessory detection
on Cirrus Logic Madera class codecs.
+config EXTCON_MADERA_INPUT_EVENT
+ bool "Report events through input key events"
+ depends on EXTCON_MADERA
+ default n
+ help
+ Say Y here to enable support for reporting external accessory
+ detection events through input key events on Cirrus Logic Madera
+ class codecs.
+
config EXTCON_MAX14577
tristate "Maxim MAX14577/77836 EXTCON Support"
depends on MFD_MAX14577
int ret;
dev_dbg(info->dev, "Extcon report: %d is %s\n",
- which,
- attached ? "attached" : "removed");
+ which, attached ? "attached" : "removed");
ret = extcon_set_state_sync(info->edev, which, attached);
if (ret != 0)
- dev_warn(info->dev,
- "Failed to report cable state: %d\n",
- ret);
+ dev_warn(info->dev, "Failed to report cable state: %d\n", ret);
+
+ if (IS_ENABLED(CONFIG_EXTCON_MADERA_INPUT_EVENT)) {
+ switch (which) {
+ case EXTCON_MECHANICAL:
+ input_report_switch(info->input,
+ SW_JACK_PHYSICAL_INSERT,
+ attached);
+ break;
+ case EXTCON_JACK_HEADPHONE:
+ input_report_switch(info->input,
+ SW_HEADPHONE_INSERT,
+ attached);
+ break;
+ case EXTCON_JACK_MICROPHONE:
+ input_report_switch(info->input,
+ SW_MICROPHONE_INSERT,
+ attached);
+ break;
+ }
+
+ input_sync(info->input);
+ }
}
EXPORT_SYMBOL_GPL(madera_extcon_report);
pm_runtime_put(&pdev->dev);
+ if (IS_ENABLED(CONFIG_EXTCON_MADERA_INPUT_EVENT)) {
+ input_set_capability(info->input,
+ EV_SW,
+ SW_MICROPHONE_INSERT);
+ input_set_capability(info->input,
+ EV_SW,
+ SW_HEADPHONE_INSERT);
+ input_set_capability(info->input,
+ EV_SW,
+ SW_JACK_PHYSICAL_INSERT);
+ }
+
ret = input_register_device(info->input);
if (ret) {
dev_err(&pdev->dev, "Can't register input device: %d\n", ret);