To inform to userspace as enable usb features always, set extcon
state for usb cable as connected permanently. To enable this, add
"g-extcon-always-on" property on dt.
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
[mszyprow: ported and adapted to v6.6 kernel release]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib0e9982b426fda7deed510e482d6731a2f23d0b1
u32 g_rx_fifo_size;
u32 g_np_tx_fifo_size;
u32 g_tx_fifo_size[MAX_EPS_CHANNELS];
u32 g_rx_fifo_size;
u32 g_np_tx_fifo_size;
u32 g_tx_fifo_size[MAX_EPS_CHANNELS];
+#if IS_ENABLED(CONFIG_EXTCON)
+ bool g_extcon_always_on;
+#endif
bool change_speed_quirk;
};
bool change_speed_quirk;
};
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/slab.h>
+#include <linux/extcon-provider.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
+#if IS_ENABLED(CONFIG_EXTCON)
+ if (hsotg->params.g_extcon_always_on) {
+ struct extcon_dev *edev;
+ static const unsigned int supported_cable[] = {
+ EXTCON_USB,
+ EXTCON_NONE,
+ };
+
+ edev = devm_extcon_dev_allocate(dev, supported_cable);
+ if (IS_ERR(edev))
+ return PTR_ERR(edev);
+
+ ret = devm_extcon_dev_register(dev, edev);
+ if (ret)
+ return ret;
+
+ extcon_set_state_sync(edev, EXTCON_USB, true);
+ }
+#endif
&p->g_np_tx_fifo_size);
num = device_property_count_u32(hsotg->dev, "g-tx-fifo-size");
&p->g_np_tx_fifo_size);
num = device_property_count_u32(hsotg->dev, "g-tx-fifo-size");
+#if IS_ENABLED(CONFIG_EXTCON)
+ if (of_find_property(hsotg->dev->of_node,
+ "g-extcon-always-on", NULL))
+ p->g_extcon_always_on = 1;
+#endif
if (num > 0) {
num = min(num, 15);
memset(p->g_tx_fifo_size, 0,
if (num > 0) {
num = min(num, 15);
memset(p->g_tx_fifo_size, 0,