Re: [PATCH 1/2] extcon: Unregister compat class at module unload to fix oops

2012-09-24 Thread Chanwoo Choi
[...]

 
 ---[ end trace dd512cc03fe1c369 ]---
 FATAL: Error inserting extcon_class
 (/lib/modules/3.6.0-rc6-00178-g811315f/kernel/drivers/extcon/extcon_class.ko):
 Cannot allocate memory
 
 This patch fixes this.
 
 Cc: sta...@vger.kernel.org
 Signed-off-by: Peter Huewe peterhu...@gmx.de
 ---


Applied, thank you

There was issue, but I fixed them up:

  drivers/extcon/extcon_class.c |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c


extcon_class.c was renamed to comply with the standard naming.
If you will write patch about extcon, please work patch based on below
git repository.

You will check it after some hours on below git repository.
-
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/extcon-for-next

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] extcon: unregister compat link on cleanup

2012-09-24 Thread Chanwoo Choi
On 09/22/2012 10:41 AM, Peter Huewe wrote:

 Since extcon registers this compat link at device registration
 (extcon_dev_register), we should probably remove them at 
 deregistration/cleanup.
 
 Cc: sta...@vger.kernel.org
 Signed-off-by: Peter Huewe peterhu...@gmx.de
 ---

Applied, thank you.

Also, there were some minor issue, but I fixed them up.

You will check it after some hours on below git repository.
-
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/extcon-for-next


  drivers/extcon/extcon_class.c |5 +
  1 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c
 index 6e914d0..7610b4e 100644
 --- a/drivers/extcon/extcon_class.c
 +++ b/drivers/extcon/extcon_class.c
 @@ -575,6 +575,11 @@ static void extcon_cleanup(struct extcon_dev *edev, bool 
 skip)
   kfree(edev-cables);
   }
  
 +#if defined(CONFIG_ANDROID)
 + if (switch_class)
 + ret = class_compat_remove_link(switch_class, edev-dev,
 +NULL);
 +#endif /* CONFIG_ANDROID */


This patch have build break which show below log because 'ret' variable
isn't defined on extcon_cleanup function and class_compat_remove_link
function return void type after function call. So, I remove 'ret' variable.

drivers/extcon/extcon-class.c: In function 'extcon_cleanup':
drivers/extcon/extcon-class.c:574: error: 'ret' undeclared (first use in
this function)
drivers/extcon/extcon-class.c:574: error: (Each undeclared identifier is
reported only once
drivers/extcon/extcon-class.c:574: error: for each function it appears in.)
drivers/extcon/extcon-class.c: In function 'extcon_class_exit':
drivers/extcon/extcon-class.c:825: warning: extra tokens at end of
#ifdef directive
make[2]: *** [drivers/extcon/extcon-class.o] Error 1
make[1]: *** [drivers/extcon] Error 2
make[1]: *** Waiting for unfinished jobs

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: Fix return value in extcon_register_interest()

2012-09-25 Thread Chanwoo Choi
On 09/25/2012 03:58 PM, Sachin Kamat wrote:

 Return the value obtained from extcon_find_cable_index()
 instead of -ENODEV.
 
 Fixes the following smatch info:
 drivers/extcon/extcon-class.c:478 extcon_register_interest() info:
 why not propagate 'obj-cable_index' from extcon_find_cable_index()
 instead of -19?
 
 Signed-off-by: Sachin Kamat sachin.ka...@linaro.org
 ---
  drivers/extcon/extcon-class.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
 index 946a318..e996800 100644
 --- a/drivers/extcon/extcon-class.c
 +++ b/drivers/extcon/extcon-class.c
 @@ -475,7 +475,7 @@ int extcon_register_interest(struct 
 extcon_specific_cable_nb *obj,
  
   obj-cable_index = extcon_find_cable_index(obj-edev, cable_name);
   if (obj-cable_index  0)
 - return -ENODEV;
 + return obj-cable_index;
  
   obj-user_nb = nb;
  


I agree.
But, if extcon_register_interest() return directly 'obj-cable_index' value
when extcon_find_cable_index() return -EINVAL, it would spoil readability
of extcon_register_interest() function. So, I think we can make it as
following
patch  a little better.

---
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 936580b..078e6a5 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -468,7 +468,7 @@ int extcon_register_interest(struct
extcon_specific_cable_nb *obj,

obj-cable_index = extcon_find_cable_index(obj-edev, cable_name);
if (obj-cable_index  0)
-   return -ENODEV;
+   return -EINVAL;

obj-user_nb = nb;



Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH Resend] extcon: Fix return value in extcon_register_interest()

2012-09-25 Thread Chanwoo Choi
On 09/25/2012 08:01 PM, Sachin Kamat wrote:

 Propagate the value returned from extcon_find_cable_index()
 instead of -ENODEV. For readability, -EINVAL is returned in place of
 the variable.
 
 Signed-off-by: Sachin Kamat sachin.ka...@linaro.org
 ---

Applied, thank you.

You can check it after some hours at below git repository for Extcon.
-
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/extcon-for-next

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: max77693: Fix max77693_muic_probe error handling

2012-10-03 Thread Chanwoo Choi
On 10/03/2012 11:23 AM, Axel Lin wrote:

 Fix below issues:
 1. If request_threaded_irq() fails, current code does not free all requested
irqs.
 2. Add missing extcon_dev_unregister() in error path if failed to read 
 revision
number.
 
 Signed-off-by: Axel Lin axel@ingics.com
 ---
  drivers/extcon/extcon-max77693.c |   12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/extcon/extcon-max77693.c 
 b/drivers/extcon/extcon-max77693.c
 index e0ed622..9928c63 100644
 --- a/drivers/extcon/extcon-max77693.c
 +++ b/drivers/extcon/extcon-max77693.c
 @@ -696,12 +696,8 @@ static int __devinit max77693_muic_probe(struct 
 platform_device *pdev)
   IRQF_ONESHOT, muic_irq-name, info);
   if (ret) {
   dev_err(pdev-dev,
 - failed: irq request (IRQ: %d,
 -  error :%d)\n,
 + failed: irq request (IRQ: %d, error :%d)\n,
   muic_irq-irq, ret);
 -
 - for (i = i - 1; i = 0; i--)
 - free_irq(muic_irq-virq, info);
   goto err_irq;
   }
   }
 @@ -726,7 +722,7 @@ static int __devinit max77693_muic_probe(struct 
 platform_device *pdev)
   MAX77693_MUIC_REG_ID, id);
   if (ret  0) {
   dev_err(pdev-dev, failed to read revision number\n);
 - goto err_extcon;
 + goto err_read_reg;
   }
   dev_info(info-dev, device ID : 0x%x\n, id);
  
 @@ -738,9 +734,13 @@ static int __devinit max77693_muic_probe(struct 
 platform_device *pdev)
  
   return ret;
  
 +err_read_reg:
 + extcon_dev_unregister(info-edev);
  err_extcon:
   kfree(info-edev);
  err_irq:
 + while (--i = 0)
 + free_irq(muic_irqs[i].virq, info);


This include possible error when 'i' variable may be used after
completed request_thread_irq() operation. I think the below patch
is appropriate because free_irq() function return NULL if first parameter
is unrequested irq.

err_irq:
+   for (i = 0; i  ARRAY_SIZE(muic_irqs); i++)
+   free_irq(muic_irqs[i].virq, info);

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: Fix kerneldoc for extcon_set_cable_state and extcon_set_cable_state_

2012-10-03 Thread Chanwoo Choi
On 10/03/2012 12:30 AM, Axel Lin wrote:

 Signed-off-by: Axel Lin axel@ingics.com
 ---
  drivers/extcon/extcon-class.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
 index 946a318..337bbb4 100644
 --- a/drivers/extcon/extcon-class.c
 +++ b/drivers/extcon/extcon-class.c
 @@ -362,7 +362,7 @@ int extcon_get_cable_state(struct extcon_dev *edev, const 
 char *cable_name)
  EXPORT_SYMBOL_GPL(extcon_get_cable_state);
  
  /**
 - * extcon_get_cable_state_() - Set the status of a specific cable.
 + * extcon_set_cable_state_() - Set the status of a specific cable.
   * @edev:the extcon device that has the cable.
   * @index:   cable index that can be retrieved by extcon_find_cable_index().
   * @cable_state: the new cable status. The default semantics is
 @@ -382,7 +382,7 @@ int extcon_set_cable_state_(struct extcon_dev *edev,
  EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
  
  /**
 - * extcon_get_cable_state() - Set the status of a specific cable.
 + * extcon_set_cable_state() - Set the status of a specific cable.
   * @edev:the extcon device that has the cable.
   * @cable_name:  cable name.
   * @cable_state: the new cable status. The default semantics is


Applied, thanks.

I applied this patch at extcon git repository
and you can check it after some hours.
-
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/extcon-for-next

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: max77693: Use max77693_update_reg for rmw operations

2012-10-03 Thread Chanwoo Choi
On 10/03/2012 12:59 AM, Axel Lin wrote:

 This simplifies the code.
 
 Signed-off-by: Axel Lin axel@ingics.com
 ---
  drivers/extcon/extcon-max77693.c |   18 ++
  1 file changed, 6 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/extcon/extcon-max77693.c 
 b/drivers/extcon/extcon-max77693.c
 index e21387e..e0ed622 100644
 --- a/drivers/extcon/extcon-max77693.c
 +++ b/drivers/extcon/extcon-max77693.c
 @@ -239,25 +239,19 @@ const char *max77693_extcon_cable[] = {
  static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
   enum max77693_muic_adc_debounce_time time)
  {
 - int ret = 0;
 - u8 ctrl3;
 + int ret;
  
   switch (time) {
   case ADC_DEBOUNCE_TIME_5MS:
   case ADC_DEBOUNCE_TIME_10MS:
   case ADC_DEBOUNCE_TIME_25MS:
   case ADC_DEBOUNCE_TIME_38_62MS:
 - ret = max77693_read_reg(info-max77693-regmap_muic,
 - MAX77693_MUIC_REG_CTRL3, ctrl3);
 - ctrl3 = ~CONTROL3_ADCDBSET_MASK;
 - ctrl3 |= (time  CONTROL3_ADCDBSET_SHIFT);
 -
 - ret = max77693_write_reg(info-max77693-regmap_muic,
 - MAX77693_MUIC_REG_CTRL3, ctrl3);
 - if (ret) {
 + ret = max77693_update_reg(info-max77693-regmap_muic,
 +   MAX77693_MUIC_REG_CTRL3,
 +   time  CONTROL3_ADCDBSET_SHIFT,
 +   CONTROL3_ADCDBSET_MASK);
 + if (ret)
   dev_err(info-dev, failed to set ADC debounce time\n);
 - ret = -EINVAL;
 - }
   break;
   default:
   dev_err(info-dev, invalid ADC debounce time\n);


Applied, thanks.

Cheers,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] extcon: MAX77693: Add platform data for MUIC device to initialize registers

2012-10-03 Thread Chanwoo Choi
This patch add platform data for MUIC device to initialize register
on probe() call because it should unmask interrupt mask register
and initialize some register related to MUIC device.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/extcon/extcon-max77693.c |   27 +++
 include/linux/mfd/max77693.h |   13 +
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index ac9bac8..3e9520a 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -651,6 +651,8 @@ out:
 static int __devinit max77693_muic_probe(struct platform_device *pdev)
 {
struct max77693_dev *max77693 = dev_get_drvdata(pdev-dev.parent);
+   struct max77693_platform_data *pdata = dev_get_platdata(max77693-dev);
+   struct max77693_muic_platform_data *muic_pdata = pdata-muic_data;
struct max77693_muic_info *info;
int ret, i;
u8 id;
@@ -721,6 +723,31 @@ static int __devinit max77693_muic_probe(struct 
platform_device *pdev)
goto err_extcon;
}
 
+   /* Initialize MUIC register by using platform data */
+   for (i = 0 ; i  muic_pdata-num_init_data ; i++) {
+   enum max77693_irq_source irq_src = MAX77693_IRQ_GROUP_NR;
+
+   max77693_write_reg(info-max77693-regmap_muic,
+   muic_pdata-init_data[i].addr,
+   muic_pdata-init_data[i].data);
+
+   switch (muic_pdata-init_data[i].addr) {
+   case MAX77693_MUIC_REG_INTMASK1:
+   irq_src = MUIC_INT1;
+   break;
+   case MAX77693_MUIC_REG_INTMASK2:
+   irq_src = MUIC_INT2;
+   break;
+   case MAX77693_MUIC_REG_INTMASK3:
+   irq_src = MUIC_INT3;
+   break;
+   }
+
+   if (irq_src  MAX77693_IRQ_GROUP_NR)
+   info-max77693-irq_masks_cur[irq_src]
+   = muic_pdata-init_data[i].data;
+   }
+
/* Check revision number of MUIC device*/
ret = max77693_read_reg(info-max77693-regmap_muic,
MAX77693_MUIC_REG_ID, id);
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 1d28ae9..fe03b2d 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -30,7 +30,20 @@
 #ifndef __LINUX_MFD_MAX77693_H
 #define __LINUX_MFD_MAX77693_H
 
+struct max77693_reg_data {
+   u8 addr;
+   u8 data;
+};
+
+struct max77693_muic_platform_data {
+   struct max77693_reg_data *init_data;
+   int num_init_data;
+};
+
 struct max77693_platform_data {
int wakeup;
+
+   /* muic data */
+   struct max77693_muic_platform_data *muic_data;
 };
 #endif /* __LINUX_MFD_MAX77693_H */
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: arizona: unlock mutex on error path in arizona_micdet()

2012-11-05 Thread Chanwoo Choi
On 11/05/2012 05:04 PM, Mark Brown wrote:
 On Sun, Nov 04, 2012 at 01:19:46PM -0700, Alexey Khoroshilov wrote:
 If regmap_read() failed, arizona_micdet() returns IRQ_NONE
 leaving info-lock mutex locked as opposed to all other return paths.

 Found by Linux Driver Verification project (linuxtesting.org).
 
 Acked-by: Mark Brown broo...@opensource.wolfsonmicro.com

Applied, thanks.

You can check this patch on extcon git tree:
- git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git (for-next 
branch)

Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon : callback function to read cable property

2012-11-07 Thread Chanwoo Choi
On 10/17/2012 03:34 PM, Tc, Jenny wrote:
 Subject: Re: [PATCH] extcon : callback function to read cable
 property

 I think the reason why we have extcon is in first place is to only
 notify the clients of cable connection and disconnection and it is
 up to the client to decide what else to do with the cable such as
 finding which state it is in and other details.
 So I feel this should not be handled in the extcon.

 However it is up to the maintainer to decide.

 Once the consumer gets the notification, it needs to take some action.
 One of the action is to read the cable properties. This can be done by
 proprietary calls which is known both to the consumer and the provider.
 My intention is to avoid this proprietary calls. Since both the
 provider and consumer are communicating with the extcon subsystem , I
 feel having a callback function of this kind would help to avoid the
 use of proprietary calls. Also I agree that extcon notifier chains are
 used to notify the cable state (attach/detach). But if a cable has
 more than two states (like the charger cable) how do we support it without
 having a callback function like this?
 Let the maintainer take the final decision.
 Well this use case will keep on growing if we start factor in this kind of
 changes and that is why I am opposed to adding any other state.
 Maintainer?


I think that the role of extcon subsystem notify changed 
state(attached/detached)
of cable to notifiee, but if you want to add property feature of cable,
you should solve ambiguous issues.

First,
This patch only support the properties of charger cable but, never
support property of other cable. The following structure depend on
only charger cable. We can check it the following structure:
struct extcon_chrg_cbl_props {
enum extcon_chrgr_cbl_stat cable_state;
unsigned long mA;
};

I think that the patch have to support all of cables for property feature.

Second,
Certainly, you should define common properties of all cables and
specific properties of each cable. The properties of charger cable
should never be defined only.

Third,
If we finish to decide the properties for all cables, I'd like to see a example 
code.

You explained following changed state of USB according to Host state on other 
patch.
---
For USB2.0
1) CONNECT (100mA)-UPDATE(500mA)-DISCONNECT(0mA)
2) CONNECT (100mA)-UPDATE(500mA)-HOST SUSPEND(2.5mA/500mA)-DISCONNECT(0mA)
3) CONNECT (100mA)-UPDATE(500mA)-HOST SUSPEND(2.5mA/500mA)-HOST 
RESUME(500mA)-DISCONNECT(0mA)

For USB 3.0
4) CONNECT (150mA)-UPDATE(900mA)-DISCONNECT(0mA)
5) CONNECT (150mA)-UPDATE(900mA)- HOST SUSPEND(2.5mA/900mA)-DISCONNECT(0mA)
6) CONNECT (100mA)-UPDATE(900mA)-HOST SUSPEND(2.5mA/900mA)-HOST 
RESUME(900mA)-DISCONNECT(0mA)
---

I have a question. Can the provider device driver(e.g., extcon-max77693.c/
extcon-max8997.c) detect the changed state of host? I'd like to see the
example device driver that the provider device driver detect changed state of 
host.
Could you provide example device driver?

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon : callback function to read cable property

2012-10-19 Thread Chanwoo Choi
 MUIC device driver can detect difference between MHL 
and MHL-TA
when MHL/MHL-TA cable is attached/detached and define two type cable of MHL 
cable.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [PATCH] extcon: driver model release call not needed

2012-10-19 Thread Chanwoo Choi
On 10/19/2012 02:12 AM, anish kumar wrote:
 From: anish kumar anish198519851...@gmail.com
 
 We don't need a release call in this file as we are doing
 everything needed in unregister call and we don't have any
 more pointer to free up.
 
 Signed-off-by: anish kumar anish198519851...@gmail.com
 ---
  drivers/extcon/extcon-class.c |4 +---
  1 files changed, 1 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
 index 946a318..cf30eb1 100644
 --- a/drivers/extcon/extcon-class.c
 +++ b/drivers/extcon/extcon-class.c
 @@ -585,9 +585,7 @@ static void extcon_cleanup(struct extcon_dev *edev, bool 
 skip)
  
  static void extcon_dev_release(struct device *dev)
  {
 - struct extcon_dev *edev = (struct extcon_dev *) dev_get_drvdata(dev);
 -
 - extcon_cleanup(edev, true);
 + /* We don't have any thing to free here */
  }
  
  static const char *muex_name = mutually_exclusive;

I can't agree this patch. The extcon_dev_release() function is used
for dev-release. If some case without calling extcon_dev_unregister(),
I think dev-release function is needed to free memory of edev-dev.

The edev-dev-release store the function pointer of extcon_dev_release()
in extcon_dev_register().
edev-dev-parent = dev;
edev-dev-class = extcon_class;
edev-dev-release = extcon_dev_release;


Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [PATCH] extcon: driver model release call not needed

2012-10-19 Thread Chanwoo Choi
On 10/20/2012 11:30 AM, anish kumar wrote:
 On Sat, 2012-10-20 at 10:57 +0900, Chanwoo Choi wrote:
 On 10/19/2012 02:12 AM, anish kumar wrote:
 From: anish kumar anish198519851...@gmail.com

 We don't need a release call in this file as we are doing
 everything needed in unregister call and we don't have any
 more pointer to free up.

 Signed-off-by: anish kumar anish198519851...@gmail.com
 ---
  drivers/extcon/extcon-class.c |4 +---
  1 files changed, 1 insertions(+), 3 deletions(-)

 diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
 index 946a318..cf30eb1 100644
 --- a/drivers/extcon/extcon-class.c
 +++ b/drivers/extcon/extcon-class.c
 @@ -585,9 +585,7 @@ static void extcon_cleanup(struct extcon_dev *edev, 
 bool skip)
  
  static void extcon_dev_release(struct device *dev)
  {
 -   struct extcon_dev *edev = (struct extcon_dev *) dev_get_drvdata(dev);
 -
 -   extcon_cleanup(edev, true);
 +   /* We don't have any thing to free here */
  }
  
  static const char *muex_name = mutually_exclusive;

 I can't agree this patch. The extcon_dev_release() function is used
 for dev-release. If some case without calling extcon_dev_unregister(),
 I think dev-release function is needed to free memory of edev-dev.
 Is it not being released by extcon_dev_unregister?
 I think it is released by that and we will do two times free and
 list_del(edev-entry) as it is called by extcon_dev_release also.

I think that this patch should modify it as below patch to remove
two call of kfree().  How about you?

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index e717bbc..efca0b4 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -597,9 +597,8 @@ static void extcon_cleanup(struct extcon_dev *edev, bool 
skip)
 #endif
device_unregister(edev-dev);
put_device(edev-dev);
-   }
-
-   kfree(edev-dev);
+   } else {
+   kfree(edev-dev);

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [PATCH] extcon: driver model release call not needed

2012-10-19 Thread Chanwoo Choi
On 10/20/2012 12:33 PM, anish kumar wrote:
[]
 How about below?

I agree, but there were some minor issues,

[]
  
  static const char *muex_name = mutually_exclusive;
 @@ -813,7 +779,32 @@ EXPORT_SYMBOL_GPL(extcon_dev_register);
   */
  void extcon_dev_unregister(struct extcon_dev *edev)
  {
 -   extcon_cleanup(edev, false);
 +   mutex_lock(extcon_dev_list_lock);
 +   list_del(edev-entry);
 +   mutex_unlock(extcon_dev_list_lock);
 +
 +   if (!skip  get_device(edev-dev)) {

'skip' variable isn't anymore used and fix indentation as below code

[...]

-
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index e717bbc..ec7cc84 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -566,47 +566,9 @@ static int create_extcon_class(void)
return 0;
 }

-static void extcon_cleanup(struct extcon_dev *edev, bool skip)
-{
-   mutex_lock(extcon_dev_list_lock);
-   list_del(edev-entry);
-   mutex_unlock(extcon_dev_list_lock);
-
-   if (!skip  get_device(edev-dev)) {
-   int index;
-
-   if (edev-mutually_exclusive  edev-max_supported) {
-   for (index = 0; edev-mutually_exclusive[index];
-index++)
-   kfree(edev-d_attrs_muex[index].attr.name);
-   kfree(edev-d_attrs_muex);
-   kfree(edev-attrs_muex);
-   }
-
-   for (index = 0; index  edev-max_supported; index++)
-   kfree(edev-cables[index].attr_g.name);
-
-   if (edev-max_supported) {
-   kfree(edev-extcon_dev_type.groups);
-   kfree(edev-cables);
-   }
-
-#if defined(CONFIG_ANDROID)
-   if (switch_class)
-   class_compat_remove_link(switch_class, edev-dev, NULL);
-#endif
-   device_unregister(edev-dev);
-   put_device(edev-dev);
-   }
-
-   kfree(edev-dev);
-}
-
 static void extcon_dev_release(struct device *dev)
 {
-   struct extcon_dev *edev = (struct extcon_dev *) dev_get_drvdata(dev);
-
-   extcon_cleanup(edev, true);
+   kfree(edev-dev);
 }

 static const char *muex_name = mutually_exclusive;
@@ -832,7 +794,37 @@ EXPORT_SYMBOL_GPL(extcon_dev_register);
  */
 void extcon_dev_unregister(struct extcon_dev *edev)
 {
-   extcon_cleanup(edev, false);
+   int index;
+
+   mutex_lock(extcon_dev_list_lock);
+   list_del(edev-entry);
+   mutex_unlock(extcon_dev_list_lock);
+
+   if (!get_device(edev-dev))
+   return;
+
+   if (edev-mutually_exclusive  edev-max_supported) {
+   for (index = 0; edev-mutually_exclusive[index];
+index++)
+   kfree(edev-d_attrs_muex[index].attr.name);
+   kfree(edev-d_attrs_muex);
+   kfree(edev-attrs_muex);
+   }
+
+   for (index = 0; index  edev-max_supported; index++)
+   kfree(edev-cables[index].attr_g.name);
+
+   if (edev-max_supported) {
+   kfree(edev-extcon_dev_type.groups);
+   kfree(edev-cables);
+   }
+
+#if defined(CONFIG_ANDROID)
+   if (switch_class)
+   class_compat_remove_link(switch_class, edev-dev, NULL);
+#endif
+   device_unregister(edev-dev);
+   put_device(edev-dev);
 }
 EXPORT_SYMBOL_GPL(extcon_dev_unregister);

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: driver model release call not needed

2012-10-21 Thread Chanwoo Choi
On 10/21/2012 01:46 PM, anish kumar wrote:
 From: anish kumar anish198519851...@gmail.com
 
 There was a case where free and list_del can be called twice
 on the same pointer.So fixed it by re-arranging the code and
 removing a function which was not needed.
 
 Signed-off-by: anish kumar anish198519851...@gmail.com
 ---
  drivers/extcon/extcon-class.c |   71 
 ++---
  1 files changed, 31 insertions(+), 40 deletions(-)
 
Applied, thanks,

But, There were some minor issue, so I fix and applied it.

[...]

  static void extcon_dev_release(struct device *dev)
  {
 - struct extcon_dev *edev = (struct extcon_dev *) dev_get_drvdata(dev);
 -
 - extcon_cleanup(edev, true);
 + struct extcon_dev *edev = dev_get_drvdata(dev);
 + kfree(edev-dev);
It is not necessary to get extcon_dev instance through dev_get_drvdata()
and only call kfree(dev) by using extcon_dev_release()'s parameter.

kfree(dev);

  }
  
  static const char *muex_name = mutually_exclusive;
 @@ -810,7 +773,35 @@ EXPORT_SYMBOL_GPL(extcon_dev_register);
   */
  void extcon_dev_unregister(struct extcon_dev *edev)
  {
 - extcon_cleanup(edev, false);
 + mutex_lock(extcon_dev_list_lock);
 + list_del(edev-entry);
 + mutex_unlock(extcon_dev_list_lock);
 +
 + if (get_device(edev-dev) != NULL) {

I prefer minimal indentation, so I will modify as below code.

int index;

mutex_lock(extcon_dev_list_lock);
list_del(edev-entry);
mutex_unlock(extcon_dev_list_lock);

if (IS_ERR_OR_NULL(get_device(edev-dev))) {
dev_err(edev-dev, Failed to unregister extcon_dev (%s)\n,
dev_name(edev-dev));
return;
}

if (edev-mutually_exclusive  edev-max_supported) {
for (index = 0; edev-mutually_exclusive[index];
index++)
kfree(edev-d_attrs_muex[index].attr.name);
kfree(edev-d_attrs_muex);
kfree(edev-attrs_muex);
}

[...]

Cheers,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: trivial: kfree missed from remove path

2012-10-21 Thread Chanwoo Choi
On 10/21/2012 01:58 PM, anish kumar wrote:
 From: anish kumar anish198519851...@gmail.com
 
 Extcon core doesn't free the memory when we do unregister.
 Kfree is added in the remove path as it was missing.
 
 Signed-off-by: anish kumar anish198519851...@gmail.com
 ---
  drivers/extcon/extcon-max77693.c |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
Applied, thanks.

You can check it after some hours at extcon tree:
- 
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/extcon-for-next

Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2] extcon : register for cable interest by cable name

2012-10-21 Thread Chanwoo Choi
On 10/17/2012 09:08 PM, Jenny TC wrote:
 There are some scnearios where a driver/framework needs to register
 interest for a particular cable without specifying the extcon device
 name. One such scenario is charger notifications. The platform will
 have charger cabel which will be bound to any extcon device. It's
 not mandatory for the charger driver to know which extcon device
 it should use. This patch enables the support for registering
 interest for a cable just by cable name wihtout specifying the
 extcon device name
 
 Signed-off-by: Jenny TC jenny...@intel.com
 ---
 v1:
   Initial submit
 V2:
   Removed the new API and modified the extcon_register_interest
   API to accomodate the new requirement
 
  drivers/extcon/extcon-class.c |   43 
 +++--
  1 file changed, 33 insertions(+), 10 deletions(-)
 
Tested-by: Chanwoo Choi cw00.c...@samsung.com

Applied it and This patch is tested by me on charger-manager.

You can check it after some hours at extcon tree:
- 
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/extcon-for-next

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] extcon fixes for Linux 3.6

2012-10-10 Thread Chanwoo Choi
Hi Greg,

Please pull extcon fixes for Linux 3.6 from:

git://git.infradead.org/users/kmpark/linux-samsung extcon-for-next

I've been creating extcon-for-next tree at git.infradead.org
and rebasing the branch base on your
driver-core.git(branch:driver-core-next).

This tree contains various small bugfixes and enhancements, fix typos.
And extcon-max77693 initialize MUIC register during probe()
to unmask internal interrupt of max77693 MUIC device.

Thanks,
Chanwoo Choi



The following changes since commit e0f21e6d52cc245e7d4f7e02ca4b7b6571660ec2:
  Axel Lin (1):
memory: tegra{20,30}-mc: Fix reading incorrect register in
mc_readl()

are available in the git repository at:

  git://git.infradead.org/users/kmpark/linux-samsung extcon-for-next

Axel Lin (4):
  extcon: adc-jack: Fix checking return value of request_any_context_irq
  extcon: adc-jack: Add missing MODULE_LICENSE
  extcon: Fix kerneldoc for extcon_set_cable_state and
extcon_set_cable_state_
  extcon: max77693: Use max77693_update_reg for rmw operations

Chanwoo Choi (1):
  extcon: MAX77693: Add platform data for MUIC device to initialize
registers

Devendra Naga (1):
  extcon-max8997: remove usage of ret in
max8997_muic_handle_charger_type_detach

Peter Huewe (2):
  extcon: Unregister compat class at module unload to fix oops
  extcon: unregister compat link on cleanup

Sachin Kamat (2):
  extcon: Remove duplicate inclusion of extcon.h header file
  extcon: Fix return value in extcon_register_interest()

anish kumar (3):
  extcon: standard cable names definition and declaration changed
  extcon: optimising the check_mutually_exclusive function
  extcon: checkpatch warning removal

 drivers/extcon/extcon-adc-jack.c |   10 ++--
 drivers/extcon/extcon-class.c|   34 ++--
 drivers/extcon/extcon-gpio.c |1 -
 drivers/extcon/extcon-max77693.c |   45
+++--
 drivers/extcon/extcon-max8997.c  |6 +---
 include/linux/extcon.h   |2 +-
 include/linux/mfd/max77693.h |   13 +++
 7 files changed, 73 insertions(+), 38 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: remove duplicated include from extcon-gpio.c

2012-10-10 Thread Chanwoo Choi
On 10/07/2012 10:26 PM, Wei Yongjun wrote:
 From: Wei Yongjun yongjun_...@trendmicro.com.cn
 
 Remove duplicated include.
 
 dpatch engine is used to auto generate this patch.
 (https://github.com/weiyj/dpatch)
 
 Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
 ---

This patch was already applied from Sachin Kamat and
you can check previous patch on below extcon-for-next git tree:
- 
http://git.infradead.org/users/kmpark/linux-samsung/commit/e16bce4f25980a4f0b02b5297e87673800be5474

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] extcon fixes for Linux 3.6

2012-10-10 Thread Chanwoo Choi
On 10/11/2012 10:40 AM, Greg KH wrote:
 On Thu, Oct 11, 2012 at 10:31:19AM +0900, Chanwoo Choi wrote:
 Hi Greg,

 Please pull extcon fixes for Linux 3.6 from:

 git://git.infradead.org/users/kmpark/linux-samsung extcon-for-next
 
 Linux 3.6 has been released already, I can't take any patches for it. :)
 
 Are these for 3.7 instead?

Sorry, The extcon patches are for 3.7.

 And is your gpg key in the public servers so that I know this is
 really the set of patches you want me to pull, and that you are you?
 
 If you are at LinuxCon Korea the next two days, I'll be glad to sign
 your key to solve this issue...
 

OK, Myungjoo Ham and me will attend at LinuxCon Korea tommorrow.
and will talk to you about gpg key issue.

ps. I will create gpg key and register in public server today.

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] extcon fixes for Linux 3.6

2012-10-18 Thread Chanwoo Choi
On 10/19/2012 02:24 AM, Greg KH wrote:
 On Thu, Oct 11, 2012 at 10:31:19AM +0900, Chanwoo Choi wrote:
 Hi Greg,

 Please pull extcon fixes for Linux 3.6 from:

 git://git.infradead.org/users/kmpark/linux-samsung extcon-for-next

 I've been creating extcon-for-next tree at git.infradead.org
 and rebasing the branch base on your
 driver-core.git(branch:driver-core-next).

 This tree contains various small bugfixes and enhancements, fix typos.
 And extcon-max77693 initialize MUIC register during probe()
 to unmask internal interrupt of max77693 MUIC device.
 
 Now that you have a kernel.org account, can you move this tree to
 git.kernel.org, and provide me a signed tag to pull from for this set of
 patches to go into 3.7?
 

OK, I will move extcon tree to git.kernel.org when extcon git repository is 
created
and request pull extcon patches with a signed tag  from extcon tree to go into 
3.7.

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: Remove CONFIG_EXTCON_MODULE config to fix build break

2012-07-12 Thread Chanwoo Choi
Hi Greg,

On 07/13/2012 12:36 AM, Greg KH wrote:

 On Thu, Jul 12, 2012 at 01:32:27PM +0900, Chanwoo Choi wrote:
 This patch modify 'Kconfig' of EXTCON Subsystem to support either
 active or inactive of EXTCON Subsystem. The various subsystem refer
 to EXTCON subsystem for controlling external connector, so core class
 of EXTCON should be included in kernel image. If EXTCON subsystem is
 builded with MODULE, other subsystem have build break because of
 linking the core class of EXTCON.
 
 Then something else is wrong, as the extcon_class code should be able to
 be built as a module.  Don't load up systems with kernel code that they
 don't need (think of distro kernels that have to build everything.)
 
 So no, please fix the real problem here, I will not take this patch,
 sorry.

OK, I will add appropriate dependency to 'Kconfig' of subsystem/driver
using EXTCON
to resolve build break.

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: Remove CONFIG_EXTCON_MODULE config to fix build break

2012-07-12 Thread Chanwoo Choi
On 07/13/2012 01:16 AM, Mark Brown wrote:

 On Thu, Jul 12, 2012 at 01:32:27PM +0900, Chanwoo Choi wrote:
 This patch modify 'Kconfig' of EXTCON Subsystem to support either
 active or inactive of EXTCON Subsystem. The various subsystem refer
 to EXTCON subsystem for controlling external connector, so core class
 of EXTCON should be included in kernel image. If EXTCON subsystem is
 builded with MODULE, other subsystem have build break because of
 linking the core class of EXTCON.
 
 By this logic very little in the kernel should be a module.  We usually
 only force things to be built in if there's a technical need for it like
 init ordering constraints.  Generally this is just a case of making sure
 the Kconfig stuff is set up with appropriate dependencies.


As you said, I will fix it.

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] charger-manager: Use EXTCON Subsystem to control charger cable

2012-07-15 Thread Chanwoo Choi
On 07/14/2012 10:37 AM, Anton Vorontsov wrote:

 On Thu, Jul 12, 2012 at 03:03:16PM +0900, Chanwoo Choi wrote:
 This patchset add support EXTCON Subsystem in which charger-manager identify
 the type of external connector and enable/disable charger(regulator) 
 according
 to the state of charger cable(external connector).
 
 Applied, thanks a lot!
 

Thank you four your reply and quickly applied.

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] charger-manager: Fix build break related to EXTCON

2012-07-15 Thread Chanwoo Choi
This patch select CONFIG_EXTCON to resolve below build break of charger-manager
because charger-manager use API of EXTCON subsystem.

drivers/built-in.o: In function `charger_manager_probe':
charger-manager.c:(.text+0x11d61a): undefined reference to 
`extcon_register_interest'
charger-manager.c:(.text+0x11d7b6): undefined reference to 
`extcon_unregister_interest'
drivers/built-in.o: In function `charger_manager_remove':
charger-manager.c:(.devexit.text+0x8f3): undefined reference to 
`extcon_unregister_interest'

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index e3a3b49..064d6c1 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -268,6 +268,7 @@ config CHARGER_GPIO
 config CHARGER_MANAGER
bool Battery charger manager for multiple chargers
depends on REGULATOR  RTC_CLASS
+   select EXTCON
help
   Say Y to enable charger-manager support, which allows multiple
   chargers attached to a battery and multiple batteries attached to a
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: build failure after merge of the battery tree

2012-07-15 Thread Chanwoo Choi
Hi Stephen,

On 07/16/2012 01:09 PM, Stephen Rothwell wrote:

 Hi Anton,
 
 After merging the battery tree, today's linux-next build (x86_64
 allmodconfig) failed like this:
 
 drivers/built-in.o: In function `charger_manager_probe':
 charger-manager.c:(.text+0x11d61a): undefined reference to 
 `extcon_register_interest'
 charger-manager.c:(.text+0x11d7b6): undefined reference to 
 `extcon_unregister_interest'
 drivers/built-in.o: In function `charger_manager_remove':
 charger-manager.c:(.devexit.text+0x8f3): undefined reference to 
 `extcon_unregister_interest'
 
 Caused by commit bee737bccb03 (charger-manager: Use EXTCON Subsystem to
 detect charger cables for charging).
 
 I have used the battery tree from next-20120713 for today.


I'm so sorry, It is my mistake.
So, I resend below patch to fix build break of charger-manager.
- http://lkml.org/lkml/2012/7/16/5

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: MAX77693: Fix bug of interrupt handlding for MAX77693 devices

2012-07-16 Thread Chanwoo Choi
This patch fix bug related to interrupt handling for MAX77693 devices.
- Unmask interrupt masking bit for charger/flash/muic to revolve
that interrupt isn't happened when external connector is attached.
- Fix wrong regmap instance when muic interrupt is happened.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/mfd/max77693-irq.c |   36 +++-
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/max77693-irq.c b/drivers/mfd/max77693-irq.c
index 2b40356..1029d01 100644
--- a/drivers/mfd/max77693-irq.c
+++ b/drivers/mfd/max77693-irq.c
@@ -137,6 +137,9 @@ static void max77693_irq_mask(struct irq_data *data)
const struct max77693_irq_data *irq_data =
irq_to_max77693_irq(max77693, data-irq);
 
+   if (irq_data-group = MAX77693_IRQ_GROUP_NR)
+   return;
+
if (irq_data-group = MUIC_INT1  irq_data-group = MUIC_INT3)
max77693-irq_masks_cur[irq_data-group] = ~irq_data-mask;
else
@@ -149,6 +152,9 @@ static void max77693_irq_unmask(struct irq_data *data)
const struct max77693_irq_data *irq_data =
irq_to_max77693_irq(max77693, data-irq);
 
+   if (irq_data-group = MAX77693_IRQ_GROUP_NR)
+   return;
+
if (irq_data-group = MUIC_INT1  irq_data-group = MUIC_INT3)
max77693-irq_masks_cur[irq_data-group] |= irq_data-mask;
else
@@ -200,7 +206,7 @@ static irqreturn_t max77693_irq_thread(int irq, void *data)
 
if (irq_src  MAX77693_IRQSRC_MUIC)
/* MUIC INT1 ~ INT3 */
-   max77693_bulk_read(max77693-regmap, MAX77693_MUIC_REG_INT1,
+   max77693_bulk_read(max77693-regmap_muic, 
MAX77693_MUIC_REG_INT1,
MAX77693_NUM_IRQ_MUIC_REGS, irq_reg[MUIC_INT1]);
 
/* Apply masking */
@@ -255,7 +261,8 @@ int max77693_irq_init(struct max77693_dev *max77693)
 {
struct irq_domain *domain;
int i;
-   int ret;
+   int ret = 0;
+   u8 intsrc_mask;
 
mutex_init(max77693-irqlock);
 
@@ -287,19 +294,38 @@ int max77693_irq_init(struct max77693_dev *max77693)
max77693_irq_domain_ops, max77693);
if (!domain) {
dev_err(max77693-dev, could not create irq domain\n);
-   return -ENODEV;
+   ret = -ENODEV;
+   goto err_irq;
}
max77693-irq_domain = domain;
 
+   /* Unmask max77693 interrupt */
+   ret = max77693_read_reg(max77693-regmap,
+   MAX77693_PMIC_REG_INTSRC_MASK, intsrc_mask);
+   if (ret  0) {
+   dev_err(max77693-dev, fail to read PMIC register\n);
+   goto err_irq;
+   }
+
+   intsrc_mask = ~(MAX77693_IRQSRC_CHG);
+   intsrc_mask = ~(MAX77693_IRQSRC_FLASH);
+   intsrc_mask = ~(MAX77693_IRQSRC_MUIC);
+   ret = max77693_write_reg(max77693-regmap,
+   MAX77693_PMIC_REG_INTSRC_MASK, intsrc_mask);
+   if (ret  0) {
+   dev_err(max77693-dev, fail to write PMIC register\n);
+   goto err_irq;
+   }
+
ret = request_threaded_irq(max77693-irq, NULL, max77693_irq_thread,
   IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   max77693-irq, max77693);
-
if (ret)
dev_err(max77693-dev, Failed to request IRQ %d: %d\n,
max77693-irq, ret);
 
-   return 0;
+err_irq:
+   return ret;
 }
 
 void max77693_irq_exit(struct max77693_dev *max77693)
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mfd: MAX77693: Fix bug of interrupt handlding for MAX77693 devices

2012-07-16 Thread Chanwoo Choi
On 07/16/2012 10:36 PM, Mark Brown wrote:

 On Mon, Jul 16, 2012 at 06:41:05PM +0900, Chanwoo Choi wrote:
 This patch fix bug related to interrupt handling for MAX77693 devices.
 - Unmask interrupt masking bit for charger/flash/muic to revolve
 that interrupt isn't happened when external connector is attached.
 
 Shouldn't this be happening when the IRQ is requested?
 


The interrupt isn't happened when external connector is attached
because muic interrupt of MAX77693 is masked on INTSRC_MASK(
Interrupt Source Mask) register. So, I should set zero to muic interrupt
masking bit of INTSRC_MASK before requesting IRQ.

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] extcon: MAX77693: Add extcon-max77693 driver to support Maxim MAX77693 MUIC device

2012-07-16 Thread Chanwoo Choi
This patch support Maxim MAX77693 MUIC device by using EXTCON Subsystem
to handle various external connector. The extcon-max77693 use regmap
method for i2c communication and support irq domain instead of previous
method of irq base.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/extcon/Kconfig   |   10 +
 drivers/extcon/Makefile  |1 +
 drivers/extcon/extcon-max77693.c |  779 ++
 3 files changed, 790 insertions(+), 0 deletions(-)
 create mode 100644 drivers/extcon/extcon-max77693.c

diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index bb385ac..1671635 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -21,6 +21,16 @@ config EXTCON_GPIO
  Say Y here to enable GPIO based extcon support. Note that GPIO
  extcon supports single state per extcon instance.
 
+config EXTCON_MAX77693
+   tristate MAX77693 EXTCON Support
+   depends on MFD_MAX77693
+   select IRQ_DOMAIN
+   select REGMAP_I2C
+   help
+ If you say yes here you get support for the MUIC device of
+ Maxim MAX77693 PMIC. The MAX77693 MUIC is a USB port accessory
+ detector and switch.
+
 config EXTCON_MAX8997
tristate MAX8997 EXTCON Support
depends on MFD_MAX8997
diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
index e932caa..88961b3 100644
--- a/drivers/extcon/Makefile
+++ b/drivers/extcon/Makefile
@@ -4,5 +4,6 @@
 
 obj-$(CONFIG_EXTCON)   += extcon_class.o
 obj-$(CONFIG_EXTCON_GPIO)  += extcon_gpio.o
+obj-$(CONFIG_EXTCON_MAX77693)  += extcon-max77693.o
 obj-$(CONFIG_EXTCON_MAX8997)   += extcon-max8997.o
 obj-$(CONFIG_EXTCON_ARIZONA)   += extcon-arizona.o
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
new file mode 100644
index 000..920a609
--- /dev/null
+++ b/drivers/extcon/extcon-max77693.c
@@ -0,0 +1,779 @@
+/*
+ * extcon-max77693.c - MAX77693 extcon driver to support MAX77693 MUIC
+ *
+ * Copyright (C) 2012 Samsung Electrnoics
+ * Chanwoo Choi cw00.c...@samsung.com
+ *
+ * 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.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/i2c.h
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/err.h
+#include linux/platform_device.h
+#include linux/mfd/max77693.h
+#include linux/mfd/max77693-private.h
+#include linux/extcon.h
+#include linux/regmap.h
+#include linux/irqdomain.h
+
+#defineDEV_NAMEmax77693-muic
+
+/* MAX77693 MUIC - STATUS1~3 Register */
+#define STATUS1_ADC_SHIFT  (0)
+#define STATUS1_ADCLOW_SHIFT   (5)
+#define STATUS1_ADCERR_SHIFT   (6)
+#define STATUS1_ADC1K_SHIFT(7)
+#define STATUS1_ADC_MASK   (0x1f  STATUS1_ADC_SHIFT)
+#define STATUS1_ADCLOW_MASK(0x1  STATUS1_ADCLOW_SHIFT)
+#define STATUS1_ADCERR_MASK(0x1  STATUS1_ADCERR_SHIFT)
+#define STATUS1_ADC1K_MASK (0x1  STATUS1_ADC1K_SHIFT)
+
+#define STATUS2_CHGTYP_SHIFT   (0)
+#define STATUS2_CHGDETRUN_SHIFT(3)
+#define STATUS2_DCDTMR_SHIFT   (4)
+#define STATUS2_DXOVP_SHIFT(5)
+#define STATUS2_VBVOLT_SHIFT   (6)
+#define STATUS2_VIDRM_SHIFT(7)
+#define STATUS2_CHGTYP_MASK(0x7  STATUS2_CHGTYP_SHIFT)
+#define STATUS2_CHGDETRUN_MASK (0x1  STATUS2_CHGDETRUN_SHIFT)
+#define STATUS2_DCDTMR_MASK(0x1  STATUS2_DCDTMR_SHIFT)
+#define STATUS2_DXOVP_MASK (0x1  STATUS2_DXOVP_SHIFT)
+#define STATUS2_VBVOLT_MASK(0x1  STATUS2_VBVOLT_SHIFT)
+#define STATUS2_VIDRM_MASK (0x1  STATUS2_VIDRM_SHIFT)
+
+#define STATUS3_OVP_SHIFT  (2)
+#define STATUS3_OVP_MASK   (0x1  STATUS3_OVP_SHIFT)
+
+/* MAX77693 CDETCTRL1~2 register */
+#define CDETCTRL1_CHGDETEN_SHIFT   (0)
+#define CDETCTRL1_CHGTYPMAN_SHIFT  (1)
+#define CDETCTRL1_DCDEN_SHIFT  (2)
+#define CDETCTRL1_DCD2SCT_SHIFT(3)
+#define CDETCTRL1_CDDELAY_SHIFT(4)
+#define CDETCTRL1_DCDCPL_SHIFT (5)
+#define CDETCTRL1_CDPDET_SHIFT (7)
+#define CDETCTRL1_CHGDETEN_MASK(0x1  
CDETCTRL1_CHGDETEN_SHIFT)
+#define CDETCTRL1_CHGTYPMAN_MASK   (0x1  CDETCTRL1_CHGTYPMAN_SHIFT)
+#define CDETCTRL1_DCDEN_MASK   (0x1  CDETCTRL1_DCDEN_SHIFT)
+#define

Re: [PATCH] mfd: MAX77693: Fix bug of interrupt handlding for MAX77693 devices

2012-07-17 Thread Chanwoo Choi
On 07/18/2012 04:14 AM, Mark Brown wrote:

 On Tue, Jul 17, 2012 at 08:30:17AM +0900, Chanwoo Choi wrote:
 On 07/16/2012 10:36 PM, Mark Brown wrote:
 On Mon, Jul 16, 2012 at 06:41:05PM +0900, Chanwoo Choi wrote:
 
 This patch fix bug related to interrupt handling for MAX77693 devices.
 - Unmask interrupt masking bit for charger/flash/muic to revolve
 that interrupt isn't happened when external connector is attached.
 
 Shouldn't this be happening when the IRQ is requested?
 
 The interrupt isn't happened when external connector is attached
 because muic interrupt of MAX77693 is masked on INTSRC_MASK(
 Interrupt Source Mask) register. So, I should set zero to muic interrupt
 masking bit of INTSRC_MASK before requesting IRQ.
 
 Right, but normally that unmasking happens in the unmask() callback of
 the irq_chip which is called when the interrupt is requested.  Why isn't
 that working here?


As previous reply, Maxim MAX77693 has INTSRC_MASK(Interrput Source Mask,
0x23)
which mask or unmask Charger/Top/Flash/MUIC interrupt. And MAX77693 has
additional 'Interrupt Source Mask' for sub interrupt of each
Charger/Top/Flash/MUIC device.
In case of MUIC device, MUIC device has 16 sub interrupts and then MUIC
device need
separate Interrupt Source Mask(0x1,0x2,0x3) which is included in
register map of
MUIC i2c device and isn't equal to INTSRC_MASK(0x23). As you said,
unmasking sub interrupt of MUIC is happened in unmask() callback using
separate Interrupt Source Mask(0x1, 0x2, 0x3).

The MAX77693 mfd driver handle only INTSRC_MASK(0x23) to activate
Charger/Top/Flash/MUIC interrupt which isn't equal to sub interrupt of
each device before requesting
IRQ. If mfd driver wouldn't unmask Charger/Top/Flash/MUIC interrupt of
INTSRC_MASK(0x23),
it mean that Charger/Top/Flash/MUIC interrupt is inactive state and mfd
driver can't get the any interrupt.

Thank you,
Chanwoo Choi





--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND PATCH 1/2] mfd: add irq domain support for max8997 interrupts

2012-07-17 Thread Chanwoo Choi
On 07/18/2012 01:34 AM, Greg KH wrote:

 On Mon, Jul 02, 2012 at 09:02:55AM +0900, Chanwoo Choi wrote:
 From: Thomas Abraham thomas.abra...@linaro.org

 Add irq domain support for max8997 interrupts. The reverse mapping method
 used is linear mapping since the sub-drivers of max8997 such as regulator
 and charger drivers can use the max8997 irq_domain to get the linux irq
 number for max8997 interrupts. All uses of irq_base in platform data and
 max8997 driver private data are removed.

 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 Acked-by: MyungJoo Ham myungjoo@samsung.com
 Acked-by: Grant Likely grant.lik...@secretlab.ca
 Acked-by: Samuel Ortiz sa...@linux.intel.com
  [Fix two bug which set max8997-irq_domain and correct wrong parameter]
 Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  arch/arm/mach-exynos/mach-nuri.c|4 --
  arch/arm/mach-exynos/mach-origen.c  |1 -
  drivers/mfd/Kconfig |1 +
  drivers/mfd/max8997-irq.c   |   62 
 +--
  drivers/mfd/max8997.c   |1 -
  include/linux/mfd/max8997-private.h |4 ++-
  include/linux/mfd/max8997.h |1 -
  7 files changed, 41 insertions(+), 33 deletions(-)
 
 Once again, this patch breaks the build.
 
 Please be more careful with your patches, and TEST THEM BEFORE SENDING
 THEM OUT.
 


I have posted patchset including below two patch. If only first patch is
applied to build test, this patch breaks the build. The second patch fix
that extcon-max8997 driver use irq_domain instead of irq_base field in
'struct max8997_dev'.

[PATCH v3 1/2] mfd: add irq domain support for max8997 interrupts
[PATCH v3 2/2] Extcon: MAX8997: Add support irq domain for MAX8997 muic

Please apply second patch when test this patchset.

Sorry, I didn't consolidate second patch in the first patch to resolve
build break because of converting  MUIC driver of MAX8997
from 'max8997-muic.c' to 'extcon-max8997.c'.

- http://lkml.org/lkml/2012/5/20/142

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] extcon fixes for 3.9-rc6

2013-04-07 Thread Chanwoo Choi
Hi Greg,

This is extcon fixes for 3.9-rc6
Please pull extcon with following updates.

Best Regards and thanks,
Chanwoo Choi

The following changes since commit 07961ac7c0ee8b546658717034fe692fd12eefa9:

  Linux 3.9-rc5 (2013-03-31 15:12:43 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
tags/extcon-3.9-rc6

for you to fetch changes up to 2fbeb4347e02078828510e5fe43ab4bea21b20d1:

  extcon: max8997: Fix return value (2013-04-08 09:13:18 +0900)


This is small fixes for extcon driver.

MAX77693 extcon driver
- Add 'static' keryword to internal data structure
- Fix return value using 'ret' instead of hardcoding

MAX8997 extcon driver
- Use dev_err() instead of pr_err()
- Fix return value using 'ret' instead of hardcoding


Jingoo Han (1):
  extcon: max8997: use dev_err() instead of pr_err()

Sachin Kamat (3):
  extcon: max77693: Staticize default_init_data
  extcon: max77693: Fix return value
  extcon: max8997: Fix return value

 drivers/extcon/extcon-max77693.c | 10 +-
 drivers/extcon/extcon-max8997.c  | 12 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] extcon fixes for 3.9-rc6

2013-04-07 Thread Chanwoo Choi
On 04/08/2013 11:36 AM, Greg KH wrote:
 On Mon, Apr 08, 2013 at 11:02:14AM +0900, Chanwoo Choi wrote:
 Hi Greg,

 This is extcon fixes for 3.9-rc6
 Please pull extcon with following updates.

 Best Regards and thanks,
 Chanwoo Choi

 The following changes since commit 07961ac7c0ee8b546658717034fe692fd12eefa9:

   Linux 3.9-rc5 (2013-03-31 15:12:43 -0700)

 are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
 tags/extcon-3.9-rc6

 for you to fetch changes up to 2fbeb4347e02078828510e5fe43ab4bea21b20d1:

   extcon: max8997: Fix return value (2013-04-08 09:13:18 +0900)

 
 This is small fixes for extcon driver.

 MAX77693 extcon driver
 - Add 'static' keryword to internal data structure
 - Fix return value using 'ret' instead of hardcoding

 MAX8997 extcon driver
 - Use dev_err() instead of pr_err()
 - Fix return value using 'ret' instead of hardcoding
 None of these should go into 3.9-final, they are all trivial cleanups.
 Only major bug fixes or regressions should be sent right now for 3.9,
 sorry.

 I will be glad to pull these into my -next branch for 3.10 if you want.

 greg k-h

OK, I agree completely with your opinion. Thanks.

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] extcon for 3.10

2013-04-08 Thread Chanwoo Choi
Hi Greg,

This is extcon pull request for v3.10.
Please pull extcon with following updates.

The following changes since commit 07961ac7c0ee8b546658717034fe692fd12eefa9:

  Linux 3.9-rc5 (2013-03-31 15:12:43 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
tags/extcon-for-3.10

for you to fetch changes up to 3ad9e86d54ed2770aa693a90a0872cbe7ffc6831:

  extcon: max8997: Fix return value (2013-04-09 07:53:46 +0900)


This is small fixes for extcon driver.

MAX77693 extcon driver
- Add 'static' keryword to internal data structure
- Fix return value using 'ret' instead of hardcoding

MAX8997 extcon driver
- Use dev_err() instead of pr_err()
- Fix return value using 'ret' instead of hardcoding


Jingoo Han (1):
  extcon: max8997: use dev_err() instead of pr_err()

Sachin Kamat (3):
  extcon: max77693: Staticize default_init_data
  extcon: max77693: Fix return value
  extcon: max8997: Fix return value

 drivers/extcon/extcon-max77693.c | 10 +-
 drivers/extcon/extcon-max8997.c  | 12 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/2] extcon: max77693: Fix return value

2013-03-28 Thread Chanwoo Choi
On 03/28/2013 03:27 PM, Sachin Kamat wrote:
 Return the value obtained from the function instead of hardcoding.
 Silences the following warnings:
 drivers/extcon/extcon-max77693.c:297 max77693_muic_set_path()
 info: why not propagate 'ret' from max77693_update_reg() instead of (-11)?
 drivers/extcon/extcon-max77693.c:310 max77693_muic_set_path()
 info: why not propagate 'ret' from max77693_update_reg() instead of (-11)?

 Signed-off-by: Sachin Kamat sachin.ka...@linaro.org
 ---
 Changes since v1:
 Include additional instances.
 Compile tested.
 ---
  drivers/extcon/extcon-max77693.c |8 
  1 files changed, 4 insertions(+), 4 deletions(-)
Applied this patchset. Thanks.

Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] extcon fixes for 3.9-rc3

2013-03-13 Thread Chanwoo Choi

Hi Greg,

This is extcon fixes for 3.9-rc3.
Please pull extcon with following updates.

Best Regards,
Chanwoo Choi

The following changes since commit 
f6161aa153581da4a3867a2d1a7caf4be19b6ec9:


  Linux 3.9-rc2 (2013-03-10 16:54:19 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
tags/extcon-3.9-rc3


for you to fetch changes up to 0ec83bd2460ed6aed0e7f29f9e0633b054621c02:

  extcon: max77693: Initialize register of MUIC device to bring up it 
without platform data (2013-03-13 17:38:57 +0900)



extcon fixes for 3.9-rc3

This is small fixes against 3.9-rc2.

Fix to max77693 extcon driver:
- Set default value of MUIC register to bring up it.
Fix to max8997 extcon driver:
- Fix null pointer error duing probe when platform data
isn't used.


Chanwoo Choi (3):
  extcon: max8997: Check the pointer of platform data to protect 
null pointer error
  extcon: max77693: Fix bug of wrong pointer when platform data is 
not used
  extcon: max77693: Initialize register of MUIC device to bring up 
it without platform data


 drivers/extcon/extcon-max77693.c | 103 
+++

 drivers/extcon/extcon-max8997.c  |  56 +++
 include/linux/mfd/max77693-private.h |  23 
 3 files changed, 137 insertions(+), 45 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] extcon: max77693: Staticize default_init_data

2013-03-19 Thread Chanwoo Choi
On 03/19/2013 01:07 PM, Sachin Kamat wrote:
 Commit 0ec83bd246 (extcon: max77693: Initialize register of MUIC
 device to bring up it without platform data) added this structure
 but forgot to make it static. Without this patch we get the following
 warning:
 drivers/extcon/extcon-max77693.c:41:26: warning:
 symbol 'default_init_data' was not declared. Should it be static?

 Signed-off-by: Sachin Kamat sachin.ka...@linaro.org
 ---
  drivers/extcon/extcon-max77693.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/extcon/extcon-max77693.c 
 b/drivers/extcon/extcon-max77693.c
 index 8f3c947..7b2e93d 100644
 --- a/drivers/extcon/extcon-max77693.c
 +++ b/drivers/extcon/extcon-max77693.c
 @@ -38,7 +38,7 @@
   * extcon-max77693 driver use 'default_init_data' to bring up base operation
   * of MAX77693 MUIC device.
   */
 -struct max77693_reg_data default_init_data[] = {
 +static struct max77693_reg_data default_init_data[] = {
   {
   /* STATUS2 - [3]ChgDetRun */
   .addr = MAX77693_MUIC_REG_STATUS2,
Applied it. Thanks.

Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/2] extcon: max8997: use dev_err() instead of pr_err()

2013-03-19 Thread Chanwoo Choi
On 03/19/2013 02:30 PM, Jingoo Han wrote:
 dev_err() is more preferred than pr_err().

 Signed-off-by: Jingoo Han jg1@samsung.com
 ---
 No Changes since v1:

  drivers/extcon/extcon-max8997.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
 index 69641bc..20772ad 100644
 --- a/drivers/extcon/extcon-max8997.c
 +++ b/drivers/extcon/extcon-max8997.c
 @@ -646,7 +646,7 @@ static void max8997_muic_detect_cable_wq(struct 
 work_struct *work)
  
   ret = max8997_muic_detect_dev(info);
   if (ret  0)
 - pr_err(failed to detect cable type\n);
 + dev_err(info-dev, failed to detect cable type\n);
  }
  
  static int max8997_muic_probe(struct platform_device *pdev)
Applied it. Thanks.

Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 2/2] extcon: max8997: add missing const

2013-03-19 Thread Chanwoo Choi
On 03/19/2013 02:31 PM, Jingoo Han wrote:
 Fixed the checkpatch warning as below:

   WARNING: static const char * array should probably be static const char * 
 const
   #163: FILE: drivers/extcon/extcon-max8997.c:163:
   +static const char *max8997_extcon_cable[] = {

 Also, const is added to variable 'supported_cable' to prevent
 build warning as below:

   drivers/extcon/extcon-max8997.c: In function 'max8997_muic_probe':
   drivers/extcon/extcon-max8997.c:708:30: warning: assignment discards 
 'const' qualifier from pointer target type [enabled by
 default]

 Signed-off-by: Jingoo Han jg1@samsung.com
 ---
 Changes since v1:
 - Added const to variable 'supported_cable'

  drivers/extcon/extcon-max8997.c |2 +-
  include/linux/extcon.h  |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

 diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
 index 20772ad..b82a591 100644
 --- a/drivers/extcon/extcon-max8997.c
 +++ b/drivers/extcon/extcon-max8997.c
 @@ -160,7 +160,7 @@ enum {
   _EXTCON_CABLE_NUM,
  };
  
 -static const char *max8997_extcon_cable[] = {
 +static const char * const max8997_extcon_cable[] = {
OK.
   [EXTCON_CABLE_USB]  = USB,
   [EXTCON_CABLE_USB_HOST] = USB-Host,
   [EXTCON_CABLE_TA]   = TA,
 diff --git a/include/linux/extcon.h b/include/linux/extcon.h
 index fcb51c8..741a491 100644
 --- a/include/linux/extcon.h
 +++ b/include/linux/extcon.h
 @@ -113,7 +113,7 @@ struct extcon_cable;
  struct extcon_dev {
   /* --- Optional user initializing data --- */
   const char  *name;
 - const char **supported_cable;
 + const char * const *supported_cable;
I understand your intention to fix build warning.
But, I don't agree this coding style. I think this coding
style is not general method.

Thanks,
Chanwoo Choi




--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] extcon: max8997: Fix return value

2013-03-27 Thread Chanwoo Choi
On 03/27/2013 08:23 PM, Sachin Kamat wrote:
 Return the value obtained from the function instead of hardcoding.
 drivers/extcon/extcon-max8997.c:235 max8997_muic_set_path() info:
 why not propagate 'ret' from max8997_update_reg() instead of (-11)?
 drivers/extcon/extcon-max8997.c:248 max8997_muic_set_path() info:
 why not propagate 'ret' from max8997_update_reg() instead of (-11)?

 Signed-off-by: Sachin Kamat sachin.ka...@linaro.org
 ---
  drivers/extcon/extcon-max8997.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

 diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
 index 69641bc..05b76b3 100644
 --- a/drivers/extcon/extcon-max8997.c
 +++ b/drivers/extcon/extcon-max8997.c
 @@ -232,7 +232,7 @@ static int max8997_muic_set_path(struct max8997_muic_info 
 *info,
   MAX8997_MUIC_REG_CONTROL1, ctrl1, COMP_SW_MASK);
   if (ret  0) {
   dev_err(info-dev, failed to update MUIC register\n);
 - return -EAGAIN;
 + return ret;
   }
  
   if (attached)
 @@ -245,7 +245,7 @@ static int max8997_muic_set_path(struct max8997_muic_info 
 *info,
   CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK);
   if (ret  0) {
   dev_err(info-dev, failed to update MUIC register\n);
 - return -EAGAIN;
 + return ret;
   }
  
   dev_info(info-dev,
OK, I agree with your opinion. So, can you fix all of these return type
on extcon-max8997.c? I'd like to receive one patch related
to modification for fixing return type.

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] extcon: max77693: Fix return value

2013-03-27 Thread Chanwoo Choi
On 03/27/2013 08:23 PM, Sachin Kamat wrote:
 Return the value obtained from the function instead of hardcoding.
 Silences the following warning:
 drivers/extcon/extcon-max77693.c:297 max77693_muic_set_path()
 info: why not propagate 'ret' from max77693_update_reg() instead of (-11)?
 drivers/extcon/extcon-max77693.c:310 max77693_muic_set_path()
 info: why not propagate 'ret' from max77693_update_reg() instead of (-11)?

 Signed-off-by: Sachin Kamat sachin.ka...@linaro.org
 ---
  drivers/extcon/extcon-max77693.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

 diff --git a/drivers/extcon/extcon-max77693.c 
 b/drivers/extcon/extcon-max77693.c
 index 8f3c947..894e20e 100644
 --- a/drivers/extcon/extcon-max77693.c
 +++ b/drivers/extcon/extcon-max77693.c
 @@ -294,7 +294,7 @@ static int max77693_muic_set_path(struct 
 max77693_muic_info *info,
   MAX77693_MUIC_REG_CTRL1, ctrl1, COMP_SW_MASK);
   if (ret  0) {
   dev_err(info-dev, failed to update MUIC register\n);
 - return -EAGAIN;
 + return ret;
   }
  
   if (attached)
 @@ -307,7 +307,7 @@ static int max77693_muic_set_path(struct 
 max77693_muic_info *info,
   CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK);
   if (ret  0) {
   dev_err(info-dev, failed to update MUIC register\n);
 - return -EAGAIN;
 + return ret;
   }
  
   dev_info(info-dev,
As my comment about extcon: max8997: Fix return value,
I wish to receive one patch which modify all of return value with 'ret'
in extcon-max77693.c.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/3] extcon: max8997/max77693: Fix bug and set default value to bring up

2013-03-13 Thread Chanwoo Choi
This patchset is small fixes of extcon-max8997/max77693 driver.

Fix to max77693 extcon driver:
- Set default value of MUIC register to bring up it.
when user don't pass specific initial data for MUIC device.
Fix to max8997/max77693 extcon driver:
- Fix wrong pointer on probe() when platform data isn't used.

Chanwoo Choi (3):
  extcon: max8997: Check the pointer of platform data to protect null pointer 
error
  extcon: max77693: Fix bug of wrong pointer when platform data is not used
  extcon: max77693: Initialize register of MUIC device to bring up it without 
platform data

 drivers/extcon/extcon-max77693.c | 103 +++
 drivers/extcon/extcon-max8997.c  |  56 +++
 include/linux/mfd/max77693-private.h |  23 
 3 files changed, 137 insertions(+), 45 deletions(-)

-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] extcon: max77693: Initialize register of MUIC device to bring up it without platform data

2013-03-13 Thread Chanwoo Choi
This patch set default value of MUIC register to bring up MUIC device.

If user don't set some initial value for MUIC device through platform data,
extcon-max77693 driver use 'default_init_data' to bring up base operation
of MAX77693 MUIC device.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max77693.c | 93 ++--
 include/linux/mfd/max77693-private.h | 23 +
 2 files changed, 91 insertions(+), 25 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index fea1062..8f3c947 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -32,6 +32,38 @@
 #defineDEV_NAMEmax77693-muic
 #defineDELAY_MS_DEFAULT2   /* unit: 
millisecond */
 
+/*
+ * Default value of MAX77693 register to bring up MUIC device.
+ * If user don't set some initial value for MUIC device through platform data,
+ * extcon-max77693 driver use 'default_init_data' to bring up base operation
+ * of MAX77693 MUIC device.
+ */
+struct max77693_reg_data default_init_data[] = {
+   {
+   /* STATUS2 - [3]ChgDetRun */
+   .addr = MAX77693_MUIC_REG_STATUS2,
+   .data = STATUS2_CHGDETRUN_MASK,
+   }, {
+   /* INTMASK1 - Unmask [3]ADC1KM,[0]ADCM */
+   .addr = MAX77693_MUIC_REG_INTMASK1,
+   .data = INTMASK1_ADC1K_MASK
+   | INTMASK1_ADC_MASK,
+   }, {
+   /* INTMASK2 - Unmask [0]ChgTypM */
+   .addr = MAX77693_MUIC_REG_INTMASK2,
+   .data = INTMASK2_CHGTYP_MASK,
+   }, {
+   /* INTMASK3 - Mask all of interrupts */
+   .addr = MAX77693_MUIC_REG_INTMASK3,
+   .data = 0x0,
+   }, {
+   /* CDETCTRL2 */
+   .addr = MAX77693_MUIC_REG_CDETCTRL2,
+   .data = CDETCTRL2_VIDRMEN_MASK
+   | CDETCTRL2_DXOVPEN_MASK,
+   },
+};
+
 enum max77693_muic_adc_debounce_time {
ADC_DEBOUNCE_TIME_5MS = 0,
ADC_DEBOUNCE_TIME_10MS,
@@ -1046,6 +1078,8 @@ static int max77693_muic_probe(struct platform_device 
*pdev)
struct max77693_dev *max77693 = dev_get_drvdata(pdev-dev.parent);
struct max77693_platform_data *pdata = dev_get_platdata(max77693-dev);
struct max77693_muic_info *info;
+   struct max77693_reg_data *init_data;
+   int num_init_data;
int delay_jiffies;
int ret;
int i;
@@ -1144,35 +1178,44 @@ static int max77693_muic_probe(struct platform_device 
*pdev)
goto err_irq;
}
 
+
+   /* Initialize MUIC register by using platform data or default data */
if (pdata-muic_data) {
-   struct max77693_muic_platform_data *muic_pdata = 
pdata-muic_data;
+   init_data = pdata-muic_data-init_data;
+   num_init_data = pdata-muic_data-num_init_data;
+   } else {
+   init_data = default_init_data;
+   num_init_data = ARRAY_SIZE(default_init_data);
+   }
+
+   for (i = 0 ; i  num_init_data ; i++) {
+   enum max77693_irq_source irq_src
+   = MAX77693_IRQ_GROUP_NR;
 
-   /* Initialize MUIC register by using platform data */
-   for (i = 0 ; i  muic_pdata-num_init_data ; i++) {
-   enum max77693_irq_source irq_src
-   = MAX77693_IRQ_GROUP_NR;
-
-   max77693_write_reg(info-max77693-regmap_muic,
-   muic_pdata-init_data[i].addr,
-   muic_pdata-init_data[i].data);
-
-   switch (muic_pdata-init_data[i].addr) {
-   case MAX77693_MUIC_REG_INTMASK1:
-   irq_src = MUIC_INT1;
-   break;
-   case MAX77693_MUIC_REG_INTMASK2:
-   irq_src = MUIC_INT2;
-   break;
-   case MAX77693_MUIC_REG_INTMASK3:
-   irq_src = MUIC_INT3;
-   break;
-   }
-
-   if (irq_src  MAX77693_IRQ_GROUP_NR)
-   info-max77693-irq_masks_cur[irq_src]
-   = muic_pdata-init_data[i].data;
+   max77693_write_reg(info-max77693-regmap_muic,
+   init_data[i].addr,
+   init_data[i].data);
+
+   switch (init_data[i].addr) {
+   case MAX77693_MUIC_REG_INTMASK1:
+   irq_src = MUIC_INT1;
+   break;
+   case MAX77693_MUIC_REG_INTMASK2:
+   irq_src = MUIC_INT2

[PATCH 2/3] extcon: max77693: Fix bug of wrong pointer when platform data is not used

2013-03-13 Thread Chanwoo Choi
This patch fix wrong pointer of platform data. If each machine set
platform data for h/w path or delay time of workqueue, this driver
happen kernel panic related to null pointer.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max77693.c | 90 +++-
 1 file changed, 52 insertions(+), 38 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index b70e381..fea1062 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1045,7 +1045,6 @@ static int max77693_muic_probe(struct platform_device 
*pdev)
 {
struct max77693_dev *max77693 = dev_get_drvdata(pdev-dev.parent);
struct max77693_platform_data *pdata = dev_get_platdata(max77693-dev);
-   struct max77693_muic_platform_data *muic_pdata = pdata-muic_data;
struct max77693_muic_info *info;
int delay_jiffies;
int ret;
@@ -1145,44 +1144,63 @@ static int max77693_muic_probe(struct platform_device 
*pdev)
goto err_irq;
}
 
-   /* Initialize MUIC register by using platform data */
-   for (i = 0 ; i  muic_pdata-num_init_data ; i++) {
-   enum max77693_irq_source irq_src = MAX77693_IRQ_GROUP_NR;
-
-   max77693_write_reg(info-max77693-regmap_muic,
-   muic_pdata-init_data[i].addr,
-   muic_pdata-init_data[i].data);
-
-   switch (muic_pdata-init_data[i].addr) {
-   case MAX77693_MUIC_REG_INTMASK1:
-   irq_src = MUIC_INT1;
-   break;
-   case MAX77693_MUIC_REG_INTMASK2:
-   irq_src = MUIC_INT2;
-   break;
-   case MAX77693_MUIC_REG_INTMASK3:
-   irq_src = MUIC_INT3;
-   break;
+   if (pdata-muic_data) {
+   struct max77693_muic_platform_data *muic_pdata = 
pdata-muic_data;
+
+   /* Initialize MUIC register by using platform data */
+   for (i = 0 ; i  muic_pdata-num_init_data ; i++) {
+   enum max77693_irq_source irq_src
+   = MAX77693_IRQ_GROUP_NR;
+
+   max77693_write_reg(info-max77693-regmap_muic,
+   muic_pdata-init_data[i].addr,
+   muic_pdata-init_data[i].data);
+
+   switch (muic_pdata-init_data[i].addr) {
+   case MAX77693_MUIC_REG_INTMASK1:
+   irq_src = MUIC_INT1;
+   break;
+   case MAX77693_MUIC_REG_INTMASK2:
+   irq_src = MUIC_INT2;
+   break;
+   case MAX77693_MUIC_REG_INTMASK3:
+   irq_src = MUIC_INT3;
+   break;
+   }
+
+   if (irq_src  MAX77693_IRQ_GROUP_NR)
+   info-max77693-irq_masks_cur[irq_src]
+   = muic_pdata-init_data[i].data;
}
 
-   if (irq_src  MAX77693_IRQ_GROUP_NR)
-   info-max77693-irq_masks_cur[irq_src]
-   = muic_pdata-init_data[i].data;
-   }
+   /*
+* Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
+* h/w path of COMP2/COMN1 on CONTROL1 register.
+*/
+   if (muic_pdata-path_uart)
+   info-path_uart = muic_pdata-path_uart;
+   else
+   info-path_uart = CONTROL1_SW_UART;
 
-   /*
-* Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
-* h/w path of COMP2/COMN1 on CONTROL1 register.
-*/
-   if (muic_pdata-path_uart)
-   info-path_uart = muic_pdata-path_uart;
-   else
-   info-path_uart = CONTROL1_SW_UART;
+   if (muic_pdata-path_usb)
+   info-path_usb = muic_pdata-path_usb;
+   else
+   info-path_usb = CONTROL1_SW_USB;
 
-   if (muic_pdata-path_usb)
-   info-path_usb = muic_pdata-path_usb;
-   else
+   /*
+* Default delay time for detecting cable state
+* after certain time.
+*/
+   if (muic_pdata-detcable_delay_ms)
+   delay_jiffies =
+   msecs_to_jiffies(muic_pdata-detcable_delay_ms);
+   else
+   delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
+   } else {
info-path_usb = CONTROL1_SW_USB;
+   info-path_uart = CONTROL1_SW_UART;
+   delay_jiffies

[PATCH 1/3] extcon: max8997: Check the pointer of platform data to protect null pointer error

2013-03-13 Thread Chanwoo Choi
This patch check the pointer of platform data to protect
kernel panic when platform data is not used and code clean.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max8997.c | 56 +
 1 file changed, 34 insertions(+), 22 deletions(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index e636d95..69641bc 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -712,29 +712,45 @@ static int max8997_muic_probe(struct platform_device 
*pdev)
goto err_irq;
}
 
-   /* Initialize registers according to platform data */
if (pdata-muic_pdata) {
-   struct max8997_muic_platform_data *mdata = info-muic_pdata;
-
-   for (i = 0; i  mdata-num_init_data; i++) {
-   max8997_write_reg(info-muic, mdata-init_data[i].addr,
-   mdata-init_data[i].data);
+   struct max8997_muic_platform_data *muic_pdata
+   = pdata-muic_pdata;
+
+   /* Initialize registers according to platform data */
+   for (i = 0; i  muic_pdata-num_init_data; i++) {
+   max8997_write_reg(info-muic,
+   muic_pdata-init_data[i].addr,
+   muic_pdata-init_data[i].data);
}
-   }
 
-   /*
-* Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
-* h/w path of COMP2/COMN1 on CONTROL1 register.
-*/
-   if (pdata-muic_pdata-path_uart)
-   info-path_uart = pdata-muic_pdata-path_uart;
-   else
-   info-path_uart = CONTROL1_SW_UART;
+   /*
+* Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
+* h/w path of COMP2/COMN1 on CONTROL1 register.
+*/
+   if (muic_pdata-path_uart)
+   info-path_uart = muic_pdata-path_uart;
+   else
+   info-path_uart = CONTROL1_SW_UART;
 
-   if (pdata-muic_pdata-path_usb)
-   info-path_usb = pdata-muic_pdata-path_usb;
-   else
+   if (muic_pdata-path_usb)
+   info-path_usb = muic_pdata-path_usb;
+   else
+   info-path_usb = CONTROL1_SW_USB;
+
+   /*
+* Default delay time for detecting cable state
+* after certain time.
+*/
+   if (muic_pdata-detcable_delay_ms)
+   delay_jiffies =
+   msecs_to_jiffies(muic_pdata-detcable_delay_ms);
+   else
+   delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
+   } else {
+   info-path_uart = CONTROL1_SW_UART;
info-path_usb = CONTROL1_SW_USB;
+   delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
+   }
 
/* Set initial path for UART */
 max8997_muic_set_path(info, info-path_uart, true);
@@ -751,10 +767,6 @@ static int max8997_muic_probe(struct platform_device *pdev)
 * driver should notify cable state to upper layer.
 */
INIT_DELAYED_WORK(info-wq_detcable, max8997_muic_detect_cable_wq);
-   if (pdata-muic_pdata-detcable_delay_ms)
-   delay_jiffies = 
msecs_to_jiffies(pdata-muic_pdata-detcable_delay_ms);
-   else
-   delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
schedule_delayed_work(info-wq_detcable, delay_jiffies);
 
return 0;
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] EXTCON: Get and set cable properties

2012-12-02 Thread Chanwoo Choi
We discussed about this patch and then suggest some method to resolve
this issue by Myungjoo Ham. Why don't you write additional feature or
your opinion based on following patch by Myungjoo Ham?
-
http://git.kernel.org/?p=linux/kernel/git/mzx/extcon.git;a=commitdiff;h=7312b79d69a2b9f06af4f1254bc4644751e3e3ea


On 11/28/2012 06:49 AM, Jenny TC wrote:
 Existing EXTCON implementation doesn't give a mechanim to read the cable
 properties and extra states a cable needs to support. There are scenarios
 where a cable can have more than two states(CONNECT/DISCONNECT/SUSPEND/RESUME 
 etc)
 and can have some properties associated with cables(mA)
 
 This patch introduces interface to get and set cable properties
 from EXTCON framework. The cable property can be set either by
 the extcon cable provider or by other subsystems who know the cable
 properties using eth API extcon_cable_set_data()
 
 When the consumer gets a notification from the extcon, it can use the
 extcon_cable_get_data() to get the cable properties irrespective of who
 provides the cable data.
 
 This gives a single interface for setting and getting the cable properties.
 
 Signed-off-by: Jenny TC jenny...@intel.com
 ---
  drivers/extcon/extcon-class.c |   30 ++
  include/linux/extcon.h|   39 +++
  2 files changed, 69 insertions(+)
 
 diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
 index d398821..304f343 100644
 --- a/drivers/extcon/extcon-class.c
 +++ b/drivers/extcon/extcon-class.c
 @@ -545,6 +545,36 @@ int extcon_unregister_notifier(struct extcon_dev *edev,
  }
  EXPORT_SYMBOL_GPL(extcon_unregister_notifier);
  
 +/**
 + * extcon_cable_set_data() - Set the data structure for a cable
 + * @edev:the extcon device
 + * @cable_index: the cable index of the correspondant
 + * @type:type of the data structure
 + * @data:
 + */
 +void extcon_cable_set_data(struct extcon_dev *edev, int cable_index,
 +enum extcon_cable_name type,
 +union extcon_cable_data data)
 +{
 + edev-cables[cable_index].type = type;
 + edev-cables[cable_index].data = data;
 +}
 +
 +/**
 + * extcon_cable_get_data() - Get the data structure for a cable
 + * @edev:the extcon device
 + * @cable_index: the cable index of the correspondant
 + * @type:type of the data structure
 + * @data:the corresponding data structure (e.g., regulator)
 + */
 +void extcon_cable_get_data(struct extcon_dev *edev, int cable_index,
 +enum extcon_cable_name *type,
 +union extcon_cable_data *data)
 +{
 + *type = edev-cables[cable_index].type;
 + *data = edev-cables[cable_index].data;
 +}
 +
  static struct device_attribute extcon_attrs[] = {
   __ATTR(state, S_IRUGO | S_IWUSR, state_show, state_store),
   __ATTR_RO(name),
 diff --git a/include/linux/extcon.h b/include/linux/extcon.h
 index 2c26c14..4556cc5 100644
 --- a/include/linux/extcon.h
 +++ b/include/linux/extcon.h
 @@ -135,6 +135,19 @@ struct extcon_dev {
   struct device_attribute *d_attrs_muex;
  };
  
 +/* FIXME: Is this the right place for this structure definition?
 + * Do we need to move it to power_supply.h?
 + */
 +struct extcon_chrgr_cable_props {
 + unsigned long state;
 + int mA;
 +};

As I said, extcon provider driver didn't provide directly charging current(int 
mA)
and some state(unsigned long state) because the extcon provider driver(Micro
USB interface controller device or other device related to external connector) 
haven't
mechanism which detect dynamically charging current immediately. If you wish to
provide charging current data to extcon consumer driver or framework, you should
use regulator/power_supply framework or other method in extcon provider driver.

The patch suggested by Myungjoo Ham define following struct:
union extcon_cable_data {
struct regualtor *reg;  /* EXTCON_CT_REGULATOR */
struct power_supply *psy; /* EXTCON_CT_PSY */
struct charger_cable *charger; /* EXTCON_CT_CHARGER_MANAGER */
/* Please add accordingly with enum extcon_cable_type */
};

Also if you want to define 'struct extcon_chrgr_cable_props', you should 
certainly show how
detect dynamically charging current or state.

 +
 +union extcon_cable_data {
 + struct extcon_chrgr_cable_props chrgr_cbl_props;
 + /* Please add accordingly*/
 +};
 +
  /**
   * struct extcon_cable   - An internal data for each cable of extcon 
 device.
   * @edev The extcon device
 @@ -143,6 +156,8 @@ struct extcon_dev {
   * @attr_namename sysfs entry
   * @attr_state   state sysfs entry
   * @attrsArray pointing to attr_name and attr_state for attr_g
 + * @type:The type of @data.
 + * @data:The data structure representing the status and states of this 
 cable.
   */
  struct extcon_cable {
   struct 

[PATCH 0/9] extcon: Update for extcon-max8997/77693

2013-02-13 Thread Chanwoo Choi
This patchset add a few new feature of extcon-max8997
and fix minor issue of extcon-max8997/77693.

Update extcon-max8997 driver
- Consolidate duplicate code
- Set default uart/usb path for internal line of muic device
- Set default ADC debounce time
- Use wq to check cable state after certain delay
- Code clean to move defined constant to header file
- Make max8997_extcon_cable static
Update extcon-max77693 driver
- Convert to devm_input_allocate_device()
- Code clean to remove unnecessary goto statement
- Make max77693_extcon_cable static
Rename extcon-gpio.c filename for kernel naming style

Thanks,
Chanwoo Choi

Chanwoo Choi (9):
  extcon: gpio: Rename filename of extcon-gpio.c according to kernel naming 
style
  extcon: max77693: Convert to devm_input_allocate_device()
  extcon: max77693: Remove unnecessary goto statement to improve readability
  extcon: max8997: Move defined constant to header file
  extcon: max8997: Remove duplicate code related to set H/W line path
  extcon: max8997: Set default of ADC debounce time during initialization
  extcon: max8997: Consolidate duplicate code for checking ADC/CHG cable type
  extcon: max8997: Set default UART/USB path on probe
  extcon: max8997: Use workqueue to check cable state after completing boot of 
platform

 drivers/extcon/extcon-gpio.c|   2 +-
 drivers/extcon/extcon-max77693.c|  79 ++--
 drivers/extcon/extcon-max8997.c | 725 
 include/linux/extcon/extcon-gpio.h  |  52 +++
 include/linux/extcon/extcon_gpio.h  |  52 ---
 include/linux/mfd/max8997-private.h |  64 
 include/linux/mfd/max8997.h |  25 +-
 7 files changed, 662 insertions(+), 337 deletions(-)
 create mode 100644 include/linux/extcon/extcon-gpio.h
 delete mode 100644 include/linux/extcon/extcon_gpio.h

-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/9] extcon: max8997: Set default of ADC debounce time during initialization

2013-02-13 Thread Chanwoo Choi
This patch set default of ADC Debounce Time(25ms) during probe step.
Also, can possible change ADC Debounce Time according to H/W situation
by using max8997_set_adc_debounce_time()

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max8997.c | 42 +
 include/linux/mfd/max8997-private.h |  7 +++
 2 files changed, 49 insertions(+)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 8739b50..3206daa 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -30,6 +30,13 @@
 
 #defineDEV_NAMEmax8997-muic
 
+enum max8997_muic_adc_debounce_time {
+   ADC_DEBOUNCE_TIME_0_5MS = 0,/* 0.5ms */
+   ADC_DEBOUNCE_TIME_10MS, /* 10ms */
+   ADC_DEBOUNCE_TIME_25MS, /* 25ms */
+   ADC_DEBOUNCE_TIME_38_62MS,  /* 38.62ms */
+};
+
 struct max8997_muic_irq {
unsigned int irq;
const char *name;
@@ -95,6 +102,38 @@ static const char *max8997_extcon_cable[] = {
 };
 
 /*
+ * max8997_muic_set_debounce_time - Set the debounce time of ADC
+ * @info: the instance including private data of max8997 MUIC
+ * @time: the debounce time of ADC
+ */
+static int max8997_muic_set_debounce_time(struct max8997_muic_info *info,
+   enum max8997_muic_adc_debounce_time time)
+{
+   int ret;
+
+   switch (time) {
+   case ADC_DEBOUNCE_TIME_0_5MS:
+   case ADC_DEBOUNCE_TIME_10MS:
+   case ADC_DEBOUNCE_TIME_25MS:
+   case ADC_DEBOUNCE_TIME_38_62MS:
+   ret = max8997_update_reg(info-muic,
+ MAX8997_MUIC_REG_CONTROL3,
+ time  CONTROL3_ADCDBSET_SHIFT,
+ CONTROL3_ADCDBSET_MASK);
+   if (ret) {
+   dev_err(info-dev, failed to set ADC debounce time\n);
+   return -EAGAIN;
+   }
+   break;
+   default:
+   dev_err(info-dev, invalid ADC debounce time\n);
+   return -EINVAL;
+   }
+
+   return 0;
+};
+
+/*
  * max8997_muic_set_path - Set hardware line according to attached cable
  * @info: the instance including private data of max8997 MUIC
  * @value: the path according to attached cable
@@ -507,6 +546,9 @@ static int max8997_muic_probe(struct platform_device *pdev)
}
}
 
+   /* Set ADC debounce time */
+   max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);
+
/* Initial device detection */
max8997_muic_detect_dev(info);
 
diff --git a/include/linux/mfd/max8997-private.h 
b/include/linux/mfd/max8997-private.h
index 010173a..cd37a92 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -251,6 +251,13 @@ enum max8997_muic_reg {
 #define CONTROL2_USBCPINT_MASK (0x1  CONTROL2_USBCPINT_SHIFT)
 #define CONTROL2_RCPS_MASK (0x1  CONTROL2_RCPS_SHIFT)
 
+#define CONTROL3_JIGSET_SHIFT  (0)
+#define CONTROL3_BTLDSET_SHIFT (2)
+#define CONTROL3_ADCDBSET_SHIFT(4)
+#define CONTROL3_JIGSET_MASK   (0x3  CONTROL3_JIGSET_SHIFT)
+#define CONTROL3_BTLDSET_MASK  (0x3  CONTROL3_BTLDSET_SHIFT)
+#define CONTROL3_ADCDBSET_MASK (0x3  CONTROL3_ADCDBSET_SHIFT)
+
 #defineMAX8997_ADC_GROUND  0x00
 #defineMAX8997_ADC_MHL 0x01
 #defineMAX8997_ADC_JIG_USB_1   0x18
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 9/9] extcon: max8997: Use workqueue to check cable state after completing boot of platform

2013-02-13 Thread Chanwoo Choi
This patch use delayed workqueue to check cable state after a certain
time. If extcon-max8997 driver check cable state during booting of
platform, this couldn't send the correct notification of cable state
to extcon consumer. Alwasys, this driver should check cable state
after the completion of platform initialization

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max8997.c | 45 -
 include/linux/mfd/max8997.h |  3 +++
 2 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 349f65f..e636d95 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -29,6 +29,7 @@
 #include linux/irqdomain.h
 
 #defineDEV_NAMEmax8997-muic
+#defineDELAY_MS_DEFAULT2   /* unit: 
millisecond */
 
 enum max8997_muic_adc_debounce_time {
ADC_DEBOUNCE_TIME_0_5MS = 0,/* 0.5ms */
@@ -129,6 +130,14 @@ struct max8997_muic_info {
enum max8997_muic_charger_type pre_charger_type;
 
/*
+* Use delayed workqueue to detect cable state and then
+* notify cable state to notifiee/platform through uevent.
+* After completing the booting of platform, the extcon provider
+* driver should notify cable state to upper layer.
+*/
+   struct delayed_work wq_detcable;
+
+   /*
 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
 * h/w path of COMP2/COMN1 on CONTROL1 register.
 */
@@ -629,11 +638,23 @@ static int max8997_muic_detect_dev(struct 
max8997_muic_info *info)
return 0;
 }
 
+static void max8997_muic_detect_cable_wq(struct work_struct *work)
+{
+   struct max8997_muic_info *info = container_of(to_delayed_work(work),
+   struct max8997_muic_info, wq_detcable);
+   int ret;
+
+   ret = max8997_muic_detect_dev(info);
+   if (ret  0)
+   pr_err(failed to detect cable type\n);
+}
+
 static int max8997_muic_probe(struct platform_device *pdev)
 {
struct max8997_dev *max8997 = dev_get_drvdata(pdev-dev.parent);
struct max8997_platform_data *pdata = dev_get_platdata(max8997-dev);
struct max8997_muic_info *info;
+   int delay_jiffies;
int ret, i;
 
info = devm_kzalloc(pdev-dev, sizeof(struct max8997_muic_info),
@@ -721,17 +742,23 @@ static int max8997_muic_probe(struct platform_device 
*pdev)
/* Set ADC debounce time */
max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);
 
-   /* Initial device detection */
-   ret = max8997_muic_detect_dev(info);
-   if (ret  0) {
-   dev_err(pdev-dev, failed to detect cable type\n);
-   goto err_extcon;
-   }
+   /*
+* Detect accessory after completing the initialization of platform
+*
+* - Use delayed workqueue to detect cable state and then
+* notify cable state to notifiee/platform through uevent.
+* After completing the booting of platform, the extcon provider
+* driver should notify cable state to upper layer.
+*/
+   INIT_DELAYED_WORK(info-wq_detcable, max8997_muic_detect_cable_wq);
+   if (pdata-muic_pdata-detcable_delay_ms)
+   delay_jiffies = 
msecs_to_jiffies(pdata-muic_pdata-detcable_delay_ms);
+   else
+   delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
+   schedule_delayed_work(info-wq_detcable, delay_jiffies);
 
-   return ret;
+   return 0;
 
-err_extcon:
-   extcon_dev_unregister(info-edev);
 err_irq:
while (--i = 0)
free_irq(muic_irqs[i].virq, info);
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 2d2d67b..cf81557 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -93,6 +93,9 @@ struct max8997_muic_platform_data {
struct max8997_muic_reg_data *init_data;
int num_init_data;
 
+   /* Check cable state after certain delay */
+   int detcable_delay_ms;
+
/*
 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
 * h/w path of COMP2/COMN1 on CONTROL1 register.
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 8/9] extcon: max8997: Set default UART/USB path on probe

2013-02-13 Thread Chanwoo Choi
This patch set default H/W line path according to platfomr data.
The MAX8997 MUIC device can possibly set UART/USB or UART_AUX
/USB_AUX to internal H/W line path of MUIC device. Namely, only
one H/W line is used for two operation.

For example,
if H/W line path of MAX8997 device set UART/USB, micro usb cable
is connected to AP(Application Processor) and if H/W line path
set UART_AUX/USB_AUX, micro usb cable is connected to CP(Coprocessor).

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max8997.c | 28 ++--
 include/linux/mfd/max8997.h |  7 +++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 35338a0..349f65f 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -127,6 +127,13 @@ struct max8997_muic_info {
 
struct max8997_muic_platform_data *muic_pdata;
enum max8997_muic_charger_type pre_charger_type;
+
+   /*
+* Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
+* h/w path of COMP2/COMN1 on CONTROL1 register.
+*/
+   int path_usb;
+   int path_uart;
 };
 
 enum {
@@ -322,7 +329,7 @@ static int max8997_muic_handle_usb(struct max8997_muic_info 
*info,
int ret = 0;
 
if (usb_type == MAX8997_USB_HOST) {
-   ret = max8997_muic_set_path(info, CONTROL1_SW_USB, attached);
+   ret = max8997_muic_set_path(info, info-path_usb, attached);
if (ret  0) {
dev_err(info-dev, failed to update muic register\n);
return ret;
@@ -378,7 +385,7 @@ static int max8997_muic_handle_jig_uart(struct 
max8997_muic_info *info,
int ret = 0;
 
/* switch to UART */
-   ret = max8997_muic_set_path(info, CONTROL1_SW_UART, attached);
+   ret = max8997_muic_set_path(info, info-path_uart, attached);
if (ret) {
dev_err(info-dev, failed to update muic register\n);
return -EINVAL;
@@ -694,6 +701,23 @@ static int max8997_muic_probe(struct platform_device *pdev)
}
}
 
+   /*
+* Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
+* h/w path of COMP2/COMN1 on CONTROL1 register.
+*/
+   if (pdata-muic_pdata-path_uart)
+   info-path_uart = pdata-muic_pdata-path_uart;
+   else
+   info-path_uart = CONTROL1_SW_UART;
+
+   if (pdata-muic_pdata-path_usb)
+   info-path_usb = pdata-muic_pdata-path_usb;
+   else
+   info-path_usb = CONTROL1_SW_USB;
+
+   /* Set initial path for UART */
+max8997_muic_set_path(info, info-path_uart, true);
+
/* Set ADC debounce time */
max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);
 
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 65f8d6a..2d2d67b 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -92,6 +92,13 @@ struct max8997_muic_reg_data {
 struct max8997_muic_platform_data {
struct max8997_muic_reg_data *init_data;
int num_init_data;
+
+   /*
+* Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
+* h/w path of COMP2/COMN1 on CONTROL1 register.
+*/
+   int path_usb;
+   int path_uart;
 };
 
 enum max8997_haptic_motor_type {
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/9] extcon: max8997: Remove duplicate code related to set H/W line path

2013-02-13 Thread Chanwoo Choi
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max8997.c | 62 ++---
 include/linux/mfd/max8997-private.h | 19 +++-
 2 files changed, 69 insertions(+), 12 deletions(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 0fb1d48..8739b50 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -94,16 +94,61 @@ static const char *max8997_extcon_cable[] = {
NULL,
 };
 
+/*
+ * max8997_muic_set_path - Set hardware line according to attached cable
+ * @info: the instance including private data of max8997 MUIC
+ * @value: the path according to attached cable
+ * @attached: the state of cable (true:attached, false:detached)
+ *
+ * The max8997 MUIC device share outside H/W line among a varity of cables,
+ * so this function set internal path of H/W line according to the type of
+ * attached cable.
+ */
+static int max8997_muic_set_path(struct max8997_muic_info *info,
+   u8 val, bool attached)
+{
+   int ret = 0;
+   u8 ctrl1, ctrl2 = 0;
+
+   if (attached)
+   ctrl1 = val;
+   else
+   ctrl1 = CONTROL1_SW_OPEN;
+
+   ret = max8997_update_reg(info-muic,
+   MAX8997_MUIC_REG_CONTROL1, ctrl1, COMP_SW_MASK);
+   if (ret  0) {
+   dev_err(info-dev, failed to update MUIC register\n);
+   return -EAGAIN;
+   }
+
+   if (attached)
+   ctrl2 |= CONTROL2_CPEN_MASK;/* LowPwr=0, CPEn=1 */
+   else
+   ctrl2 |= CONTROL2_LOWPWR_MASK;  /* LowPwr=1, CPEn=0 */
+
+   ret = max8997_update_reg(info-muic,
+   MAX8997_MUIC_REG_CONTROL2, ctrl2,
+   CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK);
+   if (ret  0) {
+   dev_err(info-dev, failed to update MUIC register\n);
+   return -EAGAIN;
+   }
+
+   dev_info(info-dev,
+   CONTROL1 : 0x%02x, CONTROL2 : 0x%02x, state : %s\n,
+   ctrl1, ctrl2, attached ? attached : detached);
+
+   return 0;
+}
+
 static int max8997_muic_handle_usb(struct max8997_muic_info *info,
enum max8997_muic_usb_type usb_type, bool attached)
 {
int ret = 0;
 
if (usb_type == MAX8997_USB_HOST) {
-   /* switch to USB */
-   ret = max8997_update_reg(info-muic, MAX8997_MUIC_REG_CONTROL1,
-   attached ? CONTROL1_SW_USB : CONTROL1_SW_OPEN,
-   CONTROL1_SW_MASK);
+   ret = max8997_muic_set_path(info, CONTROL1_SW_USB, attached);
if (ret) {
dev_err(info-dev, failed to update muic register\n);
goto out;
@@ -131,10 +176,7 @@ static int max8997_muic_handle_dock(struct 
max8997_muic_info *info,
 {
int ret = 0;
 
-   /* switch to AUDIO */
-   ret = max8997_update_reg(info-muic, MAX8997_MUIC_REG_CONTROL1,
-   attached ? CONTROL1_SW_AUDIO : CONTROL1_SW_OPEN,
-   CONTROL1_SW_MASK);
+   ret = max8997_muic_set_path(info, CONTROL1_SW_AUDIO, attached);
if (ret) {
dev_err(info-dev, failed to update muic register\n);
goto out;
@@ -161,9 +203,7 @@ static int max8997_muic_handle_jig_uart(struct 
max8997_muic_info *info,
int ret = 0;
 
/* switch to UART */
-   ret = max8997_update_reg(info-muic, MAX8997_MUIC_REG_CONTROL1,
-   attached ? CONTROL1_SW_UART : CONTROL1_SW_OPEN,
-   CONTROL1_SW_MASK);
+   ret = max8997_muic_set_path(info, CONTROL1_SW_UART, attached);
if (ret) {
dev_err(info-dev, failed to update muic register\n);
goto out;
diff --git a/include/linux/mfd/max8997-private.h 
b/include/linux/mfd/max8997-private.h
index acf42e9..010173a 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -223,7 +223,7 @@ enum max8997_muic_reg {
 #define COMP2SW_SHIFT  3
 #define COMN1SW_MASK   (0x7  COMN1SW_SHIFT)
 #define COMP2SW_MASK   (0x7  COMP2SW_SHIFT)
-#define CONTROL1_SW_MASK   (COMP2SW_MASK | COMN1SW_MASK)
+#define COMP_SW_MASK   (COMP2SW_MASK | COMN1SW_MASK)
 
 #define CONTROL1_SW_USB((1  COMP2SW_SHIFT) \
| (1  COMN1SW_SHIFT))
@@ -234,6 +234,23 @@ enum max8997_muic_reg {
 #define CONTROL1_SW_OPEN   ((0  COMP2SW_SHIFT) \
| (0  COMN1SW_SHIFT))
 
+#define CONTROL2_LOWPWR_SHIFT  (0)
+#define CONTROL2_ADCEN_SHIFT   (1)
+#define CONTROL2_CPEN_SHIFT(2)
+#define CONTROL2_SFOUTASRT_SHIFT   (3)
+#define

[PATCH 7/9] extcon: max8997: Consolidate duplicate code for checking ADC/CHG cable type

2013-02-13 Thread Chanwoo Choi
This patch make max8997_muic_get_cable_type() function to remove
duplicate code for checking ADC/Charger cable type because almost
internal function need to read adc/chg_type value of MUIC register.

Also, remove *_detach() function, extcon-max8997 driver treat
attach/detach operation of cable in max8997_*_handler() function.
Lastly, this patch move defined constant in header file(include/
linux/mfd/max8997.h, max8997-private.h) because defined constant
is only used in the 'extcon-max8997.c'.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max8997.c | 492 +++-
 include/linux/mfd/max8997-private.h |   9 -
 include/linux/mfd/max8997.h |  15 --
 3 files changed, 323 insertions(+), 193 deletions(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 3206daa..35338a0 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -44,31 +44,89 @@ struct max8997_muic_irq {
 };
 
 static struct max8997_muic_irq muic_irqs[] = {
-   { MAX8997_MUICIRQ_ADCError, muic-ADC_error },
-   { MAX8997_MUICIRQ_ADCLow, muic-ADC_low },
-   { MAX8997_MUICIRQ_ADC, muic-ADC },
-   { MAX8997_MUICIRQ_VBVolt, muic-VB_voltage },
-   { MAX8997_MUICIRQ_DBChg, muic-DB_charger },
-   { MAX8997_MUICIRQ_DCDTmr, muic-DCD_timer },
-   { MAX8997_MUICIRQ_ChgDetRun, muic-CDR_status },
-   { MAX8997_MUICIRQ_ChgTyp, muic-charger_type },
-   { MAX8997_MUICIRQ_OVP, muic-over_voltage },
+   { MAX8997_MUICIRQ_ADCError, muic-ADCERROR },
+   { MAX8997_MUICIRQ_ADCLow,   muic-ADCLOW },
+   { MAX8997_MUICIRQ_ADC,  muic-ADC },
+   { MAX8997_MUICIRQ_VBVolt,   muic-VBVOLT },
+   { MAX8997_MUICIRQ_DBChg,muic-DBCHG },
+   { MAX8997_MUICIRQ_DCDTmr,   muic-DCDTMR },
+   { MAX8997_MUICIRQ_ChgDetRun,muic-CHGDETRUN },
+   { MAX8997_MUICIRQ_ChgTyp,   muic-CHGTYP },
+   { MAX8997_MUICIRQ_OVP,  muic-OVP },
+};
+
+/* Define supported cable type */
+enum max8997_muic_acc_type {
+   MAX8997_MUIC_ADC_GROUND = 0x0,
+   MAX8997_MUIC_ADC_MHL,   /* MHL*/
+   MAX8997_MUIC_ADC_REMOTE_S1_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S2_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S3_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S4_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S5_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S6_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S7_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S8_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S9_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S10_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S11_BUTTON,
+   MAX8997_MUIC_ADC_REMOTE_S12_BUTTON,
+   MAX8997_MUIC_ADC_RESERVED_ACC_1,
+   MAX8997_MUIC_ADC_RESERVED_ACC_2,
+   MAX8997_MUIC_ADC_RESERVED_ACC_3,
+   MAX8997_MUIC_ADC_RESERVED_ACC_4,
+   MAX8997_MUIC_ADC_RESERVED_ACC_5,
+   MAX8997_MUIC_ADC_CEA936_AUDIO,
+   MAX8997_MUIC_ADC_PHONE_POWERED_DEV,
+   MAX8997_MUIC_ADC_TTY_CONVERTER,
+   MAX8997_MUIC_ADC_UART_CABLE,
+   MAX8997_MUIC_ADC_CEA936A_TYPE1_CHG,
+   MAX8997_MUIC_ADC_FACTORY_MODE_USB_OFF,  /* JIG-USB-OFF */
+   MAX8997_MUIC_ADC_FACTORY_MODE_USB_ON,   /* JIG-USB-ON */
+   MAX8997_MUIC_ADC_AV_CABLE_NOLOAD,   /* DESKDOCK */
+   MAX8997_MUIC_ADC_CEA936A_TYPE2_CHG,
+   MAX8997_MUIC_ADC_FACTORY_MODE_UART_OFF, /* JIG-UART */
+   MAX8997_MUIC_ADC_FACTORY_MODE_UART_ON,  /* CARDOCK */
+   MAX8997_MUIC_ADC_AUDIO_MODE_REMOTE,
+   MAX8997_MUIC_ADC_OPEN,  /* OPEN */
+};
+
+enum max8997_muic_cable_group {
+   MAX8997_CABLE_GROUP_ADC = 0,
+   MAX8997_CABLE_GROUP_ADC_GND,
+   MAX8997_CABLE_GROUP_CHG,
+   MAX8997_CABLE_GROUP_VBVOLT,
+};
+
+enum max8997_muic_usb_type {
+   MAX8997_USB_HOST,
+   MAX8997_USB_DEVICE,
+};
+
+enum max8997_muic_charger_type {
+   MAX8997_CHARGER_TYPE_NONE = 0,
+   MAX8997_CHARGER_TYPE_USB,
+   MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT,
+   MAX8997_CHARGER_TYPE_DEDICATED_CHG,
+   MAX8997_CHARGER_TYPE_500MA,
+   MAX8997_CHARGER_TYPE_1A,
+   MAX8997_CHARGER_TYPE_DEAD_BATTERY = 7,
 };
 
 struct max8997_muic_info {
struct device *dev;
struct i2c_client *muic;
-   struct max8997_muic_platform_data *muic_pdata;
+   struct extcon_dev *edev;
+   int prev_cable_type;
+   int prev_chg_type;
+   u8 status[2];
 
int irq;
struct work_struct irq_work;
-
-   enum max8997_muic_charger_type pre_charger_type;
-   int pre_adc;
-
struct mutex mutex;
 
-   struct extcon_dev   *edev;
+   struct max8997_muic_platform_data *muic_pdata;
+   enum max8997_muic_charger_type pre_charger_type;
 };
 
 enum {
@@ -181,6 +239,83 @@ static int max8997_muic_set_path(struct max8997_muic_info 
*info,
return 0;
 }
 
+/*
+ * max8997_muic_get_cable_type - Return cable type and check

[PATCH 2/9] extcon: max77693: Convert to devm_input_allocate_device()

2013-02-13 Thread Chanwoo Choi
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max77693.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index a645268..3b1f238 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1066,7 +1066,7 @@ static int max77693_muic_probe(struct platform_device 
*pdev)
}
 
/* Register input device for button of dock device */
-   info-dock = input_allocate_device();
+   info-dock = devm_input_allocate_device(pdev-dev);
if (!info-dock) {
dev_err(pdev-dev, %s: failed to allocate input\n, __func__);
return -ENOMEM;
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/9] extcon: max77693: Remove unnecessary goto statement to improve readability

2013-02-13 Thread Chanwoo Choi
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max77693.c | 77 ++--
 1 file changed, 43 insertions(+), 34 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 3b1f238..b70e381 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -224,16 +224,17 @@ static int max77693_muic_set_debounce_time(struct 
max77693_muic_info *info,
  MAX77693_MUIC_REG_CTRL3,
  time  CONTROL3_ADCDBSET_SHIFT,
  CONTROL3_ADCDBSET_MASK);
-   if (ret)
+   if (ret) {
dev_err(info-dev, failed to set ADC debounce time\n);
+   return -EAGAIN;
+   }
break;
default:
dev_err(info-dev, invalid ADC debounce time\n);
-   ret = -EINVAL;
-   break;
+   return -EINVAL;
}
 
-   return ret;
+   return 0;
 };
 
 /*
@@ -261,7 +262,7 @@ static int max77693_muic_set_path(struct max77693_muic_info 
*info,
MAX77693_MUIC_REG_CTRL1, ctrl1, COMP_SW_MASK);
if (ret  0) {
dev_err(info-dev, failed to update MUIC register\n);
-   goto out;
+   return -EAGAIN;
}
 
if (attached)
@@ -274,14 +275,14 @@ static int max77693_muic_set_path(struct 
max77693_muic_info *info,
CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK);
if (ret  0) {
dev_err(info-dev, failed to update MUIC register\n);
-   goto out;
+   return -EAGAIN;
}
 
dev_info(info-dev,
CONTROL1 : 0x%02x, CONTROL2 : 0x%02x, state : %s\n,
ctrl1, ctrl2, attached ? attached : detached);
-out:
-   return ret;
+
+   return 0;
 }
 
 /*
@@ -503,6 +504,10 @@ static int max77693_muic_dock_handler(struct 
max77693_muic_info *info,
if (!attached)
extcon_set_cable_state(info-edev, USB, false);
break;
+   default:
+   dev_err(info-dev, failed to detect %s dock device\n,
+   attached ? attached : detached);
+   return -EINVAL;
}
 
/* Dock-Car/Desk/Audio, PATH:AUDIO */
@@ -520,7 +525,6 @@ static int max77693_muic_dock_button_handler(struct 
max77693_muic_info *info,
 {
struct input_dev *dock = info-dock;
unsigned int code;
-   int ret = 0;
 
switch (button_type) {
case MAX77693_MUIC_ADC_REMOTE_S3_BUTTON-1
@@ -550,14 +554,12 @@ static int max77693_muic_dock_button_handler(struct 
max77693_muic_info *info,
dev_err(info-dev,
failed to detect %s key (adc:0x%x)\n,
attached ? pressed : released, button_type);
-   ret = -EINVAL;
-   goto out;
+   return -EINVAL;
}
 
input_event(dock, EV_KEY, code, attached);
input_sync(dock);
 
-out:
return 0;
 }
 
@@ -576,14 +578,14 @@ static int max77693_muic_adc_ground_handler(struct 
max77693_muic_info *info)
/* USB_OTG, PATH: AP_USB */
ret = max77693_muic_set_path(info, CONTROL1_SW_USB, attached);
if (ret  0)
-   goto out;
+   return ret;
extcon_set_cable_state(info-edev, USB-Host, attached);
break;
case MAX77693_MUIC_GND_AV_CABLE_LOAD:
/* Audio Video Cable with load, PATH:AUDIO */
ret = max77693_muic_set_path(info, CONTROL1_SW_AUDIO, attached);
if (ret  0)
-   goto out;
+   return ret;
extcon_set_cable_state(info-edev,
Audio-video-load, attached);
break;
@@ -593,14 +595,12 @@ static int max77693_muic_adc_ground_handler(struct 
max77693_muic_info *info)
extcon_set_cable_state(info-edev, MHL, attached);
break;
default:
-   dev_err(info-dev, failed to detect %s accessory\n,
+   dev_err(info-dev, failed to detect %s cable of gnd type\n,
attached ? attached : detached);
-   ret = -EINVAL;
-   break;
+   return -EINVAL;
}
 
-out:
-   return ret;
+   return 0;
 }
 
 static int max77693_muic_jig_handler(struct max77693_muic_info *info,
@@ -630,15 +630,19 @@ static int max77693_muic_jig_handler(struct 
max77693_muic_info *info,
strcpy(cable_name, JIG-UART-OFF);
path = CONTROL1_SW_UART;
break;
+   default:
+   dev_err(info-dev, failed to detect %s jig cable\n

[PATCH 4/9] extcon: max8997: Move defined constant to header file

2013-02-13 Thread Chanwoo Choi
This patch move defined constants to header file(max77693-private.h)
because of mask/unmask selectively interrupt of MUIC device according
to attribute of H/W board.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max8997.c | 92 +
 include/linux/mfd/max8997-private.h | 49 
 2 files changed, 80 insertions(+), 61 deletions(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index d16090d..0fb1d48 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -30,51 +30,6 @@
 
 #defineDEV_NAMEmax8997-muic
 
-/* MAX8997-MUIC STATUS1 register */
-#define STATUS1_ADC_SHIFT  0
-#define STATUS1_ADCLOW_SHIFT   5
-#define STATUS1_ADCERR_SHIFT   6
-#define STATUS1_ADC_MASK   (0x1f  STATUS1_ADC_SHIFT)
-#define STATUS1_ADCLOW_MASK(0x1  STATUS1_ADCLOW_SHIFT)
-#define STATUS1_ADCERR_MASK(0x1  STATUS1_ADCERR_SHIFT)
-
-/* MAX8997-MUIC STATUS2 register */
-#define STATUS2_CHGTYP_SHIFT   0
-#define STATUS2_CHGDETRUN_SHIFT3
-#define STATUS2_DCDTMR_SHIFT   4
-#define STATUS2_DBCHG_SHIFT5
-#define STATUS2_VBVOLT_SHIFT   6
-#define STATUS2_CHGTYP_MASK(0x7  STATUS2_CHGTYP_SHIFT)
-#define STATUS2_CHGDETRUN_MASK (0x1  STATUS2_CHGDETRUN_SHIFT)
-#define STATUS2_DCDTMR_MASK(0x1  STATUS2_DCDTMR_SHIFT)
-#define STATUS2_DBCHG_MASK (0x1  STATUS2_DBCHG_SHIFT)
-#define STATUS2_VBVOLT_MASK(0x1  STATUS2_VBVOLT_SHIFT)
-
-/* MAX8997-MUIC STATUS3 register */
-#define STATUS3_OVP_SHIFT  2
-#define STATUS3_OVP_MASK   (0x1  STATUS3_OVP_SHIFT)
-
-/* MAX8997-MUIC CONTROL1 register */
-#define COMN1SW_SHIFT  0
-#define COMP2SW_SHIFT  3
-#define COMN1SW_MASK   (0x7  COMN1SW_SHIFT)
-#define COMP2SW_MASK   (0x7  COMP2SW_SHIFT)
-#define SW_MASK(COMP2SW_MASK | COMN1SW_MASK)
-
-#define MAX8997_SW_USB ((1  COMP2SW_SHIFT) | (1  COMN1SW_SHIFT))
-#define MAX8997_SW_AUDIO   ((2  COMP2SW_SHIFT) | (2  COMN1SW_SHIFT))
-#define MAX8997_SW_UART((3  COMP2SW_SHIFT) | (3  
COMN1SW_SHIFT))
-#define MAX8997_SW_OPEN((0  COMP2SW_SHIFT) | (0  
COMN1SW_SHIFT))
-
-#defineMAX8997_ADC_GROUND  0x00
-#defineMAX8997_ADC_MHL 0x01
-#defineMAX8997_ADC_JIG_USB_1   0x18
-#defineMAX8997_ADC_JIG_USB_2   0x19
-#defineMAX8997_ADC_DESKDOCK0x1a
-#defineMAX8997_ADC_JIG_UART0x1c
-#defineMAX8997_ADC_CARDOCK 0x1d
-#defineMAX8997_ADC_OPEN0x1f
-
 struct max8997_muic_irq {
unsigned int irq;
const char *name;
@@ -109,17 +64,32 @@ struct max8997_muic_info {
struct extcon_dev   *edev;
 };
 
+enum {
+   EXTCON_CABLE_USB = 0,
+   EXTCON_CABLE_USB_HOST,
+   EXTCON_CABLE_TA,
+   EXTCON_CABLE_FAST_CHARGER,
+   EXTCON_CABLE_SLOW_CHARGER,
+   EXTCON_CABLE_CHARGE_DOWNSTREAM,
+   EXTCON_CABLE_MHL,
+   EXTCON_CABLE_DOCK_DESK,
+   EXTCON_CABLE_DOCK_CARD,
+   EXTCON_CABLE_JIG,
+
+   _EXTCON_CABLE_NUM,
+};
+
 static const char *max8997_extcon_cable[] = {
-   [0] = USB,
-   [1] = USB-Host,
-   [2] = TA,
-   [3] = Fast-charger,
-   [4] = Slow-charger,
-   [5] = Charge-downstream,
-   [6] = MHL,
-   [7] = Dock-desk,
-   [8] = Dock-card,
-   [9] = JIG,
+   [EXTCON_CABLE_USB]  = USB,
+   [EXTCON_CABLE_USB_HOST] = USB-Host,
+   [EXTCON_CABLE_TA]   = TA,
+   [EXTCON_CABLE_FAST_CHARGER] = Fast-charger,
+   [EXTCON_CABLE_SLOW_CHARGER] = Slow-charger,
+   [EXTCON_CABLE_CHARGE_DOWNSTREAM]= Charge-downstream,
+   [EXTCON_CABLE_MHL]  = MHL,
+   [EXTCON_CABLE_DOCK_DESK]= Dock-Desk,
+   [EXTCON_CABLE_DOCK_CARD]= Dock-Card,
+   [EXTCON_CABLE_JIG]  = JIG,
 
NULL,
 };
@@ -132,8 +102,8 @@ static int max8997_muic_handle_usb(struct max8997_muic_info 
*info,
if (usb_type == MAX8997_USB_HOST) {
/* switch to USB */
ret = max8997_update_reg(info-muic, MAX8997_MUIC_REG_CONTROL1,
-   attached ? MAX8997_SW_USB : MAX8997_SW_OPEN,
-   SW_MASK);
+   attached ? CONTROL1_SW_USB : CONTROL1_SW_OPEN,
+   CONTROL1_SW_MASK);
if (ret) {
dev_err(info-dev, failed to update muic register\n);
goto out;
@@ -163,8 +133,8

[PATCH 1/9] extcon: gpio: Rename filename of extcon-gpio.c according to kernel naming style

2013-02-13 Thread Chanwoo Choi
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-gpio.c   |  2 +-
 include/linux/extcon/extcon-gpio.h | 52 ++
 include/linux/extcon/extcon_gpio.h | 52 --
 3 files changed, 53 insertions(+), 53 deletions(-)
 create mode 100644 include/linux/extcon/extcon-gpio.h
 delete mode 100644 include/linux/extcon/extcon_gpio.h

diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 1b14bfc..02bec32 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -29,7 +29,7 @@
 #include linux/workqueue.h
 #include linux/gpio.h
 #include linux/extcon.h
-#include linux/extcon/extcon_gpio.h
+#include linux/extcon/extcon-gpio.h
 
 struct gpio_extcon_data {
struct extcon_dev edev;
diff --git a/include/linux/extcon/extcon-gpio.h 
b/include/linux/extcon/extcon-gpio.h
new file mode 100644
index 000..2d8307f
--- /dev/null
+++ b/include/linux/extcon/extcon-gpio.h
@@ -0,0 +1,52 @@
+/*
+ *  External connector (extcon) class generic GPIO driver
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Author: MyungJoo Ham myungjoo@samsung.com
+ *
+ * based on switch class driver
+ * Copyright (C) 2008 Google, Inc.
+ * Author: Mike Lockwood lockw...@android.com
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 __EXTCON_GPIO_H__
+#define __EXTCON_GPIO_H__ __FILE__
+
+#include linux/extcon.h
+
+/**
+ * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
+ * @name   The name of this GPIO extcon device.
+ * @gpio   Corresponding GPIO.
+ * @debounce   Debounce time for GPIO IRQ in ms.
+ * @irq_flags  IRQ Flags (e.g., IRQF_TRIGGER_LOW).
+ * @state_on   print_state is overriden with state_on if attached. If Null,
+ * default method of extcon class is used.
+ * @state_off  print_state is overriden with state_on if detached. If Null,
+ * default method of extcon class is used.
+ *
+ * Note that in order for state_on or state_off to be valid, both state_on
+ * and state_off should be not NULL. If at least one of them is NULL,
+ * the print_state is not overriden.
+ */
+struct gpio_extcon_platform_data {
+   const char *name;
+   unsigned gpio;
+   unsigned long debounce;
+   unsigned long irq_flags;
+
+   /* if NULL, 0 or 1 will be printed */
+   const char *state_on;
+   const char *state_off;
+};
+
+#endif /* __EXTCON_GPIO_H__ */
diff --git a/include/linux/extcon/extcon_gpio.h 
b/include/linux/extcon/extcon_gpio.h
deleted file mode 100644
index 2d8307f..000
--- a/include/linux/extcon/extcon_gpio.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  External connector (extcon) class generic GPIO driver
- *
- * Copyright (C) 2012 Samsung Electronics
- * Author: MyungJoo Ham myungjoo@samsung.com
- *
- * based on switch class driver
- * Copyright (C) 2008 Google, Inc.
- * Author: Mike Lockwood lockw...@android.com
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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 __EXTCON_GPIO_H__
-#define __EXTCON_GPIO_H__ __FILE__
-
-#include linux/extcon.h
-
-/**
- * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
- * @name   The name of this GPIO extcon device.
- * @gpio   Corresponding GPIO.
- * @debounce   Debounce time for GPIO IRQ in ms.
- * @irq_flags  IRQ Flags (e.g., IRQF_TRIGGER_LOW).
- * @state_on   print_state is overriden with state_on if attached. If Null,
- * default method of extcon class is used.
- * @state_off  print_state is overriden with state_on if detached. If Null,
- * default method of extcon class is used.
- *
- * Note that in order for state_on or state_off to be valid, both state_on
- * and state_off should be not NULL. If at least one of them is NULL,
- * the print_state is not overriden.
- */
-struct gpio_extcon_platform_data {
-   const char *name;
-   unsigned gpio;
-   unsigned long debounce;
-   unsigned long irq_flags;
-
-   /* if NULL, 0 or 1 will be printed */
-   const char *state_on;
-   const char

Re: [PATCH 1/3] extcon: max8997: Make max8997_extcon_cable static

2013-02-03 Thread Chanwoo Choi

On 01/29/2013 06:40 PM, Sachin Kamat wrote:

'max8997_extcon_cable' is used only in this file. Hence make it static.

Signed-off-by: Sachin Kamatsachin.ka...@linaro.org
---
  drivers/extcon/extcon-max8997.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index df9358e..7039541 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -109,7 +109,7 @@ struct max8997_muic_info {
struct extcon_dev   *edev;
  };
  
-const char *max8997_extcon_cable[] = {

+static const char *max8997_extcon_cable[] = {
[0] = USB,
[1] = USB-Host,
[2] = TA,

Patches 1-3 applied.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: Tree for Jan 24 (extcon-max77693)

2013-01-24 Thread Chanwoo Choi
On 01/25/2013 08:28 AM, Randy Dunlap wrote:
 On 01/23/13 22:13, Stephen Rothwell wrote:
 Hi all,

 Changes since 20130123:

 
 
 on i386, when CONFIG_INPUT is not enabled:
 
 
  drivers/built-in.o: In function `max77693_muic_remove':
 extcon-max77693.c:(.text+0x664853): undefined reference to 
 `input_unregister_device'
 drivers/built-in.o: In function `max77693_muic_probe':
 extcon-max77693.c:(.text+0x664971): undefined reference to 
 `input_allocate_device'
 extcon-max77693.c:(.text+0x6649c1): undefined reference to 
 `input_set_capability'
 extcon-max77693.c:(.text+0x6649d6): undefined reference to 
 `input_set_capability'
 extcon-max77693.c:(.text+0x6649eb): undefined reference to 
 `input_set_capability'
 extcon-max77693.c:(.text+0x664a00): undefined reference to 
 `input_set_capability'
 extcon-max77693.c:(.text+0x664a15): undefined reference to 
 `input_set_capability'
 extcon-max77693.c:(.text+0x664a20): undefined reference to 
 `input_register_device'
 drivers/built-in.o: In function `max77693_muic_adc_handler':
 extcon-max77693.c:(.text+0x665318): undefined reference to `input_event'
 extcon-max77693.c:(.text+0x66532a): undefined reference to `input_event'
 make[1]: *** [vmlinux] Error 1
 
 
 
 Needs
   depends on INPUT
 ??

You are right. I miss to add CONFIG_INPUT driver/extcon/Kconfig.
I will send fix patch of this build error right now.

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] extcon: max77693: Fix bug of build error related to INPUT subsystem

2013-01-24 Thread Chanwoo Choi
This patch fix build error of following log:

drivers/built-in.o: In function `max77693_muic_remove':
extcon-max77693.c:(.text+0x664853): undefined reference to 
`input_unregister_device'
drivers/built-in.o: In function `max77693_muic_probe':
extcon-max77693.c:(.text+0x664971): undefined reference to 
`input_allocate_device'
extcon-max77693.c:(.text+0x6649c1): undefined reference to 
`input_set_capability'
extcon-max77693.c:(.text+0x6649d6): undefined reference to 
`input_set_capability'
extcon-max77693.c:(.text+0x6649eb): undefined reference to 
`input_set_capability'
extcon-max77693.c:(.text+0x664a00): undefined reference to 
`input_set_capability'
extcon-max77693.c:(.text+0x664a15): undefined reference to 
`input_set_capability'
extcon-max77693.c:(.text+0x664a20): undefined reference to 
`input_register_device'
drivers/built-in.o: In function `max77693_muic_adc_handler':
extcon-max77693.c:(.text+0x665318): undefined reference to `input_event'
extcon-max77693.c:(.text+0x66532a): undefined reference to `input_event'
make[1]: *** [vmlinux] Error 1

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index 07122a9..10df3fa 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -29,7 +29,7 @@ config EXTCON_ADC_JACK
 
 config EXTCON_MAX77693
tristate MAX77693 EXTCON Support
-   depends on MFD_MAX77693
+   depends on MFD_MAX77693  INPUT
select IRQ_DOMAIN
select REGMAP_I2C
help
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: arizona: Use regulated mode for microphone supply when detecting

2013-01-25 Thread Chanwoo Choi

On 01/25/2013 06:16 PM, Mark Brown wrote:

When starting microphone detection some headsets should be exposed to
the fully regulated microphone bias in order to ensure that they behave
in an optimal fashion.

Signed-off-by: Mark Brownbroo...@opensource.wolfsonmicro.com
---
  drivers/extcon/Kconfig  |2 +-
  drivers/extcon/extcon-arizona.c |   62 +++
  2 files changed, 63 insertions(+), 1 deletion(-)

Applied it.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/5] extcon: arizona: Use regulated mode for microphone supply when detecting

2013-01-23 Thread Chanwoo Choi
: In function `arizona_extcon_pulse_micbias':
/home/cwchoi00/kernel/git.kernel.org/extcon/drivers/extcon/extcon-arizona.c:140:
 undefined reference
to `snd_soc_dapm_force_enable_pin'
/home/cwchoi00/kernel/git.kernel.org/extcon/drivers/extcon/extcon-arizona.c:145:
 undefined reference
to `snd_soc_dapm_disable_pin'
/home/cwchoi00/kernel/git.kernel.org/extcon/drivers/extcon/extcon-arizona.c:145:
 undefined reference
to `snd_soc_dapm_disable_pin'

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] extcon: arizona: Disable debouce for accessory removal detection

2013-01-23 Thread Chanwoo Choi
On 01/24/2013 01:03 AM, Mark Brown wrote:
 Ensure we clamp as quickly as possible after removal by disabling the
 debounce while there is an accessory present.
 
 Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
 ---
  drivers/extcon/extcon-arizona.c |9 +
  1 file changed, 9 insertions(+)

Patches 1-4 applied.

Patch 5 failed to build, so I sent reply related to build error of Patch 5.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] extcon for 3.8-rc4

2013-01-15 Thread Chanwoo Choi
On 01/15/2013 10:49 PM, Greg KH wrote:
 On Tue, Jan 15, 2013 at 10:23:44PM +0900, Chanwoo Choi wrote:
 On Tuesday, January 15, 2013, Greg KH wrote:

 On Tue, Jan 15, 2013 at 09:09:20PM +0900, Chanwoo Choi wrote:
  On Tuesday, January 15, 2013, Greg KH wrote:
 
  On Tue, Jan 15, 2013 at 04:34:18PM +0900, Chanwoo Choi wrote:
   Hi Greg,
  
   This is the extcon pull request for Linux 3.8-rc4.
  
   Please pull extcon with following updates:
  
   Update to max77693/max8997 extcon driver:
   - Using MHL_TA cable for charging.
   - Support JIG cable.
   - Support Dock-Audio device for playing music and button of 
 device.
   - Support Dock-Smart device for desktop mode with mouse/keyboard.
   - Set default UART/USB path on probe().
   - Check the state/type of cable after completing initialization.
   - Code clean to remove duplicate code and bug fix related to
 sequence of
  interrupt.
   - Fix irq_flag of max8997/max77693 driver.
  
   Update to arizona extcon driver:
   - Headphone measurements.
   - Alternative detection mechanism for non-default system designs.
   - Microphone clamp integration.
   - Support for additional detection pin.
   - MICBIAS rise time configuration.
  
   Thanks in advance for pulling,
 
  This request is for inclusion in 3.9, right?  This seems much too 
 big
  for 3.8 at the moment.
 
   
  If you think that, I agree your opinion about including this request in
 3.9.

 That's really up to you, as a subsystem maintainer, to decide about.
 You need to take bugfixes and ask for them to be included in the 3.8,
 and new features and other work, for 3.9.

  OK, I will resend pull-request to include only bugfixes patch in 3.8.
 After released v3.8-rc7 or 3.8-rc8 kernel, I will send pull-request of extcon
 to include new feature patches of extcon driver in 3.9.
 
 No, you can send me that pull request now as well, I have two different
 branches, one to go to Linus for this release, and one for the next one.
 Both of them show up in linux-next.  You should have the same.
 
 So you can send me two pull requests now, does that make more sense?
 
I understand and thanks for your comment. I will resend only one pull-request 
for
extcon to include it for -next branch. I don't send separate pull-request
for bugfixes patch.

Best regards and thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] extcon for v3.9

2013-01-15 Thread Chanwoo Choi
Hi Greg,

This is the extcon pull request for v3.9.

I don't send separate pull request of extcon about bugfixes patch.
I'd like to apply this patch-set to your next branch for v3.9.

Please pull extcon with following updates.

Update to max77693/max8997 extcon driver:
- Using MHL_TA cable for charging.
- Support JIG cable.
- Support Dock-Audio device for playing music and button of device.
- Support Dock-Smart device for desktop mode with mouse/keyboard.
- Set default UART/USB path on probe().
- Check the state/type of cable after completing initialization.
- Code clean to remove duplicate code and bug fix related to sequence of 
interrupt.
- Fix irq_flag of max8997/max77693 driver.

Update to arizona extcon driver:
- Headphone measurements.
- Alternative detection mechanism for non-default system designs.
- Microphone clamp integration.
- Support for additional detection pin.
- MICBIAS rise time configuration.

Best regards,
Chanwoo Choi

The following changes since commit 9931faca02c604c22335f5a935a501bb2ace6e20:

  Linux 3.8-rc3 (2013-01-09 18:59:55 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
tags/extcon-for-3.9

for you to fetch changes up to 689557d3c7045320958d5bc4141088f7b4dff7ba:

  mfd: wm5102: Add microphone clamp control registers (2013-01-15 15:42:18 
+0900)


Chanwoo Choi (9):
  extcon: max77693: Remove duplicate code by making function
  extcon: max77693: Add support MHL_TA cable for charging battery
  extcon: max77693: Add support jig cable
  extcon: max77693: Add support dock device and buttons
  extcon: max77693: Check the state/type of cable after boot completed
  extcon: max8997/max77693: Support IRQF_NO_SUSPEND flag for interrupt
  extcon: max77693: Set default uart/usb path by using platform data
  extcon: max77693: Fix bug when detecting MHL/Dock-Audio with USB/TA cable
  extcon: max77693: Add support Dock-Smart device for desktop mode

Mark Brown (11):
  extcon: arizona: Convert to devm_input_allocate_device()
  extcon: arizona: Remove duplicate mic ramp configuration
  extcon: arizona: Only set GPIO if it has been requested
  extcon: arizona: Allow configuration of MICBIAS rise time
  extcon: arizona: Use microphone clamp function if available
  extcon: arizona: Support use of GPIO5 as an input to jack detection
  extcon: arizona: Enable basic headphone identification
  extcon: Simple code motion supporting future work.
  extcon: arizona: Support HPDET based accessory identification
  extcon: arizona: Support direct microphone measurement via HPDET
  mfd: wm5102: Add microphone clamp control registers

 drivers/extcon/extcon-arizona.c   | 634 +--
 drivers/extcon/extcon-max77693.c  | 920 +-
 drivers/extcon/extcon-max8997.c   |   6 +-
 drivers/mfd/wm5102-tables.c   |  10 +
 include/linux/mfd/arizona/core.h  |   4 +-
 include/linux/mfd/arizona/pdata.h |  12 +
 include/linux/mfd/arizona/registers.h |  48 ++
 include/linux/mfd/max77693-private.h  |  86 
 include/linux/mfd/max77693.h  |   9 +
 9 files changed, 1439 insertions(+), 290 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] extcon for 3.8-rc4

2013-01-15 Thread Chanwoo Choi
On 01/16/2013 03:46 PM, Greg KH wrote:
 On Wed, Jan 16, 2013 at 12:38:35PM +0900, Chanwoo Choi wrote:
  OK, I will resend pull-request to include only bugfixes patch in 3.8.
 After released v3.8-rc7 or 3.8-rc8 kernel, I will send pull-request of 
 extcon
 to include new feature patches of extcon driver in 3.9.

 No, you can send me that pull request now as well, I have two different
 branches, one to go to Linus for this release, and one for the next one.
 Both of them show up in linux-next.  You should have the same.

 So you can send me two pull requests now, does that make more sense?

 I understand and thanks for your comment. I will resend only one 
 pull-request for
 extcon to include it for -next branch. I don't send separate pull-request
 for bugfixes patch.
 
 Why not send a bugfix pull request?  Are none of these for 3.8?  If so,
 fine, but be sure to go through them to determine this.

I think that it isn't critical bug and relevant to extcon core driver.
And The issue is trivial and depend on new feature of max77693 extcon driver.

Thank you,
Chanwoo Choi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] extcon for v3.9

2013-01-15 Thread Chanwoo Choi
On 01/16/2013 04:28 PM, Greg KH wrote:
 On Wed, Jan 16, 2013 at 03:06:53PM +0900, Chanwoo Choi wrote:
 Hi Greg,

 This is the extcon pull request for v3.9.

 I don't send separate pull request of extcon about bugfixes patch.
 I'd like to apply this patch-set to your next branch for v3.9.

 Please pull extcon with following updates.

 Update to max77693/max8997 extcon driver:
 - Using MHL_TA cable for charging.
 - Support JIG cable.
 - Support Dock-Audio device for playing music and button of device.
 - Support Dock-Smart device for desktop mode with mouse/keyboard.
 - Set default UART/USB path on probe().
 - Check the state/type of cable after completing initialization.
 - Code clean to remove duplicate code and bug fix related to sequence of 
 interrupt.
 - Fix irq_flag of max8997/max77693 driver.

 Update to arizona extcon driver:
 - Headphone measurements.
 - Alternative detection mechanism for non-default system designs.
 - Microphone clamp integration.
 - Support for additional detection pin.
 - MICBIAS rise time configuration.

 Best regards,
 Chanwoo Choi

 The following changes since commit 9931faca02c604c22335f5a935a501bb2ace6e20:

   Linux 3.8-rc3 (2013-01-09 18:59:55 -0800)

 are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
 tags/extcon-for-3.9
 
 Pulled and pushed out, thanks.
 
Thank you for pulling and comment.

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] extcon for 3.9

2013-02-13 Thread Chanwoo Choi

Hi Greg,

This pull-reqeust patchset is based on char-misc-next branch(char-misc.git).
Please pull extcon with following updates.

Best regards,
Chanwoo Choi

The following changes since commit 19d3243e797c2abc02a214d3cec9fefa5dc048ff:

  extcon: max77693: Remove unnecessary goto statement to improve 
readability (2013-02-13 08:35:44 -0800)


are available in the git repository at:

  git://git.kernel.org:/pub/scm/linux/kernel/git/chanwoo/extcon.git 
tags/extcon-for-3.9


for you to fetch changes up to af5eb1a13273447c5708cd5425696f3b6f79dd9b:

  extcon: max8997: Use workqueue to check cable state after completing 
boot of platform (2013-02-14 07:54:49 +0900)



extcon: updates for v3.9

This patchset add a few new feature of extcon-max8997
and fix minor issue of extcon-max8997/77693.

Update extcon-max8997 driver
- Consolidate duplicate code
- Set default uart/usb path for internal line of muic device
- Set default ADC debounce time
- Use wq to check cable state after certain delay
- Code clean to move defined constant to header file
- Make max8997_extcon_cable static

Update extcon-max77693 driver
- Make max77693_extcon_cable static


Chanwoo Choi (6):
  extcon: max8997: Move defined constant to header file
  extcon: max8997: Remove duplicate code related to set H/W line path
  extcon: max8997: Set default of ADC debounce time during 
initialization
  extcon: max8997: Consolidate duplicate code for checking ADC/CHG 
cable type

  extcon: max8997: Set default UART/USB path on probe
  extcon: max8997: Use workqueue to check cable state after 
completing boot of platform


Sachin Kamat (3):
  extcon: max8997: Make max8997_extcon_cable static
  extcon: max8997: Remove unreachable code
  extcon: max77693: Make max77693_extcon_cable static

 drivers/extcon/extcon-max77693.c|   2 +-
 drivers/extcon/extcon-max8997.c | 728 


 include/linux/mfd/max8997-private.h |  64 
 include/linux/mfd/max8997.h |  25 +-
 4 files changed, 567 insertions(+), 252 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] extcon for 3.9

2013-02-13 Thread Chanwoo Choi

On 02/14/2013 08:52 AM, Greg KH wrote:

On Thu, Feb 14, 2013 at 08:41:43AM +0900, Chanwoo Choi wrote:

Hi Greg,

This pull-reqeust patchset is based on char-misc-next branch(char-misc.git).
Please pull extcon with following updates.

Best regards,
Chanwoo Choi

The following changes since commit 19d3243e797c2abc02a214d3cec9fefa5dc048ff:

   extcon: max77693: Remove unnecessary goto statement to improve
readability (2013-02-13 08:35:44 -0800)

are available in the git repository at:

   git://git.kernel.org:/pub/scm/linux/kernel/git/chanwoo/extcon.git
tags/extcon-for-3.9

$ git pull git://git.kernel.org:/pub/scm/linux/kernel/git/chanwoo/extcon.git 
tags/extcon-for-3.9
fatal: Unable to look up git.kernel.org (port none) (Servname not supported 
for ai_socktype)

You added an extra ':' in that url, how did you generate it?  Please be
more careful in the future.

I fixed it by hand...

thanks,

greg k-h


Sorry, It is my mistask

When I execute 'git request-pull' command, I use following git 
repository url instead of 'git.kernel.org'.
because firewall policy of company. So, I modify git repository url in 
reqeust-pull text directly.

- gitolite.kernel.org:/pub/scm/linux/kernel/git/chanwoo/extcon.git

I'll be careful and I don't make the same mistake.

Best Regards,
Chanwoo Choi


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] charger-manager: Check fully charged state of battery periodically

2012-09-21 Thread Chanwoo Choi
On 09/21/2012 02:10 PM, Anton Vorontsov wrote:

 On Tue, Aug 21, 2012 at 05:06:52PM +0900, Chanwoo Choi wrote:
 This patch check periodically fully charged state of battery to protect
 overcharge and overheat. If battery is fully charged, stop charging
 and check droped voltage with 'fullbatt_vchkdrop_ms' period. When voltage
 of battery is more droped than 'fullbatt_vchkdrop_uV' voltage,
 charger-manager will restart charging for battery.

 Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
 Signed-off-by: Myungjoo Ham myungjoo@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 
 Applied, thank you.
 
 There were some minor issues, but I fixed them up:
 
 [...]
 +} else if (!cm-emergency_stop
 + is_ext_pwr_online(cm)  !cm-charger_enabled) {
 
 Wrong  placement (should have been on the previous line).
 
 +fullbatt_vchk(cm-fullbatt_vchk_work.work);
 +
 +/*
 + * Check whether fully charged state to protect overcharge
 + * if charger-manager is charging for battery.
 + */
 +} else if (!cm-emergency_stop
 + is_full_charged(cm)  cm-charger_enabled) {
 
 Ditto.
 


Thanks for your reply and applied it.

I will consider your comment about coding style.

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] charger-manager: Add support sysfs entry for charger

2012-09-21 Thread Chanwoo Choi
On 09/21/2012 02:12 PM, Anton Vorontsov wrote:

 On Tue, Aug 21, 2012 at 05:06:49PM +0900, Chanwoo Choi wrote:
 This patch add support sysfs entry for each charger(regulator).
 Charger-manager use one or more chargers for charging battery but
 some charger isn't necessary on specific scenario. So, if some charger
 isn't needed, can disable specific charger through 'externally_control'
 entry while system is on state and confirm the information(name, state)
 of charger.

 the list of added sysfs entry
 - /sys/class/power_supply/battery/chargers/charger.[index]/name
 : show name of charger(regulator)
 - /sys/class/power_supply/battery/chargers/charger.[index]/state
 : show either enabled or disabled state of charger
 - /sys/class/power_supply/battery/chargers/charger.[index]/externally_control
 
 The API looks sane.
 
 For the future, you might want to get rid of the 'name', and instead
 just point to a regulator device (via a sysfs symlink). I.e.
 
 /sys/class/power_supply/battery/chargers/charger.[index]/device
 would be a symlink to the regulator device.
 
 But for the time being, I guess it's OK as is (although I wouldn't
 mind if it'll use the symlink from the start. :-)


OK, as your said, I will modify sysfs entry for charger(regulator) by
linking sysfs
of regulator device.

 
 [...]
  for (j = 0 ; j  charger-num_cables ; j++) {
  struct charger_cable *cable = charger-cables[j];
 @@ -1287,6 +1386,71 @@ static int charger_manager_probe(struct 
 platform_device *pdev)
  cable-charger = charger;
  cable-cm = cm;
  }
 +
 [...]
 +charger-attr_g.attrs = charger-attrs;
 +
 +sysfs_attr_init(cable-attr_name.attr);
 
 Notice that 'cable' is declared in the 'for' loop above,
 so this doesn't compile for me:
 
   CHECK   drivers/power/charger-manager.c
 drivers/power/charger-manager.c:1559:17: error: undefined identifier 'cable'
 drivers/power/charger-manager.c:1564:17: error: undefined identifier 'cable'
 drivers/power/charger-manager.c:1569:17: error: undefined identifier 'cable'
   CC  drivers/power/charger-manager.o
 drivers/power/charger-manager.c: In function ‘charger_manager_probe’:
 drivers/power/charger-manager.c:1559:3: error: ‘cable’ undeclared (first use 
 in this function)
 drivers/power/charger-manager.c:1559:3: note: each undeclared identifier is 
 reported only once for each function it appears in
 make[1]: *** [drivers/power/charger-manager.o] Error 1
 

I will fix it.

 Also:
 - Please adhere to the codingstyle, there should be no spaces
   before ';' in the for loop statement.
 - If possible, please consider splitting _probe routine, it is more
   than 300 lines long nowadays.
 


I resend soon patch which fix build break. As you said, I will modify
sysfs entry
for charger(regulator) by linking sysfs of regulator device and split _probe
routine.

Thanks for your comment.

Best Regards,
Chanwoo Choi





--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] charger-manager: Add support sysfs entry for charger

2012-09-21 Thread Chanwoo Choi
This patch add support sysfs entry for each charger(regulator).
Charger-manager use one or more chargers for charging battery but
some charger isn't necessary on specific scenario. So, if some charger
isn't needed, can disable specific charger through 'externally_control'
entry while system is on state and confirm the information(name, state)
of charger.

patch-v2:
- Fix build break and fix codingstype which remove space in the for loop 
statement

  CHECK   drivers/power/charger-manager.c
drivers/power/charger-manager.c:1559:17: error: undefined identifier 'cable'
drivers/power/charger-manager.c:1564:17: error: undefined identifier 'cable'
drivers/power/charger-manager.c:1569:17: error: undefined identifier 'cable'
  CC  drivers/power/charger-manager.o
drivers/power/charger-manager.c: In function 'charger_manager_probe':
drivers/power/charger-manager.c:1559:3: error: 'cable' undeclared (first use in 
this function)
drivers/power/charger-manager.c:1559:3: note: each undeclared identifier is 
reported only once for each function it appears in
make[1]: *** [drivers/power/charger-manager.o] Error 1

patch-v1:
the list of added sysfs entry
- /sys/class/power_supply/battery/chargers/charger.[index]/name
: show name of charger(regulator)
- /sys/class/power_supply/battery/chargers/charger.[index]/state
: show either enabled or disabled state of charger
- /sys/class/power_supply/battery/chargers/charger.[index]/externally_control

If 'externally_control' of specific charger is 1, Charger-manager cannot enable
regulator for charging when charger cable is attached and charger must be
maintained with disabled state. If 'externally_control' is zero, Charger-manager
usually can control to enable/disable regulator.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c   |  174 -
 include/linux/power/charger-manager.h |   19 
 2 files changed, 192 insertions(+), 1 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index e92ec55..a1ab825 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -22,6 +22,7 @@
 #include linux/platform_device.h
 #include linux/power/charger-manager.h
 #include linux/regulator/consumer.h
+#include linux/sysfs.h
 
 static const char * const default_event_names[] = {
[CM_EVENT_UNKNOWN] = Unknown,
@@ -332,6 +333,9 @@ static int try_charger_enable(struct charger_manager *cm, 
bool enable)
cm-charging_end_time = 0;
 
for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   if (desc-charger_regulators[i].externally_control)
+   continue;
+
err = 
regulator_enable(desc-charger_regulators[i].consumer);
if (err  0) {
dev_warn(cm-dev,
@@ -348,6 +352,9 @@ static int try_charger_enable(struct charger_manager *cm, 
bool enable)
cm-charging_end_time = ktime_to_ms(ktime_get());
 
for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   if (desc-charger_regulators[i].externally_control)
+   continue;
+
err = 
regulator_disable(desc-charger_regulators[i].consumer);
if (err  0) {
dev_warn(cm-dev,
@@ -1217,12 +1224,101 @@ static int charger_extcon_init(struct charger_manager 
*cm,
return ret;
 }
 
+/* help function of sysfs node to control charger(regulator) */
+static ssize_t charger_name_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct charger_regulator *charger
+   = container_of(attr, struct charger_regulator, attr_name);
+   return sprintf(buf, %s\n, charger-regulator_name);
+}
+
+static ssize_t charger_state_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct charger_regulator *charger
+   = container_of(attr, struct charger_regulator, attr_state);
+   int state = 1;
+
+   if (charger-externally_control)
+   state = 0;
+   else
+   state = regulator_is_enabled(charger-consumer);
+
+   return sprintf(buf, %s\n, state ? enabled : disabled);
+}
+
+static ssize_t charger_externally_control_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct charger_regulator *charger = container_of(attr,
+   struct charger_regulator, attr_externally_control);
+   return sprintf(buf, %d\n, charger-externally_control);
+}
+
+static ssize_t charger_externally_control_store(struct device *dev,
+   struct device_attribute *attr, const

Re: [PATCH 0/2] mfd: MAX77693: Fix bug

2012-09-16 Thread Chanwoo Choi
On 09/16/2012 07:32 AM, Samuel Ortiz wrote:

 Hi Chanwoo,
 
 On Tue, Aug 21, 2012 at 03:15:47PM +0900, Chanwoo Choi wrote:
 This patchset fix bug of Maxim MAX77693 chip. First patch unmask interrupt
 masking bit for charger/flas/muic device of Maxim MAX77693 and second patch
 remove NULL pointer error when mfd-max77693 driver initialize irqs of Maxim
 MAX77693 devices.

 Chanwoo Choi (2):
   mfd: MAX77693: Fix bug of interrupt handlding for MAX77693 devices
   mfd: MAX77693: Fix NULL pointer error when initialize irqs of Maxim
 MAX77693

  drivers/extcon/extcon-max77693.c |   20 +---
  drivers/mfd/max77693-irq.c   |   36 +++-
  drivers/mfd/max77693.c   |   14 ++
  3 files changed, 58 insertions(+), 12 deletions(-)
 Both patches applied to my for-linus branch.
 
 Cheers,
 Samuel.
 


Thanks for your reply and applied it.

Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: arizona: Implement button detection support

2012-07-25 Thread Chanwoo Choi
On 07/25/2012 08:11 PM, Mark Brown wrote:

 Why do you should report released event to all of buttons? I think that
 you should only
 report released event to previous pressed button. If user press two
 button on the headset
 at the same time and then user release only one button with pressed
 another button, extcon-arizona driver have to report released event to
 previous pressed button except for still pressed another button.
 
 The input API already supresses duplicate reports, they won't be
 propagated to userspace, so there's no point in duplicating the work
 to remember what buttons are pressed in individual drivers.  Userspace
 will only see events reported that refect changes in state.


The extcon-arizona include six buttons(BTN_0, BTN_1, BTN_2, BTN_3,
BTN_4, BTN_5). Currently, extcon-arizona driver will report released
event to all buttons (BTN_0, BTN_1, BTN_2, BTN_3, BTN_4, BTN_5)
when released event irrespective of the type of buttons is happened.

If user press BTN_0 and BTN_1 at the same time and then user only
released BTN_0 but BTN_1 is still pressed, is it right that report
released event to all of buttons? I think that different event between
BTN_0 and BTN_1.

Thank you,
Chanwoo Choi


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] charger-manager: Use replacement variable to check state of battery

2012-07-26 Thread Chanwoo Choi
This patch remove unnecessary variable(cm-fullbatt_vchk_uV) by using
'desc-fullbatt_uV' field directly in fullbatt_handler() function
to check the state of battery.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c   |2 +-
 include/linux/power/charger-manager.h |3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 240de49..cdf29d2 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -415,7 +415,7 @@ static void fullbatt_vchk(struct work_struct *work)
return;
}
 
-   diff = cm-fullbatt_vchk_uV;
+   diff = desc-fullbatt_uV;
diff -= batt_uV;
 
dev_dbg(cm-dev, VBATT dropped %duV after full-batt.\n, diff);
diff --git a/include/linux/power/charger-manager.h 
b/include/linux/power/charger-manager.h
index cd22029..7d7b90f 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -194,8 +194,6 @@ struct charger_desc {
  * @charger_enabled: the state of charger
  * @fullbatt_vchk_jiffies_at:
  * jiffies at the time full battery check will occur.
- * @fullbatt_vchk_uV: voltage in microvolt
- * criteria for full battery
  * @fullbatt_vchk_work: work queue for full battery check
  * @emergency_stop:
  * When setting true, stop charging
@@ -218,7 +216,6 @@ struct charger_manager {
bool charger_enabled;
 
unsigned long fullbatt_vchk_jiffies_at;
-   unsigned int fullbatt_vchk_uV;
struct delayed_work fullbatt_vchk_work;
 
int emergency_stop;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] charger-manager: Stop charging when charge cable is detached and code clean

2012-07-26 Thread Chanwoo Choi
This patchset fix bug related to stop charging when charger cable is
detached and check return value of regulator_enable/disable() function
to confirm correct operation of enabled or disabling regulator for
charging. Second patch is code clean which remove unnecessary variable
type.

Chanwoo Choi (2):
  charger-manager: Disable regulator for charging when charger cable is
detached
  charger-manager: Use replacement variable to check state of battery

 drivers/power/charger-manager.c   |   21 ++---
 include/linux/power/charger-manager.h |3 ---
 2 files changed, 18 insertions(+), 6 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] charger-manager: Disable regulator for charging when charger cable is detached

2012-07-26 Thread Chanwoo Choi
This patch disable regulator for charging when charger cable is detached
before stopping charging forcibly on abnormal battery state and check
return value of regulator_enable/disable() function to confirm correct
operation of enabling or disabling regulator for charging.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c |   19 +--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 526e5c9..240de49 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -271,9 +271,24 @@ static int try_charger_enable(struct charger_manager *cm, 
bool enable)
if (enable) {
if (cm-emergency_stop)
return -EAGAIN;
-   for (i = 0 ; i  desc-num_charger_regulators ; i++)
-   regulator_enable(desc-charger_regulators[i].consumer);
+   for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   err = 
regulator_enable(desc-charger_regulators[i].consumer);
+   if (err  0) {
+   dev_warn(cm-dev,
+   Cannot enable %s regulator\n,
+   
desc-charger_regulators[i].regulator_name);
+   }
+   }
} else {
+   for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   err = 
regulator_disable(desc-charger_regulators[i].consumer);
+   if (err  0) {
+   dev_warn(cm-dev,
+   Cannot disable %s regulator\n,
+   
desc-charger_regulators[i].regulator_name);
+   }
+   }
+
/*
 * Abnormal battery state - Stop charging forcibly,
 * even if charger was enabled at the other places
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: arizona: Implement button detection support

2012-07-27 Thread Chanwoo Choi
On 07/26/2012 05:11 PM, Mark Brown wrote:

 On Thu, Jul 26, 2012 at 09:10:08AM +0900, Chanwoo Choi wrote:
 
 If user press BTN_0 and BTN_1 at the same time and then user only
 released BTN_0 but BTN_1 is still pressed, is it right that report
 released event to all of buttons? I think that different event between
 BTN_0 and BTN_1.
 
 That situation can't occur, the hardware can only detect one button at
 once - if two buttons are pressed simultaneusly only one will be
 reported.  This is just a standard resistive headset button detection
 mechanism.
 

OK,

Acked-by: Chanwoo Choi cw00.c...@samsung.com

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] extcon: fix typos in sys-class-extcon

2012-08-22 Thread Chanwoo Choi
On 08/23/2012 04:27 AM, Peter Meerwald wrote:

 Signed-off-by: Peter Meerwald pme...@pmeerw.net
 ---
  Documentation/ABI/testing/sysfs-class-extcon |   22 +++---
  1 file changed, 11 insertions(+), 11 deletions(-)
 
 diff --git a/Documentation/ABI/testing/sysfs-class-extcon 
 b/Documentation/ABI/testing/sysfs-class-extcon
 index 20ab361..57a7262 100644
 --- a/Documentation/ABI/testing/sysfs-class-extcon
 +++ b/Documentation/ABI/testing/sysfs-class-extcon
 @@ -13,7 +13,7 @@ Description:
   accessory cables have such capability. For example,
   the 30-pin port of Nuri board (/arch/arm/mach-exynos)
   may have both HDMI and Charger attached, or analog audio,
 - video, and USB cables attached simulteneously.
 + video, and USB cables attached simultaneously.
  
   If there are cables mutually exclusive with each other,
   such binary relations may be expressed with extcon_dev's
 @@ -35,7 +35,7 @@ Description:
   The /sys/class/extcon/.../state shows and stores the cable
   attach/detach information of the corresponding extcon object.
   If the extcon object has an optional callback show_state
 - defined, the showing function is overriden with the optional
 + defined, the showing function is overridden with the optional
   callback.
  
   If the default callback for showing function is used, the
 @@ -46,19 +46,19 @@ Description:
   TA=1
   EAR_JACK=0
   #
 - In this example, the extcon device have USB_OTG and TA
 + In this example, the extcon device has USB_OTG and TA
   cables attached and HDMI and EAR_JACK cables detached.
  
   In order to update the state of an extcon device, enter a hex
 - state number starting with 0x.
 -  echo 0xHEX  state
 + state number starting with 0x:
 + # echo 0xHEX  state
  
 - This updates the whole state of the extcon dev.
 + This updates the whole state of the extcon device.
   Inputs of all the methods are required to meet the
 - mutually_exclusive contidions if they exist.
 + mutually_exclusive conditions if they exist.
  
   It is recommended to use this global state interface if
 - you need to enter the value atomically. The later state
 + you need to set the value atomically. The later state
   interface associated with each cable cannot update
   multiple cable states of an extcon device simultaneously.
  
 @@ -73,7 +73,7 @@ What:   /sys/class/extcon/.../cable.x/state
  Date:February 2012
  Contact: MyungJoo Ham myungjoo@samsung.com
  Description:
 - The /sys/class/extcon/.../cable.x/name shows and stores the
 + The /sys/class/extcon/.../cable.x/state shows and stores the
   state of cable x (integer between 0 and 31) of an extcon
   device. The state value is either 0 (detached) or 1
   (attached).
 @@ -83,8 +83,8 @@ Date:   December 2011
  Contact: MyungJoo Ham myungjoo@samsung.com
  Description:
   Shows the relations of mutually exclusiveness. For example,
 - if the mutually_exclusive array of extcon_dev is
 - {0x3, 0x5, 0xC, 0x0}, the, the output is:
 + if the mutually_exclusive array of extcon device is
 + {0x3, 0x5, 0xC, 0x0}, then the output is:
   # ls mutually_exclusive/
   0x3
   0x5


Signed-off-by: Chanwoo Choi cw00.c...@samsung.com

I will apply this patch to
http://10.90.51.51/cgi-bin/gitweb.cgi?p=linux-samsung;a=shortlog;h=refs/heads/extcon-for-next
and you can check it after some hours.

Thank you
Chanwoo Choi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] extcon: fix typos in max77693 driver

2012-08-22 Thread Chanwoo Choi
On 08/23/2012 04:27 AM, Peter Meerwald wrote:

 Signed-off-by: Peter Meerwald pme...@pmeerw.net
 ---
  drivers/extcon/extcon-max77693.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 

This patch is already applied by Myungjoo Ham, so you can check it
following git repository.
-
http://10.90.51.51/cgi-bin/gitweb.cgi?p=linux-samsung;a=shortlog;h=refs/heads/extcon-for-next

Thank you
Chanwoo Choi



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] extcon: fixing typos

2012-08-22 Thread Chanwoo Choi
On 08/23/2012 04:27 AM, Peter Meerwald wrote:

 Signed-off-by: Peter Meerwald pme...@pmeerw.net
 ---
  drivers/extcon/extcon_class.c |8 
  include/linux/extcon.h|   18 +-
  2 files changed, 13 insertions(+), 13 deletions(-)
 


This patch is already replied by Myungjoo Ham, so you can check it
following git repository.
-
http://10.90.51.51/cgi-bin/gitweb.cgi?p=linux-samsung;a=shortlog;h=refs/heads/extcon-for-next.

But, file name of 'extcon_class.c' has been modified from extcon_class.c
to extcon-class.c,
so i did modify and apply it. you can see patch which rename file
name(extcon-class.c, extcon-gpio.c)

http://git.kernel.org/?p=linux/kernel/git/gregkh/driver-core.git;a=commit;h=0ea62503782699adf5757cb1d3cd9f880d13c48c

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] extcon: fix typos in extcon-arizona

2012-08-22 Thread Chanwoo Choi
On 08/23/2012 04:27 AM, Peter Meerwald wrote:

 Signed-off-by: Peter Meerwald pme...@pmeerw.net
 ---
  drivers/extcon/extcon-arizona.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
 index 427a289..6d24822 100644
 --- a/drivers/extcon/extcon-arizona.c
 +++ b/drivers/extcon/extcon-arizona.c
 @@ -313,7 +313,7 @@ static int __devinit arizona_extcon_probe(struct 
 platform_device *pdev)
  
   info = devm_kzalloc(pdev-dev, sizeof(*info), GFP_KERNEL);
   if (!info) {
 - dev_err(pdev-dev, failed to allocate memory\n);
 + dev_err(pdev-dev, Failed to allocate memory\n);
   ret = -ENOMEM;
   goto err;
   }
 @@ -350,7 +350,7 @@ static int __devinit arizona_extcon_probe(struct 
 platform_device *pdev)
  
   ret = extcon_dev_register(info-edev, arizona-dev);
   if (ret  0) {
 - dev_err(arizona-dev, extcon_dev_regster() failed: %d\n,
 + dev_err(arizona-dev, extcon_dev_register() failed: %d\n,
   ret);
   goto err;
   }


Signed-off-by: Chanwoo Choi cw00.c...@samsung.com

I will apply this patch to
http://10.90.51.51/cgi-bin/gitweb.cgi?p=linux-samsung;a=shortlog;h=refs/heads/extcon-for-next
and you can check it after some hours.

Thank you
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/4] extcon: fix typos

2012-08-22 Thread Chanwoo Choi
This patchset fix typos of extcon by Peter Meerwald.

Peter Meerwald (4):
  extcon: fix typos in sys-class-extcon
  extcon: fix typos in max77693 driver
  extcon: fix typos in extcon-arizona
  extcon: fixing typos

 Documentation/ABI/testing/sysfs-class-extcon |   22 +++---
 drivers/extcon/extcon-arizona.c  |4 ++--
 drivers/extcon/extcon-class.c|8 
 drivers/extcon/extcon-max77693.c |6 +++---
 include/linux/extcon.h   |   18 +-
 5 files changed, 29 insertions(+), 29 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] extcon: fix typos in sys-class-extcon

2012-08-22 Thread Chanwoo Choi
From: Peter Meerwald pme...@pmeerw.net

Signed-off-by: Peter Meerwald pme...@pmeerw.net
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
---
 Documentation/ABI/testing/sysfs-class-extcon |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-class-extcon 
b/Documentation/ABI/testing/sysfs-class-extcon
index 20ab361..57a7262 100644
--- a/Documentation/ABI/testing/sysfs-class-extcon
+++ b/Documentation/ABI/testing/sysfs-class-extcon
@@ -13,7 +13,7 @@ Description:
accessory cables have such capability. For example,
the 30-pin port of Nuri board (/arch/arm/mach-exynos)
may have both HDMI and Charger attached, or analog audio,
-   video, and USB cables attached simulteneously.
+   video, and USB cables attached simultaneously.
 
If there are cables mutually exclusive with each other,
such binary relations may be expressed with extcon_dev's
@@ -35,7 +35,7 @@ Description:
The /sys/class/extcon/.../state shows and stores the cable
attach/detach information of the corresponding extcon object.
If the extcon object has an optional callback show_state
-   defined, the showing function is overriden with the optional
+   defined, the showing function is overridden with the optional
callback.
 
If the default callback for showing function is used, the
@@ -46,19 +46,19 @@ Description:
TA=1
EAR_JACK=0
#
-   In this example, the extcon device have USB_OTG and TA
+   In this example, the extcon device has USB_OTG and TA
cables attached and HDMI and EAR_JACK cables detached.
 
In order to update the state of an extcon device, enter a hex
-   state number starting with 0x.
-echo 0xHEX  state
+   state number starting with 0x:
+   # echo 0xHEX  state
 
-   This updates the whole state of the extcon dev.
+   This updates the whole state of the extcon device.
Inputs of all the methods are required to meet the
-   mutually_exclusive contidions if they exist.
+   mutually_exclusive conditions if they exist.
 
It is recommended to use this global state interface if
-   you need to enter the value atomically. The later state
+   you need to set the value atomically. The later state
interface associated with each cable cannot update
multiple cable states of an extcon device simultaneously.
 
@@ -73,7 +73,7 @@ What: /sys/class/extcon/.../cable.x/state
 Date:  February 2012
 Contact:   MyungJoo Ham myungjoo@samsung.com
 Description:
-   The /sys/class/extcon/.../cable.x/name shows and stores the
+   The /sys/class/extcon/.../cable.x/state shows and stores the
state of cable x (integer between 0 and 31) of an extcon
device. The state value is either 0 (detached) or 1
(attached).
@@ -83,8 +83,8 @@ Date: December 2011
 Contact:   MyungJoo Ham myungjoo@samsung.com
 Description:
Shows the relations of mutually exclusiveness. For example,
-   if the mutually_exclusive array of extcon_dev is
-   {0x3, 0x5, 0xC, 0x0}, the, the output is:
+   if the mutually_exclusive array of extcon device is
+   {0x3, 0x5, 0xC, 0x0}, then the output is:
# ls mutually_exclusive/
0x3
0x5
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] extcon: fix typos in extcon-arizona

2012-08-22 Thread Chanwoo Choi
From: Peter Meerwald pme...@pmeerw.net

Signed-off-by: Peter Meerwald pme...@pmeerw.net
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
---
 drivers/extcon/extcon-arizona.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index fa2114f..55fbc2f 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -348,7 +348,7 @@ static int __devinit arizona_extcon_probe(struct 
platform_device *pdev)
 
info = devm_kzalloc(pdev-dev, sizeof(*info), GFP_KERNEL);
if (!info) {
-   dev_err(pdev-dev, failed to allocate memory\n);
+   dev_err(pdev-dev, Failed to allocate memory\n);
ret = -ENOMEM;
goto err;
}
@@ -385,7 +385,7 @@ static int __devinit arizona_extcon_probe(struct 
platform_device *pdev)
 
ret = extcon_dev_register(info-edev, arizona-dev);
if (ret  0) {
-   dev_err(arizona-dev, extcon_dev_regster() failed: %d\n,
+   dev_err(arizona-dev, extcon_dev_register() failed: %d\n,
ret);
goto err;
}
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] extcon: fix typos in max77693 driver

2012-08-22 Thread Chanwoo Choi
From: Peter Meerwald pme...@pmeerw.net

Signed-off-by: Peter Meerwald pme...@pmeerw.net
Signed-off-by: MyungJoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-max77693.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 920a609..8bb438b 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -356,7 +356,7 @@ static int max77693_muic_adc_ground_handler(struct 
max77693_muic_info *info,
extcon_set_cable_state(info-edev, MHL, attached);
break;
default:
-   dev_err(info-dev, faild to detect %s accessory\n,
+   dev_err(info-dev, failed to detect %s accessory\n,
attached ? attached : detached);
dev_err(info-dev, - adc:0x%x, adclow:0x%x, adc1k:0x%x\n,
adc, adclow, adc1k);
@@ -548,7 +548,7 @@ static void max77693_muic_irq_work(struct work_struct *work)
curr_adc = info-status[0]  STATUS1_ADC_MASK;
curr_adc = STATUS1_ADC_SHIFT;
 
-   /* Check accossory state which is either detached or attached */
+   /* Check accessory state which is either detached or attached */
if (curr_adc == MAX77693_MUIC_ADC_OPEN)
attached = false;
 
@@ -564,7 +564,7 @@ static void max77693_muic_irq_work(struct work_struct *work)
curr_chg_type = info-status[1]  STATUS2_CHGTYP_MASK;
curr_chg_type = STATUS2_CHGTYP_SHIFT;
 
-   /* Check charger accossory state which
+   /* Check charger accessory state which
   is either detached or attached */
if (curr_chg_type == MAX77693_CHARGER_TYPE_NONE)
attached = false;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] extcon: fixing typos

2012-08-22 Thread Chanwoo Choi
From: Peter Meerwald pme...@pmeerw.net

Signed-off-by: Peter Meerwald pme...@pmeerw.net
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
---
 drivers/extcon/extcon-class.c |8 
 include/linux/extcon.h|   18 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 481cfa0..946a318 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -443,7 +443,7 @@ static int _call_per_cable(struct notifier_block *nb, 
unsigned long val,
 
 /**
  * extcon_register_interest() - Register a notifier for a state change of a
- *   specific cable, not a entier set of cables of a
+ *   specific cable, not an entier set of cables of a
  *   extcon device.
  * @obj:   an empty extcon_specific_cable_nb object to be returned.
  * @extcon_name:   the name of extcon device.
@@ -499,7 +499,7 @@ int extcon_unregister_interest(struct 
extcon_specific_cable_nb *obj)
 }
 
 /**
- * extcon_register_notifier() - Register a notifee to get notified by
+ * extcon_register_notifier() - Register a notifiee to get notified by
  *   any attach status changes from the extcon.
  * @edev:  the extcon device.
  * @nb:a notifier block to be registered.
@@ -516,7 +516,7 @@ int extcon_register_notifier(struct extcon_dev *edev,
 EXPORT_SYMBOL_GPL(extcon_register_notifier);
 
 /**
- * extcon_unregister_notifier() - Unregister a notifee from the extcon device.
+ * extcon_unregister_notifier() - Unregister a notifiee from the extcon device.
  * @edev:  the extcon device.
  * @nb:a registered notifier block to be unregistered.
  */
@@ -806,7 +806,7 @@ EXPORT_SYMBOL_GPL(extcon_dev_register);
 
 /**
  * extcon_dev_unregister() - Unregister the extcon device.
- * @edev:  the extcon device instance to be unregitered.
+ * @edev:  the extcon device instance to be unregistered.
  *
  * Note that this does not call kfree(edev) because edev was not allocated
  * by this class.
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index cdd4014..7443a56 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -30,19 +30,19 @@
 
 /*
  * The standard cable name is to help support general notifier
- * and notifee device drivers to share the common names.
+ * and notifiee device drivers to share the common names.
  * Please use standard cable names unless your notifier device has
  * a very unique and abnormal cable or
  * the cable type is supposed to be used with only one unique
- * pair of notifier/notifee devices.
+ * pair of notifier/notifiee devices.
  *
  * Please add any other standard cables used with extcon dev.
  *
  * You may add a dot and number to specify version or specification
  * of the specific cable if it is required. (e.g., Fast-charger.18
  * and Fast-charger.10 for 1.8A and 1.0A chargers)
- * However, the notifee and notifier should be able to handle such
- * string and if the notifee can negotiate the protocol or idenify,
+ * However, the notifiee and notifier should be able to handle such
+ * string and if the notifiee can negotiate the protocol or identify,
  * you don't need such convention. This convention is helpful when
  * notifier can distinguish but notifiee cannot.
  */
@@ -76,7 +76,7 @@ struct extcon_cable;
  * struct extcon_dev - An extcon device represents one external connector.
  * @name   The name of this extcon device. Parent device name is used
  * if NULL.
- * @supported_cableArray of supported cable name ending with NULL.
+ * @supported_cableArray of supported cable names ending with NULL.
  * If supported_cable is NULL, cable name related APIs
  * are disabled.
  * @mutually_exclusive Array of mutually exclusive set of cables that cannot
@@ -95,7 +95,7 @@ struct extcon_cable;
  * @state  Attach/detach state of this extcon. Do not provide at
  * register-time
  * @nh Notifier for the state change events from this extcon
- * @entry  To support list of extcon devices so that uses can search
+ * @entry  To support list of extcon devices so that users can search
  * for extcon devices based on the extcon name.
  * @lock
  * @max_supported  Internal value to store the number of cables.
@@ -199,7 +199,7 @@ extern int extcon_update_state(struct extcon_dev *edev, u32 
mask, u32 state);
 /*
  * get/set_cable_state access each bit of the 32b encoded state value.
  * They are used to access the status of each cable based on the cable_name
- * or cable_index, which is retrived by extcon_find_cable_index
+ * or cable_index, which is retrieved by extcon_find_cable_index
  */
 extern int extcon_find_cable_index(struct extcon_dev *sdev,
   const char *cable_name);
@@ -226,9 +226,9 @@ extern int 

Re: [PATCH 0/2] charger-manager: Stop charging when charge cable is detached and code clean

2012-08-22 Thread Chanwoo Choi
On 08/23/2012 12:10 PM, Anton Vorontsov wrote:

 On Fri, Jul 27, 2012 at 02:01:25PM +0900, Chanwoo Choi wrote:
 This patchset fix bug related to stop charging when charger cable is
 detached and check return value of regulator_enable/disable() function
 to confirm correct operation of enabled or disabling regulator for
 charging. Second patch is code clean which remove unnecessary variable
 type.

 Chanwoo Choi (2):
   charger-manager: Disable regulator for charging when charger cable is
 detached
   charger-manager: Use replacement variable to check state of battery

  drivers/power/charger-manager.c   |   21 ++---
  include/linux/power/charger-manager.h |3 ---
  2 files changed, 18 insertions(+), 6 deletions(-)
 
 Both applied, much thanks!
 

Thanks for your reply and applied it.

I did send additional patchset which has 5 patch and also include below
patch list,
if you may confuse due to duplicate patch, so I inform to you about
duplicate patch.

Chanwoo Choi (2):
   charger-manager: Disable regulator for charging when charger cable is
 detached
   charger-manager: Use replacement variable to check state of battery

You can check additional patchset for charger-manager:
https://lkml.org/lkml/2012/8/21/68

Thanks and Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -next] extcon: extcon-arizona depends on INPUT

2012-08-26 Thread Chanwoo Choi
On 08/25/2012 02:04 AM, Randy Dunlap wrote:

 From: Randy Dunlap rdun...@xenotime.net
 
 extcon-arizona uses input_*() functions so it should depend
 on INPUT.
 
 ERROR: input_event [drivers/extcon/extcon-arizona.ko] undefined!
 ERROR: input_free_device [drivers/extcon/extcon-arizona.ko] undefined!
 ERROR: input_register_device [drivers/extcon/extcon-arizona.ko] undefined!
 ERROR: input_set_capability [drivers/extcon/extcon-arizona.ko] undefined!
 ERROR: input_allocate_device [drivers/extcon/extcon-arizona.ko] undefined!
 ERROR: input_unregister_device [drivers/extcon/extcon-arizona.ko] undefined!
 
 Signed-off-by: Randy Dunlap rdun...@xenotime.net
 Cc: MyungJoo Ham myungjoo@samsung.com
 Cc: Chanwoo Choi cw00.c...@samsung.com
 Cc: Mark Brown broo...@opensource.wolfsonmicro.com
 ---

Thanks much,

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com

I will apply this patch to
http://10.90.51.51/cgi-bin/gitweb.cgi?p=linux-samsung;a=shortlog;h=refs/heads/extcon-for-next
and you can check it after some hours.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: arizona: Free MICDET IRQ on error during probe

2012-08-26 Thread Chanwoo Choi
On 08/27/2012 05:58 AM, Mark Brown wrote:

 Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
 ---
  drivers/extcon/extcon-arizona.c |4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
 index fa2114f..13eafcb 100644
 --- a/drivers/extcon/extcon-arizona.c
 +++ b/drivers/extcon/extcon-arizona.c
 @@ -488,11 +488,13 @@ static int __devinit arizona_extcon_probe(struct 
 platform_device *pdev)
   ret = input_register_device(info-input);
   if (ret) {
   dev_err(pdev-dev, Can't register input device: %d\n, ret);
 - goto err_fall_wake;
 + goto err_micdet;
   }
  
   return 0;
  
 +err_micdet:
 + arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info);
  err_fall_wake:
   arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_FALL, 0);
  err_fall:


Thanks much,

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com

I will apply this patch to
http://10.90.51.51/cgi-bin/gitweb.cgi?p=linux-samsung;a=shortlog;h=refs/heads/extcon-for-next
and you can check it after some hours.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] mfd: MAX77693: Fix bug

2012-08-21 Thread Chanwoo Choi
This patchset fix bug of Maxim MAX77693 chip. First patch unmask interrupt
masking bit for charger/flas/muic device of Maxim MAX77693 and second patch
remove NULL pointer error when mfd-max77693 driver initialize irqs of Maxim
MAX77693 devices.

Chanwoo Choi (2):
  mfd: MAX77693: Fix bug of interrupt handlding for MAX77693 devices
  mfd: MAX77693: Fix NULL pointer error when initialize irqs of Maxim
MAX77693

 drivers/extcon/extcon-max77693.c |   20 +---
 drivers/mfd/max77693-irq.c   |   36 +++-
 drivers/mfd/max77693.c   |   14 ++
 3 files changed, 58 insertions(+), 12 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND PATCH 1/2] mfd: MAX77693: Fix bug of interrupt handlding for MAX77693 devices

2012-08-21 Thread Chanwoo Choi
This patch fix bug related to interrupt handling for MAX77693 devices.
- Unmask interrupt masking bit for charger/flash/muic to revolve
that interrupt isn't happened when external connector is attached.
- Fix wrong regmap instance when muic interrupt is happened.

This patch were discussed and confirm discussion about this patch on below url:
http://lkml.org/lkml/2012/7/16/118

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/mfd/max77693-irq.c |   36 +++-
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/max77693-irq.c b/drivers/mfd/max77693-irq.c
index 2b40356..1029d01 100644
--- a/drivers/mfd/max77693-irq.c
+++ b/drivers/mfd/max77693-irq.c
@@ -137,6 +137,9 @@ static void max77693_irq_mask(struct irq_data *data)
const struct max77693_irq_data *irq_data =
irq_to_max77693_irq(max77693, data-irq);
 
+   if (irq_data-group = MAX77693_IRQ_GROUP_NR)
+   return;
+
if (irq_data-group = MUIC_INT1  irq_data-group = MUIC_INT3)
max77693-irq_masks_cur[irq_data-group] = ~irq_data-mask;
else
@@ -149,6 +152,9 @@ static void max77693_irq_unmask(struct irq_data *data)
const struct max77693_irq_data *irq_data =
irq_to_max77693_irq(max77693, data-irq);
 
+   if (irq_data-group = MAX77693_IRQ_GROUP_NR)
+   return;
+
if (irq_data-group = MUIC_INT1  irq_data-group = MUIC_INT3)
max77693-irq_masks_cur[irq_data-group] |= irq_data-mask;
else
@@ -200,7 +206,7 @@ static irqreturn_t max77693_irq_thread(int irq, void *data)
 
if (irq_src  MAX77693_IRQSRC_MUIC)
/* MUIC INT1 ~ INT3 */
-   max77693_bulk_read(max77693-regmap, MAX77693_MUIC_REG_INT1,
+   max77693_bulk_read(max77693-regmap_muic, 
MAX77693_MUIC_REG_INT1,
MAX77693_NUM_IRQ_MUIC_REGS, irq_reg[MUIC_INT1]);
 
/* Apply masking */
@@ -255,7 +261,8 @@ int max77693_irq_init(struct max77693_dev *max77693)
 {
struct irq_domain *domain;
int i;
-   int ret;
+   int ret = 0;
+   u8 intsrc_mask;
 
mutex_init(max77693-irqlock);
 
@@ -287,19 +294,38 @@ int max77693_irq_init(struct max77693_dev *max77693)
max77693_irq_domain_ops, max77693);
if (!domain) {
dev_err(max77693-dev, could not create irq domain\n);
-   return -ENODEV;
+   ret = -ENODEV;
+   goto err_irq;
}
max77693-irq_domain = domain;
 
+   /* Unmask max77693 interrupt */
+   ret = max77693_read_reg(max77693-regmap,
+   MAX77693_PMIC_REG_INTSRC_MASK, intsrc_mask);
+   if (ret  0) {
+   dev_err(max77693-dev, fail to read PMIC register\n);
+   goto err_irq;
+   }
+
+   intsrc_mask = ~(MAX77693_IRQSRC_CHG);
+   intsrc_mask = ~(MAX77693_IRQSRC_FLASH);
+   intsrc_mask = ~(MAX77693_IRQSRC_MUIC);
+   ret = max77693_write_reg(max77693-regmap,
+   MAX77693_PMIC_REG_INTSRC_MASK, intsrc_mask);
+   if (ret  0) {
+   dev_err(max77693-dev, fail to write PMIC register\n);
+   goto err_irq;
+   }
+
ret = request_threaded_irq(max77693-irq, NULL, max77693_irq_thread,
   IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   max77693-irq, max77693);
-
if (ret)
dev_err(max77693-dev, Failed to request IRQ %d: %d\n,
max77693-irq, ret);
 
-   return 0;
+err_irq:
+   return ret;
 }
 
 void max77693_irq_exit(struct max77693_dev *max77693)
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] mfd: MAX77693: Fix NULL pointer error when initialize irqs of Maxim MAX77693

2012-08-21 Thread Chanwoo Choi
This patch initialize register map of MUIC device because mfd driver
of Maxim MAX77693 use regmap-muic instance of MUIC device when irqs of
Maxim MAX77693 is initialized before call max77693-muic probe() function.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reported-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/extcon/extcon-max77693.c |   20 +---
 drivers/mfd/max77693.c   |   14 ++
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 920a609..7e98afc 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -669,13 +669,19 @@ static int __devinit max77693_muic_probe(struct 
platform_device *pdev)
}
info-dev = pdev-dev;
info-max77693 = max77693;
-   info-max77693-regmap_muic = regmap_init_i2c(info-max77693-muic,
-max77693_muic_regmap_config);
-   if (IS_ERR(info-max77693-egmap_muic)) {
-   ret = PTR_ERR(info-max77693-regmap_muic);
-   dev_err(max77693-dev,
-   failed to allocate register map: %d\n, ret);
-   goto err_regmap;
+
+   if (info-max77693-regmap_muic)
+   dev_dbg(pdev-dev, allocate register map\n);
+   else {
+   info-max77693-regmap_muic = devm_regmap_init_i2c(
+   info-max77693-muic,
+   max77693_muic_regmap_config);
+   if (IS_ERR(info-max77693-regmap_muic)) {
+   ret = PTR_ERR(info-max77693-regmap_muic);
+   dev_err(max77693-dev,
+   failed to allocate register map: %d\n, ret);
+   goto err_regmap;
+   }
}
platform_set_drvdata(pdev, info);
mutex_init(info-mutex);
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index a1811cb..e1a5a47 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -152,6 +152,20 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
max77693-haptic = i2c_new_dummy(i2c-adapter, I2C_ADDR_HAPTIC);
i2c_set_clientdata(max77693-haptic, max77693);
 
+   /*
+* Initialize register map for MUIC device because use regmap-muic
+* instance of MUIC device when irq of max77693 is initialized
+* before call max77693-muic probe() function.
+*/
+   max77693-regmap_muic = devm_regmap_init_i2c(max77693-muic,
+max77693_regmap_config);
+   if (IS_ERR(max77693-regmap_muic)) {
+   ret = PTR_ERR(max77693-regmap_muic);
+   dev_err(max77693-dev,
+   failed to allocate register map: %d\n, ret);
+   goto err_regmap;
+   }
+
ret = max77693_irq_init(max77693);
if (ret  0)
goto err_irq;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] charger-manager: Update charger-manager to support various charging conditions

2012-08-21 Thread Chanwoo Choi
This patchset add new feature related to charging battery to complement
necessary feature for charging. This patchset include following new feature
for charging battery.

Explain implemented feature of this patchset:
- Code clean on first and second patch.
- Add support sysfs entry for charger(regulator) to control charger from 
user-space.
  If some development board use one more chargers(regulator) for charging but
  only need one charger on specific case which is dependent on user scenario
  or hardware restrictions, the user enter 1 or 0(zero) to 
/sys/class/power_supply
  /battery/charger.[index]/externally_control. For example, if user enter 1 to
  /sys/.../charger.[index]/externally_control, this charger isn't controlled
  from charger-manager and always stay off state of regulator.
- Check fully charged state of battery periodically to prevent overcharging.
- Limit maximum possible duration of charging to prevent overcharging,
  also check discharging duration to maintain fully charged state of battery
  and to prevent much drop voltage than given data through platform data of
  charger_desc.

Chanwoo Choi (5):
  charger-manager: Disable battery charging when charger cable is
detached
  charger-manager: Use replacement variable to check state of battery
  charger-manager: Add support sysfs entry for charger
  charger-manager: Check fully charged state of battery periodically
  charger-manager: Support limit of maximum possible duration for
charging/discharging

 drivers/power/charger-manager.c   |  437 +
 include/linux/power/charger-manager.h |   45 +++-
 2 files changed, 429 insertions(+), 53 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] charger-manager: Add support sysfs entry for charger

2012-08-21 Thread Chanwoo Choi
This patch add support sysfs entry for each charger(regulator).
Charger-manager use one or more chargers for charging battery but
some charger isn't necessary on specific scenario. So, if some charger
isn't needed, can disable specific charger through 'externally_control'
entry while system is on state and confirm the information(name, state)
of charger.

the list of added sysfs entry
- /sys/class/power_supply/battery/chargers/charger.[index]/name
: show name of charger(regulator)
- /sys/class/power_supply/battery/chargers/charger.[index]/state
: show either enabled or disabled state of charger
- /sys/class/power_supply/battery/chargers/charger.[index]/externally_control

If 'externally_control' of specific charger is 1, Charger-manager cannot enable
regulator for charging when charger cable is attached and charger must be
maintained with disabled state. If 'externally_control' is zero, Charger-manager
usually can control to enable/disable regulator.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c   |  172 +
 include/linux/power/charger-manager.h |   19 
 2 files changed, 191 insertions(+), 0 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index bee010e..33cc3f6 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -22,6 +22,7 @@
 #include linux/platform_device.h
 #include linux/power/charger-manager.h
 #include linux/regulator/consumer.h
+#include linux/sysfs.h
 
 static const char * const default_event_names[] = {
[CM_EVENT_UNKNOWN] = Unknown,
@@ -272,6 +273,9 @@ static int try_charger_enable(struct charger_manager *cm, 
bool enable)
if (cm-emergency_stop)
return -EAGAIN;
for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   if (desc-charger_regulators[i].externally_control)
+   continue;
+
err = regulator_enable(
desc-charger_regulators[i].consumer);
if (err  0) {
@@ -282,6 +286,9 @@ static int try_charger_enable(struct charger_manager *cm, 
bool enable)
}
} else {
for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   if (desc-charger_regulators[i].externally_control)
+   continue;
+
err = regulator_disable(
desc-charger_regulators[i].consumer);
if (err  0) {
@@ -1088,12 +1095,101 @@ static int charger_extcon_init(struct charger_manager 
*cm,
return ret;
 }
 
+/* help function of sysfs node to control charger(regulator) */
+static ssize_t charger_name_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct charger_regulator *charger
+   = container_of(attr, struct charger_regulator, attr_name);
+   return sprintf(buf, %s\n, charger-regulator_name);
+}
+
+static ssize_t charger_state_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct charger_regulator *charger
+   = container_of(attr, struct charger_regulator, attr_state);
+   int state = 1;
+
+   if (charger-externally_control)
+   state = 0;
+   else
+   state = regulator_is_enabled(charger-consumer);
+
+   return sprintf(buf, %s\n, state ? enabled : disabled);
+}
+
+static ssize_t charger_externally_control_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct charger_regulator *charger = container_of(attr,
+   struct charger_regulator, attr_externally_control);
+   return sprintf(buf, %d\n, charger-externally_control);
+}
+
+static ssize_t charger_externally_control_store(struct device *dev,
+   struct device_attribute *attr, const char *buf,
+   size_t count)
+{
+   struct charger_regulator *charger
+   = container_of(attr, struct charger_regulator,
+   attr_externally_control);
+   struct charger_manager *cm = charger-cm;
+   struct charger_desc *desc = cm-desc;
+   int i, ret;
+   int externally_control;
+
+   ret = sscanf(buf, %d, externally_control);
+   if (ret == 0) {
+   ret = -EINVAL;
+   return ret;
+   }
+
+   if (externally_control) {
+   int chargers_externally_control = 1;
+
+   for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   if ((desc-charger_regulators[i] != charger)
+!desc-charger_regulators[i

[PATCH 5/5] charger-manager: Support limit of maximum possible duration for charging/discharging

2012-08-21 Thread Chanwoo Choi
This patch check maximum possible duration of charging/discharging.

If whole charging duration exceed 'desc-charging_max_duration_ms',
cm stop charging to prevent overcharge/overheat. And if discharging
duration exceed, charger cable is attached, after full-batt,
cm start charging to maintain fully charged state for battery.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c   |   81 -
 include/linux/power/charger-manager.h |   15 ++
 2 files changed, 95 insertions(+), 1 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 805f79d..96dd879 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -324,6 +324,14 @@ static int try_charger_enable(struct charger_manager *cm, 
bool enable)
if (enable) {
if (cm-emergency_stop)
return -EAGAIN;
+
+   /*
+* Save start time of charging to limit
+* maximum possible charging time.
+*/
+   cm-charging_start_time = ktime_to_ms(ktime_get());
+   cm-charging_end_time = 0;
+
for (i = 0 ; i  desc-num_charger_regulators ; i++) {
if (desc-charger_regulators[i].externally_control)
continue;
@@ -337,6 +345,13 @@ static int try_charger_enable(struct charger_manager *cm, 
bool enable)
}
}
} else {
+   /*
+* Save end time of charging to maintain fully charged state
+* of battery after full-batt.
+*/
+   cm-charging_start_time = 0;
+   cm-charging_end_time = ktime_to_ms(ktime_get());
+
for (i = 0 ; i  desc-num_charger_regulators ; i++) {
if (desc-charger_regulators[i].externally_control)
continue;
@@ -483,8 +498,55 @@ static void fullbatt_vchk(struct work_struct *work)
 
if (diff  desc-fullbatt_vchkdrop_uV) {
try_charger_restart(cm);
-   uevent_notify(cm, Recharge);
+   uevent_notify(cm, Recharging);
+   }
+}
+
+/**
+ * check_charging_duration - Monitor charging/discharging duration
+ * @cm: the Charger Manager representing the battery.
+ *
+ * If whole charging duration exceed 'charging_max_duration_ms',
+ * cm stop charging to prevent overcharge/overheat. If discharging
+ * duration exceed 'discharging _max_duration_ms', charger cable is
+ * attached, after full-batt, cm start charging to maintain fully
+ * charged state for battery.
+ */
+static int check_charging_duration(struct charger_manager *cm)
+{
+   struct charger_desc *desc = cm-desc;
+   u64 curr = ktime_to_ms(ktime_get());
+   u64 duration;
+   int ret = false;
+
+   if (!desc-charging_max_duration_ms
+!desc-discharging_max_duration_ms)
+   return ret;
+
+   if (cm-charger_enabled) {
+   duration = curr - cm-charging_start_time;
+
+   if (duration  desc-charging_max_duration_ms) {
+   dev_info(cm-dev, Charging duration exceed %lldms,
+   desc-charging_max_duration_ms);
+   uevent_notify(cm, Discharging);
+   try_charger_enable(cm, false);
+   ret = true;
+   }
+   } else if (is_ext_pwr_online(cm)  !cm-charger_enabled) {
+   duration = curr - cm-charging_end_time;
+
+   if (duration  desc-charging_max_duration_ms
+is_ext_pwr_online(cm)) {
+   dev_info(cm-dev, DisCharging duration exceed %lldms,
+   desc-discharging_max_duration_ms);
+   uevent_notify(cm, Recharing);
+   try_charger_enable(cm, true);
+   ret = true;
+   }
}
+
+   return ret;
 }
 
 /**
@@ -520,6 +582,13 @@ static bool _cm_monitor(struct charger_manager *cm)
}
 
/*
+* Check whole charging duration and discharing duration
+* after full-batt.
+*/
+   } else if (!cm-emergency_stop  check_charging_duration(cm)) {
+   dev_dbg(cm-dev,
+   Charging/Discharging duration is out of range);
+   /*
 * Check dropped voltage of battery. If battery voltage is more
 * dropped than fullbatt_vchkdrop_uV after fully charged state,
 * charger-manager have to recharge battery.
@@ -1369,6 +1438,16 @@ static int charger_manager_probe(struct platform_device 
*pdev)
goto err_chg_stat;
}
 
+   if (!desc-charging_max_duration_ms
+   || !desc

[PATCH 1/5] charger-manager: Disable battery charging when charger cable is detached

2012-08-21 Thread Chanwoo Choi
This patch disable before stop chargint forcibly when charger cable
is detached and check return value of regulator_enable/disable() fucntion
to confirm correct opertion of enabling/disabling charger(regulator).

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c |   21 +++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 526e5c9..f968301 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -271,9 +271,26 @@ static int try_charger_enable(struct charger_manager *cm, 
bool enable)
if (enable) {
if (cm-emergency_stop)
return -EAGAIN;
-   for (i = 0 ; i  desc-num_charger_regulators ; i++)
-   regulator_enable(desc-charger_regulators[i].consumer);
+   for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   err = regulator_enable(
+   desc-charger_regulators[i].consumer);
+   if (err  0) {
+   dev_warn(cm-dev,
+   Cannot enable %s regulator\n,
+   desc-charger_regulators[i].regulator_name);
+   }
+   }
} else {
+   for (i = 0 ; i  desc-num_charger_regulators ; i++) {
+   err = regulator_disable(
+   desc-charger_regulators[i].consumer);
+   if (err  0) {
+   dev_warn(cm-dev,
+   Cannot disable %s regulator\n,
+   desc-charger_regulators[i].regulator_name);
+   }
+   }
+
/*
 * Abnormal battery state - Stop charging forcibly,
 * even if charger was enabled at the other places
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] charger-manager: Check fully charged state of battery periodically

2012-08-21 Thread Chanwoo Choi
This patch check periodically fully charged state of battery to protect
overcharge and overheat. If battery is fully charged, stop charging
and check droped voltage with 'fullbatt_vchkdrop_ms' period. When voltage
of battery is more droped than 'fullbatt_vchkdrop_uV' voltage,
charger-manager will restart charging for battery.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c   |  161 -
 include/linux/power/charger-manager.h |8 ++-
 2 files changed, 123 insertions(+), 46 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 33cc3f6..805f79d 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -228,6 +228,58 @@ static bool is_charging(struct charger_manager *cm)
 }
 
 /**
+ * is_full_charged - Returns true if the battery is fully charged.
+ * @cm: the Charger Manager representing the battery.
+ */
+static bool is_full_charged(struct charger_manager *cm)
+{
+   struct charger_desc *desc = cm-desc;
+   union power_supply_propval val;
+   int ret = 0;
+   int uV;
+
+   /* If there is no battery, it cannot be charged */
+   if (!is_batt_present(cm)) {
+   val.intval = 0;
+   goto out;
+   }
+
+   if (cm-fuel_gauge  desc-fullbatt_full_capacity  0) {
+   /* Not full if capacity of fuel gauge isn't full */
+   ret = cm-fuel_gauge-get_property(cm-fuel_gauge,
+   POWER_SUPPLY_PROP_CHARGE_FULL, val);
+   if (!ret  val.intval  desc-fullbatt_full_capacity) {
+   val.intval = 1;
+   goto out;
+   }
+   }
+
+   /* Full, if it's over the fullbatt voltage */
+   if (desc-fullbatt_uV  0) {
+   ret = get_batt_uV(cm, uV);
+   if (!ret  uV = desc-fullbatt_uV) {
+   val.intval = 1;
+   goto out;
+   }
+   }
+
+   /* Full, if the capacity is more than fullbatt_soc */
+   if (cm-fuel_gauge  desc-fullbatt_soc  0) {
+   ret = cm-fuel_gauge-get_property(cm-fuel_gauge,
+   POWER_SUPPLY_PROP_CAPACITY, val);
+   if (!ret  val.intval = desc-fullbatt_soc) {
+   val.intval = 1;
+   goto out;
+   }
+   }
+
+   val.intval = 0;
+
+out:
+   return val.intval ? true : false;
+}
+
+/**
  * is_polling_required - Return true if need to continue polling for this CM.
  * @cm: the Charger Manager representing the battery.
  */
@@ -427,7 +479,7 @@ static void fullbatt_vchk(struct work_struct *work)
diff = desc-fullbatt_uV;
diff -= batt_uV;
 
-   dev_dbg(cm-dev, VBATT dropped %duV after full-batt.\n, diff);
+   dev_info(cm-dev, VBATT dropped %duV after full-batt.\n, diff);
 
if (diff  desc-fullbatt_vchkdrop_uV) {
try_charger_restart(cm);
@@ -450,10 +502,14 @@ static bool _cm_monitor(struct charger_manager *cm)
dev_dbg(cm-dev, monitoring (%2.2d.%3.3dC)\n,
cm-last_temp_mC / 1000, cm-last_temp_mC % 1000);
 
-   /* It has been stopped or charging already */
-   if (!!temp == !!cm-emergency_stop)
+   /* It has been stopped already */
+   if (temp  cm-emergency_stop)
return false;
 
+   /*
+* Check temperature whether overheat or cold.
+* If temperature is out of range normal state, stop charging.
+*/
if (temp) {
cm-emergency_stop = temp;
if (!try_charger_enable(cm, false)) {
@@ -462,10 +518,34 @@ static bool _cm_monitor(struct charger_manager *cm)
else
uevent_notify(cm, COLD);
}
+
+   /*
+* Check dropped voltage of battery. If battery voltage is more
+* dropped than fullbatt_vchkdrop_uV after fully charged state,
+* charger-manager have to recharge battery.
+*/
+   } else if (!cm-emergency_stop
+is_ext_pwr_online(cm)  !cm-charger_enabled) {
+   fullbatt_vchk(cm-fullbatt_vchk_work.work);
+
+   /*
+* Check whether fully charged state to protect overcharge
+* if charger-manager is charging for battery.
+*/
+   } else if (!cm-emergency_stop
+is_full_charged(cm)  cm-charger_enabled) {
+   dev_info(cm-dev, EVENT_HANDLE: Battery Fully Charged.\n);
+   uevent_notify(cm, default_event_names[CM_EVENT_BATT_FULL]);
+
+   try_charger_enable(cm, false);
+
+   fullbatt_vchk(cm-fullbatt_vchk_work.work);
} else {
cm-emergency_stop = 0;
-   if (!try_charger_enable(cm, true

[PATCH 2/5] charger-manager: Use replacement variable to check state of battery

2012-08-21 Thread Chanwoo Choi
This patch remove unnecessary variable(cm-fullbatt_vchk_uV) by using
'desc-fullbatt_uV' field directly in fullbatt_handler() function
to check the state of battery.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c   |2 +-
 include/linux/power/charger-manager.h |3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index f968301..bee010e 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -417,7 +417,7 @@ static void fullbatt_vchk(struct work_struct *work)
return;
}
 
-   diff = cm-fullbatt_vchk_uV;
+   diff = desc-fullbatt_uV;
diff -= batt_uV;
 
dev_dbg(cm-dev, VBATT dropped %duV after full-batt.\n, diff);
diff --git a/include/linux/power/charger-manager.h 
b/include/linux/power/charger-manager.h
index cd22029..7d7b90f 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -194,8 +194,6 @@ struct charger_desc {
  * @charger_enabled: the state of charger
  * @fullbatt_vchk_jiffies_at:
  * jiffies at the time full battery check will occur.
- * @fullbatt_vchk_uV: voltage in microvolt
- * criteria for full battery
  * @fullbatt_vchk_work: work queue for full battery check
  * @emergency_stop:
  * When setting true, stop charging
@@ -218,7 +216,6 @@ struct charger_manager {
bool charger_enabled;
 
unsigned long fullbatt_vchk_jiffies_at;
-   unsigned int fullbatt_vchk_uV;
struct delayed_work fullbatt_vchk_work;
 
int emergency_stop;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] Extcon: Arizona: unlock on an error in arizona_micdet()

2012-07-11 Thread Chanwoo Choi
Hi Dan,

On 07/11/2012 03:36 PM, Dan Carpenter wrote:

 Smatch complains about this.  I don't have a way to test this, but it
 does look like we should unlock on error here.
 
 Signed-off-by: Dan Carpenter dan.carpen...@oracle.com
 
 diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
 index b068bc9..4782884 100644
 --- a/drivers/extcon/extcon-arizona.c
 +++ b/drivers/extcon/extcon-arizona.c
 @@ -154,6 +154,7 @@ static irqreturn_t arizona_micdet(int irq, void *data)
   ret = regmap_read(arizona-regmap, ARIZONA_MIC_DETECT_3, val);
   if (ret != 0) {
   dev_err(arizona-dev, Failed to read MICDET: %d\n, ret);
 + mutex_unlock(info-lock);
   return IRQ_NONE;
   }
  

This patch is right.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] extcon: Remove CONFIG_EXTCON_MODULE config to fix build break

2012-07-11 Thread Chanwoo Choi
This patch modify 'Kconfig' of EXTCON Subsystem to support either
active or inactive of EXTCON Subsystem. The various subsystem refer
to EXTCON subsystem for controlling external connector, so core class
of EXTCON should be included in kernel image. If EXTCON subsystem is
builded with MODULE, other subsystem have build break because of
linking the core class of EXTCON.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/extcon/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index 29c5cf8..b0eac45 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -1,5 +1,5 @@
 menuconfig EXTCON
-   tristate External Connector Class (extcon) support
+   bool External Connector Class (extcon) support
help
  Say Y here to enable external connector class (extcon) support.
  This allows monitoring external connectors by userspace
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   10   >