All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 0/4] extcon: sm5502: Clean up coding style and fix bug
@ 2014-08-14  0:20 Chanwoo Choi
  2014-08-14  0:20 ` [PATCHv2 1/4] extcon: sm5502: Move sm5502.h header file to extcon directory Chanwoo Choi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chanwoo Choi @ 2014-08-14  0:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: myungjoo.ham, kyungmin.park, Chanwoo Choi

This patch clean up coding style for extcon-sm5502 driver and fix wrong mask
operation to get cable_type value.

Changes from v1:
- Split previous patch as two patch(patch1 and patch2)
- Add I2C dependency to protect build brak when I2C=m

Chanwoo Choi (4):
  extcon: sm5502: Move sm5502.h header file to extcon directory
  extcon: sm5502: Fix bug to check cable type
  extcon: sm5502: Clean up codes by using checkpatch script
  extcon: sm5502: Add I2C dependency to fix build break

 drivers/extcon/Kconfig         |   1 +
 drivers/extcon/extcon-sm5502.c |  19 +--
 drivers/extcon/extcon-sm5502.h | 282 ++++++++++++++++++++++++++++++++++++++++
 include/linux/extcon/sm5502.h  | 287 -----------------------------------------
 4 files changed, 290 insertions(+), 299 deletions(-)
 create mode 100644 drivers/extcon/extcon-sm5502.h
 delete mode 100644 include/linux/extcon/sm5502.h

-- 
1.8.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2 1/4] extcon: sm5502: Move sm5502.h header file to extcon directory
  2014-08-14  0:20 [PATCHv2 0/4] extcon: sm5502: Clean up coding style and fix bug Chanwoo Choi
@ 2014-08-14  0:20 ` Chanwoo Choi
  2014-08-14  0:20 ` [PATCHv2 2/4] extcon: sm5502: Fix bug to check cable type Chanwoo Choi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2014-08-14  0:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: myungjoo.ham, kyungmin.park, Chanwoo Choi

This patch move sm5502.h header file from 'include/linux/extcon' to
'driver/extcon' because sm5502.h is used for driver/extcon/extcon-sm5502.c.
and remove duplicate license description.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-sm5502.c |   8 +-
 drivers/extcon/extcon-sm5502.h | 282 ++++++++++++++++++++++++++++++++++++++++
 include/linux/extcon/sm5502.h  | 287 -----------------------------------------
 3 files changed, 284 insertions(+), 293 deletions(-)
 create mode 100644 drivers/extcon/extcon-sm5502.h
 delete mode 100644 include/linux/extcon/sm5502.h

diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
index 560d7dc..aab630e 100644
--- a/drivers/extcon/extcon-sm5502.c
+++ b/drivers/extcon/extcon-sm5502.c
@@ -8,11 +8,6 @@
  * under  the terms of  the GNU General  Public License as published by the
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/err.h>
@@ -26,7 +21,8 @@
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/extcon.h>
-#include <linux/extcon/sm5502.h>
+
+#include "extcon-sm5502.h"
 
 #define	DELAY_MS_DEFAULT		17000	/* unit: millisecond */
 
diff --git a/drivers/extcon/extcon-sm5502.h b/drivers/extcon/extcon-sm5502.h
new file mode 100644
index 0000000..974b532
--- /dev/null
+++ b/drivers/extcon/extcon-sm5502.h
@@ -0,0 +1,282 @@
+/*
+ * sm5502.h
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __LINUX_EXTCON_SM5502_H
+#define __LINUX_EXTCON_SM5502_H
+
+enum sm5502_types {
+	TYPE_SM5502,
+};
+
+/* SM5502 registers */
+enum sm5502_reg {
+	SM5502_REG_DEVICE_ID = 0x01,
+	SM5502_REG_CONTROL,
+	SM5502_REG_INT1,
+	SM5502_REG_INT2,
+	SM5502_REG_INTMASK1,
+	SM5502_REG_INTMASK2,
+	SM5502_REG_ADC,
+	SM5502_REG_TIMING_SET1,
+	SM5502_REG_TIMING_SET2,
+	SM5502_REG_DEV_TYPE1,
+	SM5502_REG_DEV_TYPE2,
+	SM5502_REG_BUTTON1,
+	SM5502_REG_BUTTON2,
+	SM5502_REG_CAR_KIT_STATUS,
+	SM5502_REG_RSVD1,
+	SM5502_REG_RSVD2,
+	SM5502_REG_RSVD3,
+	SM5502_REG_RSVD4,
+	SM5502_REG_MANUAL_SW1,
+	SM5502_REG_MANUAL_SW2,
+	SM5502_REG_DEV_TYPE3,
+	SM5502_REG_RSVD5,
+	SM5502_REG_RSVD6,
+	SM5502_REG_RSVD7,
+	SM5502_REG_RSVD8,
+	SM5502_REG_RSVD9,
+	SM5502_REG_RESET,
+	SM5502_REG_RSVD10,
+	SM5502_REG_RESERVED_ID1,
+	SM5502_REG_RSVD11,
+	SM5502_REG_RSVD12,
+	SM5502_REG_RESERVED_ID2,
+	SM5502_REG_RSVD13,
+	SM5502_REG_OCP,
+	SM5502_REG_RSVD14,
+	SM5502_REG_RSVD15,
+	SM5502_REG_RSVD16,
+	SM5502_REG_RSVD17,
+	SM5502_REG_RSVD18,
+	SM5502_REG_RSVD19,
+	SM5502_REG_RSVD20,
+	SM5502_REG_RSVD21,
+	SM5502_REG_RSVD22,
+	SM5502_REG_RSVD23,
+	SM5502_REG_RSVD24,
+	SM5502_REG_RSVD25,
+	SM5502_REG_RSVD26,
+	SM5502_REG_RSVD27,
+	SM5502_REG_RSVD28,
+	SM5502_REG_RSVD29,
+	SM5502_REG_RSVD30,
+	SM5502_REG_RSVD31,
+	SM5502_REG_RSVD32,
+	SM5502_REG_RSVD33,
+	SM5502_REG_RSVD34,
+	SM5502_REG_RSVD35,
+	SM5502_REG_RSVD36,
+	SM5502_REG_RESERVED_ID3,
+
+	SM5502_REG_END,
+};
+
+/* Define SM5502 MASK/SHIFT constant */
+#define SM5502_REG_DEVICE_ID_VENDOR_SHIFT	0
+#define SM5502_REG_DEVICE_ID_VERSION_SHIFT	3
+#define SM5502_REG_DEVICE_ID_VENDOR_MASK	(0x3 << SM5502_REG_DEVICE_ID_VENDOR_SHIFT)
+#define SM5502_REG_DEVICE_ID_VERSION_MASK	(0x1f << SM5502_REG_DEVICE_ID_VERSION_SHIFT)
+
+#define SM5502_REG_CONTROL_MASK_INT_SHIFT	0
+#define SM5502_REG_CONTROL_WAIT_SHIFT		1
+#define SM5502_REG_CONTROL_MANUAL_SW_SHIFT	2
+#define SM5502_REG_CONTROL_RAW_DATA_SHIFT	3
+#define SM5502_REG_CONTROL_SW_OPEN_SHIFT	4
+#define SM5502_REG_CONTROL_MASK_INT_MASK	(0x1 << SM5502_REG_CONTROL_MASK_INT_SHIFT)
+#define SM5502_REG_CONTROL_WAIT_MASK		(0x1 << SM5502_REG_CONTROL_WAIT_SHIFT)
+#define SM5502_REG_CONTROL_MANUAL_SW_MASK	(0x1 << SM5502_REG_CONTROL_MANUAL_SW_SHIFT)
+#define SM5502_REG_CONTROL_RAW_DATA_MASK	(0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT)
+#define SM5502_REG_CONTROL_SW_OPEN_MASK		(0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT)
+
+#define SM5502_REG_INTM1_ATTACH_SHIFT		0
+#define SM5502_REG_INTM1_DETACH_SHIFT		1
+#define SM5502_REG_INTM1_KP_SHIFT		2
+#define SM5502_REG_INTM1_LKP_SHIFT		3
+#define SM5502_REG_INTM1_LKR_SHIFT		4
+#define SM5502_REG_INTM1_OVP_EVENT_SHIFT	5
+#define SM5502_REG_INTM1_OCP_EVENT_SHIFT	6
+#define SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT	7
+#define SM5502_REG_INTM1_ATTACH_MASK		(0x1 << SM5502_REG_INTM1_ATTACH_SHIFT)
+#define SM5502_REG_INTM1_DETACH_MASK		(0x1 << SM5502_REG_INTM1_DETACH_SHIFT)
+#define SM5502_REG_INTM1_KP_MASK		(0x1 << SM5502_REG_INTM1_KP_SHIFT)
+#define SM5502_REG_INTM1_LKP_MASK		(0x1 << SM5502_REG_INTM1_LKP_SHIFT)
+#define SM5502_REG_INTM1_LKR_MASK		(0x1 << SM5502_REG_INTM1_LKR_SHIFT)
+#define SM5502_REG_INTM1_OVP_EVENT_MASK		(0x1 << SM5502_REG_INTM1_OVP_EVENT_SHIFT)
+#define SM5502_REG_INTM1_OCP_EVENT_MASK		(0x1 << SM5502_REG_INTM1_OCP_EVENT_SHIFT)
+#define SM5502_REG_INTM1_OVP_OCP_DIS_MASK	(0x1 << SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT)
+
+#define SM5502_REG_INTM2_VBUS_DET_SHIFT		0
+#define SM5502_REG_INTM2_REV_ACCE_SHIFT		1
+#define SM5502_REG_INTM2_ADC_CHG_SHIFT		2
+#define SM5502_REG_INTM2_STUCK_KEY_SHIFT	3
+#define SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT	4
+#define SM5502_REG_INTM2_MHL_SHIFT		5
+#define SM5502_REG_INTM2_VBUS_DET_MASK		(0x1 << SM5502_REG_INTM2_VBUS_DET_SHIFT)
+#define SM5502_REG_INTM2_REV_ACCE_MASK		(0x1 << SM5502_REG_INTM2_REV_ACCE_SHIFT)
+#define SM5502_REG_INTM2_ADC_CHG_MASK		(0x1 << SM5502_REG_INTM2_ADC_CHG_SHIFT)
+#define SM5502_REG_INTM2_STUCK_KEY_MASK		(0x1 << SM5502_REG_INTM2_STUCK_KEY_SHIFT)
+#define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK	(0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT)
+#define SM5502_REG_INTM2_MHL_MASK		(0x1 << SM5502_REG_INTM2_MHL_SHIFT)
+
+#define SM5502_REG_ADC_SHIFT			0
+#define SM5502_REG_ADC_MASK			(0x1f << SM5502_REG_ADC_SHIFT)
+
+#define SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT	4
+#define SM5502_REG_TIMING_SET1_KEY_PRESS_MASK	(0xf << SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT)
+#define TIMING_KEY_PRESS_100MS			0x0
+#define TIMING_KEY_PRESS_200MS			0x1
+#define TIMING_KEY_PRESS_300MS			0x2
+#define TIMING_KEY_PRESS_400MS			0x3
+#define TIMING_KEY_PRESS_500MS			0x4
+#define TIMING_KEY_PRESS_600MS			0x5
+#define TIMING_KEY_PRESS_700MS			0x6
+#define TIMING_KEY_PRESS_800MS			0x7
+#define TIMING_KEY_PRESS_900MS			0x8
+#define TIMING_KEY_PRESS_1000MS			0x9
+#define SM5502_REG_TIMING_SET1_ADC_DET_SHIFT	0
+#define SM5502_REG_TIMING_SET1_ADC_DET_MASK	(0xf << SM5502_REG_TIMING_SET1_ADC_DET_SHIFT)
+#define TIMING_ADC_DET_50MS			0x0
+#define TIMING_ADC_DET_100MS			0x1
+#define TIMING_ADC_DET_150MS			0x2
+#define TIMING_ADC_DET_200MS			0x3
+#define TIMING_ADC_DET_300MS			0x4
+#define TIMING_ADC_DET_400MS			0x5
+#define TIMING_ADC_DET_500MS			0x6
+#define TIMING_ADC_DET_600MS			0x7
+#define TIMING_ADC_DET_700MS			0x8
+#define TIMING_ADC_DET_800MS			0x9
+#define TIMING_ADC_DET_900MS			0xA
+#define TIMING_ADC_DET_1000MS			0xB
+
+#define SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT	4
+#define SM5502_REG_TIMING_SET2_SW_WAIT_MASK	(0xf << SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT)
+#define TIMING_SW_WAIT_10MS			0x0
+#define TIMING_SW_WAIT_30MS			0x1
+#define TIMING_SW_WAIT_50MS			0x2
+#define TIMING_SW_WAIT_70MS			0x3
+#define TIMING_SW_WAIT_90MS			0x4
+#define TIMING_SW_WAIT_110MS			0x5
+#define TIMING_SW_WAIT_130MS			0x6
+#define TIMING_SW_WAIT_150MS			0x7
+#define TIMING_SW_WAIT_170MS			0x8
+#define TIMING_SW_WAIT_190MS			0x9
+#define TIMING_SW_WAIT_210MS			0xA
+#define SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT	0
+#define SM5502_REG_TIMING_SET2_LONG_KEY_MASK	(0xf << SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT)
+#define TIMING_LONG_KEY_300MS			0x0
+#define TIMING_LONG_KEY_400MS			0x1
+#define TIMING_LONG_KEY_500MS			0x2
+#define TIMING_LONG_KEY_600MS			0x3
+#define TIMING_LONG_KEY_700MS			0x4
+#define TIMING_LONG_KEY_800MS			0x5
+#define TIMING_LONG_KEY_900MS			0x6
+#define TIMING_LONG_KEY_1000MS			0x7
+#define TIMING_LONG_KEY_1100MS			0x8
+#define TIMING_LONG_KEY_1200MS			0x9
+#define TIMING_LONG_KEY_1300MS			0xA
+#define TIMING_LONG_KEY_1400MS			0xB
+#define TIMING_LONG_KEY_1500MS			0xC
+
+#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT		0
+#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT		1
+#define SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT		2
+#define SM5502_REG_DEV_TYPE1_UART_SHIFT			3
+#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT	4
+#define SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT		5
+#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT	6
+#define SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT		7
+#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_MASK		(0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT)
+#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1__MASK		(0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT)
+#define SM5502_REG_DEV_TYPE1_USB_SDP_MASK		(0x1 << SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT)
+#define SM5502_REG_DEV_TYPE1_UART_MASK			(0x1 << SM5502_REG_DEV_TYPE1_UART_SHIFT)
+#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_MASK	(0x1 << SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT)
+#define SM5502_REG_DEV_TYPE1_USB_CHG_MASK		(0x1 << SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT)
+#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK		(0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT)
+#define SM5502_REG_DEV_TYPE1_USB_OTG_MASK		(0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT)
+
+#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT		0
+#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT		1
+#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT		2
+#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT		3
+#define SM5502_REG_DEV_TYPE2_PPD_SHIFT			4
+#define SM5502_REG_DEV_TYPE2_TTY_SHIFT			5
+#define SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT		6
+#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_MASK		(0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT)
+#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_MASK		(0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT)
+#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_MASK		(0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT)
+#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_MASK		(0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT)
+#define SM5502_REG_DEV_TYPE2_PPD_MASK			(0x1 << SM5502_REG_DEV_TYPE2_PPD_SHIFT)
+#define SM5502_REG_DEV_TYPE2_TTY_MASK			(0x1 << SM5502_REG_DEV_TYPE2_TTY_SHIFT)
+#define SM5502_REG_DEV_TYPE2_AV_CABLE_MASK		(0x1 << SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT)
+
+#define SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT	0
+#define SM5502_REG_MANUAL_SW1_DP_SHIFT		2
+#define SM5502_REG_MANUAL_SW1_DM_SHIFT		5
+#define SM5502_REG_MANUAL_SW1_VBUSIN_MASK	(0x3 << SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT)
+#define SM5502_REG_MANUAL_SW1_DP_MASK		(0x7 << SM5502_REG_MANUAL_SW1_DP_SHIFT)
+#define SM5502_REG_MANUAL_SW1_DM_MASK		(0x7 << SM5502_REG_MANUAL_SW1_DM_SHIFT)
+#define VBUSIN_SWITCH_OPEN			0x0
+#define VBUSIN_SWITCH_VBUSOUT			0x1
+#define VBUSIN_SWITCH_MIC			0x2
+#define VBUSIN_SWITCH_VBUSOUT_WITH_USB		0x3
+#define DM_DP_CON_SWITCH_OPEN			0x0
+#define DM_DP_CON_SWITCH_USB			0x1
+#define DM_DP_CON_SWITCH_AUDIO			0x2
+#define DM_DP_CON_SWITCH_UART			0x3
+#define DM_DP_SWITCH_OPEN			((DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
+						| (DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
+#define DM_DP_SWITCH_USB			((DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
+						| (DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
+#define DM_DP_SWITCH_AUDIO			((DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
+						| (DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
+#define DM_DP_SWITCH_UART			((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
+						| (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
+
+/* SM5502 Interrupts */
+enum sm5502_irq {
+	/* INT1 */
+	SM5502_IRQ_INT1_ATTACH,
+	SM5502_IRQ_INT1_DETACH,
+	SM5502_IRQ_INT1_KP,
+	SM5502_IRQ_INT1_LKP,
+	SM5502_IRQ_INT1_LKR,
+	SM5502_IRQ_INT1_OVP_EVENT,
+	SM5502_IRQ_INT1_OCP_EVENT,
+	SM5502_IRQ_INT1_OVP_OCP_DIS,
+
+	/* INT2 */
+	SM5502_IRQ_INT2_VBUS_DET,
+	SM5502_IRQ_INT2_REV_ACCE,
+	SM5502_IRQ_INT2_ADC_CHG,
+	SM5502_IRQ_INT2_STUCK_KEY,
+	SM5502_IRQ_INT2_STUCK_KEY_RCV,
+	SM5502_IRQ_INT2_MHL,
+
+	SM5502_IRQ_NUM,
+};
+
+#define SM5502_IRQ_INT1_ATTACH_MASK		BIT(0)
+#define SM5502_IRQ_INT1_DETACH_MASK		BIT(1)
+#define SM5502_IRQ_INT1_KP_MASK			BIT(2)
+#define SM5502_IRQ_INT1_LKP_MASK		BIT(3)
+#define SM5502_IRQ_INT1_LKR_MASK		BIT(4)
+#define SM5502_IRQ_INT1_OVP_EVENT_MASK		BIT(5)
+#define SM5502_IRQ_INT1_OCP_EVENT_MASK		BIT(6)
+#define SM5502_IRQ_INT1_OVP_OCP_DIS_MASK	BIT(7)
+#define SM5502_IRQ_INT2_VBUS_DET_MASK		BIT(0)
+#define SM5502_IRQ_INT2_REV_ACCE_MASK		BIT(1)
+#define SM5502_IRQ_INT2_ADC_CHG_MASK		BIT(2)
+#define SM5502_IRQ_INT2_STUCK_KEY_MASK		BIT(3)
+#define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK	BIT(4)
+#define SM5502_IRQ_INT2_MHL_MASK		BIT(5)
+
+#endif /*  __LINUX_EXTCON_SM5502_H */
diff --git a/include/linux/extcon/sm5502.h b/include/linux/extcon/sm5502.h
deleted file mode 100644
index 030526b..0000000
--- a/include/linux/extcon/sm5502.h
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * sm5502.h
- *
- * Copyright (c) 2014 Samsung Electronics Co., Ltd
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __LINUX_EXTCON_SM5502_H
-#define __LINUX_EXTCON_SM5502_H
-
-enum sm5502_types {
-	TYPE_SM5502,
-};
-
-/* SM5502 registers */
-enum sm5502_reg {
-	SM5502_REG_DEVICE_ID = 0x01,
-	SM5502_REG_CONTROL,
-	SM5502_REG_INT1,
-	SM5502_REG_INT2,
-	SM5502_REG_INTMASK1,
-	SM5502_REG_INTMASK2,
-	SM5502_REG_ADC,
-	SM5502_REG_TIMING_SET1,
-	SM5502_REG_TIMING_SET2,
-	SM5502_REG_DEV_TYPE1,
-	SM5502_REG_DEV_TYPE2,
-	SM5502_REG_BUTTON1,
-	SM5502_REG_BUTTON2,
-	SM5502_REG_CAR_KIT_STATUS,
-	SM5502_REG_RSVD1,
-	SM5502_REG_RSVD2,
-	SM5502_REG_RSVD3,
-	SM5502_REG_RSVD4,
-	SM5502_REG_MANUAL_SW1,
-	SM5502_REG_MANUAL_SW2,
-	SM5502_REG_DEV_TYPE3,
-	SM5502_REG_RSVD5,
-	SM5502_REG_RSVD6,
-	SM5502_REG_RSVD7,
-	SM5502_REG_RSVD8,
-	SM5502_REG_RSVD9,
-	SM5502_REG_RESET,
-	SM5502_REG_RSVD10,
-	SM5502_REG_RESERVED_ID1,
-	SM5502_REG_RSVD11,
-	SM5502_REG_RSVD12,
-	SM5502_REG_RESERVED_ID2,
-	SM5502_REG_RSVD13,
-	SM5502_REG_OCP,
-	SM5502_REG_RSVD14,
-	SM5502_REG_RSVD15,
-	SM5502_REG_RSVD16,
-	SM5502_REG_RSVD17,
-	SM5502_REG_RSVD18,
-	SM5502_REG_RSVD19,
-	SM5502_REG_RSVD20,
-	SM5502_REG_RSVD21,
-	SM5502_REG_RSVD22,
-	SM5502_REG_RSVD23,
-	SM5502_REG_RSVD24,
-	SM5502_REG_RSVD25,
-	SM5502_REG_RSVD26,
-	SM5502_REG_RSVD27,
-	SM5502_REG_RSVD28,
-	SM5502_REG_RSVD29,
-	SM5502_REG_RSVD30,
-	SM5502_REG_RSVD31,
-	SM5502_REG_RSVD32,
-	SM5502_REG_RSVD33,
-	SM5502_REG_RSVD34,
-	SM5502_REG_RSVD35,
-	SM5502_REG_RSVD36,
-	SM5502_REG_RESERVED_ID3,
-
-	SM5502_REG_END,
-};
-
-/* Define SM5502 MASK/SHIFT constant */
-#define SM5502_REG_DEVICE_ID_VENDOR_SHIFT	0
-#define SM5502_REG_DEVICE_ID_VERSION_SHIFT	3
-#define SM5502_REG_DEVICE_ID_VENDOR_MASK	(0x3 << SM5502_REG_DEVICE_ID_VENDOR_SHIFT)
-#define SM5502_REG_DEVICE_ID_VERSION_MASK	(0x1f << SM5502_REG_DEVICE_ID_VERSION_SHIFT)
-
-#define SM5502_REG_CONTROL_MASK_INT_SHIFT	0
-#define SM5502_REG_CONTROL_WAIT_SHIFT		1
-#define SM5502_REG_CONTROL_MANUAL_SW_SHIFT	2
-#define SM5502_REG_CONTROL_RAW_DATA_SHIFT	3
-#define SM5502_REG_CONTROL_SW_OPEN_SHIFT	4
-#define SM5502_REG_CONTROL_MASK_INT_MASK	(0x1 << SM5502_REG_CONTROL_MASK_INT_SHIFT)
-#define SM5502_REG_CONTROL_WAIT_MASK		(0x1 << SM5502_REG_CONTROL_WAIT_SHIFT)
-#define SM5502_REG_CONTROL_MANUAL_SW_MASK	(0x1 << SM5502_REG_CONTROL_MANUAL_SW_SHIFT)
-#define SM5502_REG_CONTROL_RAW_DATA_MASK	(0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT)
-#define SM5502_REG_CONTROL_SW_OPEN_MASK		(0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT)
-
-#define SM5502_REG_INTM1_ATTACH_SHIFT		0
-#define SM5502_REG_INTM1_DETACH_SHIFT		1
-#define SM5502_REG_INTM1_KP_SHIFT		2
-#define SM5502_REG_INTM1_LKP_SHIFT		3
-#define SM5502_REG_INTM1_LKR_SHIFT		4
-#define SM5502_REG_INTM1_OVP_EVENT_SHIFT	5
-#define SM5502_REG_INTM1_OCP_EVENT_SHIFT	6
-#define SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT	7
-#define SM5502_REG_INTM1_ATTACH_MASK		(0x1 << SM5502_REG_INTM1_ATTACH_SHIFT)
-#define SM5502_REG_INTM1_DETACH_MASK		(0x1 << SM5502_REG_INTM1_DETACH_SHIFT)
-#define SM5502_REG_INTM1_KP_MASK		(0x1 << SM5502_REG_INTM1_KP_SHIFT)
-#define SM5502_REG_INTM1_LKP_MASK		(0x1 << SM5502_REG_INTM1_LKP_SHIFT)
-#define SM5502_REG_INTM1_LKR_MASK		(0x1 << SM5502_REG_INTM1_LKR_SHIFT)
-#define SM5502_REG_INTM1_OVP_EVENT_MASK		(0x1 << SM5502_REG_INTM1_OVP_EVENT_SHIFT)
-#define SM5502_REG_INTM1_OCP_EVENT_MASK		(0x1 << SM5502_REG_INTM1_OCP_EVENT_SHIFT)
-#define SM5502_REG_INTM1_OVP_OCP_DIS_MASK	(0x1 << SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT)
-
-#define SM5502_REG_INTM2_VBUS_DET_SHIFT		0
-#define SM5502_REG_INTM2_REV_ACCE_SHIFT		1
-#define SM5502_REG_INTM2_ADC_CHG_SHIFT		2
-#define SM5502_REG_INTM2_STUCK_KEY_SHIFT	3
-#define SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT	4
-#define SM5502_REG_INTM2_MHL_SHIFT		5
-#define SM5502_REG_INTM2_VBUS_DET_MASK		(0x1 << SM5502_REG_INTM2_VBUS_DET_SHIFT)
-#define SM5502_REG_INTM2_REV_ACCE_MASK		(0x1 << SM5502_REG_INTM2_REV_ACCE_SHIFT)
-#define SM5502_REG_INTM2_ADC_CHG_MASK		(0x1 << SM5502_REG_INTM2_ADC_CHG_SHIFT)
-#define SM5502_REG_INTM2_STUCK_KEY_MASK		(0x1 << SM5502_REG_INTM2_STUCK_KEY_SHIFT)
-#define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK	(0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT)
-#define SM5502_REG_INTM2_MHL_MASK		(0x1 << SM5502_REG_INTM2_MHL_SHIFT)
-
-#define SM5502_REG_ADC_SHIFT			0
-#define SM5502_REG_ADC_MASK			(0x1f << SM5502_REG_ADC_SHIFT)
-
-#define SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT	4
-#define SM5502_REG_TIMING_SET1_KEY_PRESS_MASK	(0xf << SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT)
-#define TIMING_KEY_PRESS_100MS			0x0
-#define TIMING_KEY_PRESS_200MS			0x1
-#define TIMING_KEY_PRESS_300MS			0x2
-#define TIMING_KEY_PRESS_400MS			0x3
-#define TIMING_KEY_PRESS_500MS			0x4
-#define TIMING_KEY_PRESS_600MS			0x5
-#define TIMING_KEY_PRESS_700MS			0x6
-#define TIMING_KEY_PRESS_800MS			0x7
-#define TIMING_KEY_PRESS_900MS			0x8
-#define TIMING_KEY_PRESS_1000MS			0x9
-#define SM5502_REG_TIMING_SET1_ADC_DET_SHIFT	0
-#define SM5502_REG_TIMING_SET1_ADC_DET_MASK	(0xf << SM5502_REG_TIMING_SET1_ADC_DET_SHIFT)
-#define TIMING_ADC_DET_50MS			0x0
-#define TIMING_ADC_DET_100MS			0x1
-#define TIMING_ADC_DET_150MS			0x2
-#define TIMING_ADC_DET_200MS			0x3
-#define TIMING_ADC_DET_300MS			0x4
-#define TIMING_ADC_DET_400MS			0x5
-#define TIMING_ADC_DET_500MS			0x6
-#define TIMING_ADC_DET_600MS			0x7
-#define TIMING_ADC_DET_700MS			0x8
-#define TIMING_ADC_DET_800MS			0x9
-#define TIMING_ADC_DET_900MS			0xA
-#define TIMING_ADC_DET_1000MS			0xB
-
-#define SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT	4
-#define SM5502_REG_TIMING_SET2_SW_WAIT_MASK	(0xf << SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT)
-#define TIMING_SW_WAIT_10MS			0x0
-#define TIMING_SW_WAIT_30MS			0x1
-#define TIMING_SW_WAIT_50MS			0x2
-#define TIMING_SW_WAIT_70MS			0x3
-#define TIMING_SW_WAIT_90MS			0x4
-#define TIMING_SW_WAIT_110MS			0x5
-#define TIMING_SW_WAIT_130MS			0x6
-#define TIMING_SW_WAIT_150MS			0x7
-#define TIMING_SW_WAIT_170MS			0x8
-#define TIMING_SW_WAIT_190MS			0x9
-#define TIMING_SW_WAIT_210MS			0xA
-#define SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT	0
-#define SM5502_REG_TIMING_SET2_LONG_KEY_MASK	(0xf << SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT)
-#define TIMING_LONG_KEY_300MS			0x0
-#define TIMING_LONG_KEY_400MS			0x1
-#define TIMING_LONG_KEY_500MS			0x2
-#define TIMING_LONG_KEY_600MS			0x3
-#define TIMING_LONG_KEY_700MS			0x4
-#define TIMING_LONG_KEY_800MS			0x5
-#define TIMING_LONG_KEY_900MS			0x6
-#define TIMING_LONG_KEY_1000MS			0x7
-#define TIMING_LONG_KEY_1100MS			0x8
-#define TIMING_LONG_KEY_1200MS			0x9
-#define TIMING_LONG_KEY_1300MS			0xA
-#define TIMING_LONG_KEY_1400MS			0xB
-#define TIMING_LONG_KEY_1500MS			0xC
-
-#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT		0
-#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT		1
-#define SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT		2
-#define SM5502_REG_DEV_TYPE1_UART_SHIFT			3
-#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT	4
-#define SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT		5
-#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT	6
-#define SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT		7
-#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_MASK		(0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT)
-#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1__MASK		(0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT)
-#define SM5502_REG_DEV_TYPE1_USB_SDP_MASK		(0x1 << SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT)
-#define SM5502_REG_DEV_TYPE1_UART_MASK			(0x1 << SM5502_REG_DEV_TYPE1_UART_SHIFT)
-#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_MASK	(0x1 << SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT)
-#define SM5502_REG_DEV_TYPE1_USB_CHG_MASK		(0x1 << SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT)
-#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK		(0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT)
-#define SM5502_REG_DEV_TYPE1_USB_OTG_MASK		(0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT)
-
-#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT		0
-#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT		1
-#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT		2
-#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT		3
-#define SM5502_REG_DEV_TYPE2_PPD_SHIFT			4
-#define SM5502_REG_DEV_TYPE2_TTY_SHIFT			5
-#define SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT		6
-#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_MASK		(0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT)
-#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_MASK		(0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT)
-#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_MASK		(0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT)
-#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_MASK		(0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT)
-#define SM5502_REG_DEV_TYPE2_PPD_MASK			(0x1 << SM5502_REG_DEV_TYPE2_PPD_SHIFT)
-#define SM5502_REG_DEV_TYPE2_TTY_MASK			(0x1 << SM5502_REG_DEV_TYPE2_TTY_SHIFT)
-#define SM5502_REG_DEV_TYPE2_AV_CABLE_MASK		(0x1 << SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT)
-
-#define SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT	0
-#define SM5502_REG_MANUAL_SW1_DP_SHIFT		2
-#define SM5502_REG_MANUAL_SW1_DM_SHIFT		5
-#define SM5502_REG_MANUAL_SW1_VBUSIN_MASK	(0x3 << SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT)
-#define SM5502_REG_MANUAL_SW1_DP_MASK		(0x7 << SM5502_REG_MANUAL_SW1_DP_SHIFT)
-#define SM5502_REG_MANUAL_SW1_DM_MASK		(0x7 << SM5502_REG_MANUAL_SW1_DM_SHIFT)
-#define VBUSIN_SWITCH_OPEN			0x0
-#define VBUSIN_SWITCH_VBUSOUT			0x1
-#define VBUSIN_SWITCH_MIC			0x2
-#define VBUSIN_SWITCH_VBUSOUT_WITH_USB		0x3
-#define DM_DP_CON_SWITCH_OPEN			0x0
-#define DM_DP_CON_SWITCH_USB			0x1
-#define DM_DP_CON_SWITCH_AUDIO			0x2
-#define DM_DP_CON_SWITCH_UART			0x3
-#define DM_DP_SWITCH_OPEN			((DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
-						| (DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
-#define DM_DP_SWITCH_USB			((DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
-						| (DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
-#define DM_DP_SWITCH_AUDIO			((DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
-						| (DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
-#define DM_DP_SWITCH_UART			((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
-						| (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
-
-/* SM5502 Interrupts */
-enum sm5502_irq {
-	/* INT1 */
-	SM5502_IRQ_INT1_ATTACH,
-	SM5502_IRQ_INT1_DETACH,
-	SM5502_IRQ_INT1_KP,
-	SM5502_IRQ_INT1_LKP,
-	SM5502_IRQ_INT1_LKR,
-	SM5502_IRQ_INT1_OVP_EVENT,
-	SM5502_IRQ_INT1_OCP_EVENT,
-	SM5502_IRQ_INT1_OVP_OCP_DIS,
-
-	/* INT2 */
-	SM5502_IRQ_INT2_VBUS_DET,
-	SM5502_IRQ_INT2_REV_ACCE,
-	SM5502_IRQ_INT2_ADC_CHG,
-	SM5502_IRQ_INT2_STUCK_KEY,
-	SM5502_IRQ_INT2_STUCK_KEY_RCV,
-	SM5502_IRQ_INT2_MHL,
-
-	SM5502_IRQ_NUM,
-};
-
-#define SM5502_IRQ_INT1_ATTACH_MASK		BIT(0)
-#define SM5502_IRQ_INT1_DETACH_MASK		BIT(1)
-#define SM5502_IRQ_INT1_KP_MASK			BIT(2)
-#define SM5502_IRQ_INT1_LKP_MASK		BIT(3)
-#define SM5502_IRQ_INT1_LKR_MASK		BIT(4)
-#define SM5502_IRQ_INT1_OVP_EVENT_MASK		BIT(5)
-#define SM5502_IRQ_INT1_OCP_EVENT_MASK		BIT(6)
-#define SM5502_IRQ_INT1_OVP_OCP_DIS_MASK	BIT(7)
-#define SM5502_IRQ_INT2_VBUS_DET_MASK		BIT(0)
-#define SM5502_IRQ_INT2_REV_ACCE_MASK		BIT(1)
-#define SM5502_IRQ_INT2_ADC_CHG_MASK		BIT(2)
-#define SM5502_IRQ_INT2_STUCK_KEY_MASK		BIT(3)
-#define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK	BIT(4)
-#define SM5502_IRQ_INT2_MHL_MASK		BIT(5)
-
-#endif /*  __LINUX_EXTCON_SM5502_H */
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCHv2 2/4] extcon: sm5502: Fix bug to check cable type
  2014-08-14  0:20 [PATCHv2 0/4] extcon: sm5502: Clean up coding style and fix bug Chanwoo Choi
  2014-08-14  0:20 ` [PATCHv2 1/4] extcon: sm5502: Move sm5502.h header file to extcon directory Chanwoo Choi
@ 2014-08-14  0:20 ` Chanwoo Choi
  2014-08-14  0:20 ` [PATCHv2 3/4] extcon: sm5502: Clean up codes by using checkpatch script Chanwoo Choi
  2014-08-14  0:21 ` [PATCHv2 4/4] extcon: sm5502: Add I2C dependency to fix build break Chanwoo Choi
  3 siblings, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2014-08-14  0:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: myungjoo.ham, kyungmin.park, Chanwoo Choi

This patch fix bug when checking cable type. SM5502 have to use ADC value
to get correct cable type.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-sm5502.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
index aab630e..f94d66a 100644
--- a/drivers/extcon/extcon-sm5502.c
+++ b/drivers/extcon/extcon-sm5502.c
@@ -296,7 +296,7 @@ static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info)
 	 * If ADC is SM5502_MUIC_ADC_GROUND(0x0), external cable hasn't
 	 * connected with to MUIC device.
 	 */
-	cable_type &= SM5502_REG_ADC_MASK;
+	cable_type = adc & SM5502_REG_ADC_MASK;
 	if (cable_type == SM5502_MUIC_ADC_GROUND)
 		return SM5502_MUIC_ADC_GROUND;
 
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCHv2 3/4] extcon: sm5502: Clean up codes by using checkpatch script
  2014-08-14  0:20 [PATCHv2 0/4] extcon: sm5502: Clean up coding style and fix bug Chanwoo Choi
  2014-08-14  0:20 ` [PATCHv2 1/4] extcon: sm5502: Move sm5502.h header file to extcon directory Chanwoo Choi
  2014-08-14  0:20 ` [PATCHv2 2/4] extcon: sm5502: Fix bug to check cable type Chanwoo Choi
@ 2014-08-14  0:20 ` Chanwoo Choi
  2014-08-14  0:21 ` [PATCHv2 4/4] extcon: sm5502: Add I2C dependency to fix build break Chanwoo Choi
  3 siblings, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2014-08-14  0:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: myungjoo.ham, kyungmin.park, Chanwoo Choi

This patch just clean up codes by using checkpatch script and fix warning
message about if statement.

- the result of checkpatch script as following:
WARNING: void function return statements are not generally useful
+	return;
+}

WARNING: quoted string split across lines
+			dev_err(info->dev, "failed: irq request (IRQ: %d,"
+				" error :%d)\n", muic_irq->irq, ret);

- warning message about coding style.
	drivers/extcon/extcon-sm5502.c:398 sm5502_muic_cable_handler()
		warn: we tested 'attached' before and it was 'false'

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-sm5502.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
index f94d66a..8e6e669 100644
--- a/drivers/extcon/extcon-sm5502.c
+++ b/drivers/extcon/extcon-sm5502.c
@@ -391,7 +391,7 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
 	/* Get the type of attached or detached cable */
 	if (attached)
 		cable_type = sm5502_muic_get_cable_type(info);
-	else if (!attached)
+	else
 		cable_type = prev_cable_type;
 	prev_cable_type = cable_type;
 
@@ -453,8 +453,6 @@ static void sm5502_muic_irq_work(struct work_struct *work)
 		dev_err(info->dev, "failed to handle MUIC interrupt\n");
 
 	mutex_unlock(&info->mutex);
-
-	return;
 }
 
 /*
@@ -613,8 +611,9 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c,
 						IRQF_NO_SUSPEND,
 						muic_irq->name, info);
 		if (ret) {
-			dev_err(info->dev, "failed: irq request (IRQ: %d,"
-				" error :%d)\n", muic_irq->irq, ret);
+			dev_err(info->dev,
+				"failed: irq request (IRQ: %d, error :%d)\n",
+				muic_irq->irq, ret);
 			return ret;
 		}
 	}
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCHv2 4/4] extcon: sm5502: Add I2C dependency to fix build break
  2014-08-14  0:20 [PATCHv2 0/4] extcon: sm5502: Clean up coding style and fix bug Chanwoo Choi
                   ` (2 preceding siblings ...)
  2014-08-14  0:20 ` [PATCHv2 3/4] extcon: sm5502: Clean up codes by using checkpatch script Chanwoo Choi
@ 2014-08-14  0:21 ` Chanwoo Choi
  3 siblings, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2014-08-14  0:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: myungjoo.ham, kyungmin.park, Chanwoo Choi

This patch add I2C configuration dependency to fix following build break.
If specific kernel build I2C as module, extcon-sm5502 have to depend on
I2C configuration.

	drivers/built-in.o: In function `regmap_smbus_byte_reg_read':
	regmap-i2c.c:(.text+0x5030a): undefined reference to `i2c_smbus_read_byte_data'
	drivers/built-in.o: In function `regmap_smbus_byte_reg_write':
	regmap-i2c.c:(.text+0x50338): undefined reference to `i2c_smbus_write_byte_data'
	drivers/built-in.o: In function `regmap_smbus_word_reg_read':
	regmap-i2c.c:(.text+0x50356): undefined reference to `i2c_smbus_read_word_data'
	drivers/built-in.o: In function `regmap_smbus_word_reg_write':
	regmap-i2c.c:(.text+0x50384): undefined reference to `i2c_smbus_write_word_data'
	drivers/built-in.o: In function `regmap_i2c_read':
	regmap-i2c.c:(.text+0x503cf): undefined reference to `i2c_transfer'
	drivers/built-in.o: In function `regmap_i2c_gather_write':
	regmap-i2c.c:(.text+0x50442): undefined reference to `i2c_transfer'
	drivers/built-in.o: In function `regmap_i2c_write':
	regmap-i2c.c:(.text+0x50474): undefined reference to `i2c_master_send'
	drivers/built-in.o: In function `sm5502_muic_i2c_init':
	extcon-sm5502.c:(.init.text+0x6630): undefined reference to `i2c_register_driver'

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index 6f2f472..764f3a1 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -72,6 +72,7 @@ config EXTCON_PALMAS
 
 config EXTCON_SM5502
 	tristate "SM5502 EXTCON support"
+	depends on I2C
 	select IRQ_DOMAIN
 	select REGMAP_I2C
 	select REGMAP_IRQ
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-14  0:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-14  0:20 [PATCHv2 0/4] extcon: sm5502: Clean up coding style and fix bug Chanwoo Choi
2014-08-14  0:20 ` [PATCHv2 1/4] extcon: sm5502: Move sm5502.h header file to extcon directory Chanwoo Choi
2014-08-14  0:20 ` [PATCHv2 2/4] extcon: sm5502: Fix bug to check cable type Chanwoo Choi
2014-08-14  0:20 ` [PATCHv2 3/4] extcon: sm5502: Clean up codes by using checkpatch script Chanwoo Choi
2014-08-14  0:21 ` [PATCHv2 4/4] extcon: sm5502: Add I2C dependency to fix build break Chanwoo Choi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.