Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752053AbdDCI2B (ORCPT ); Mon, 3 Apr 2017 04:28:01 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:50829 "EHLO epoutp02.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752020AbdDCI16 (ORCPT ); Mon, 3 Apr 2017 04:27:58 -0400 X-AuditID: b6c32a2e-f79506d0000046c0-db-58e2078c47f6 MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset="UTF-8" Message-id: <58E2078A.9070103@samsung.com> Date: Mon, 03 Apr 2017 17:27:54 +0900 From: Chanwoo Choi Organization: Samsung Electronics User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Andi Shyti , MyungJoo Ham , Jaewon Kim Cc: Seung-Woo Kim , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: Re: [PATCH v2 2/2] extcon: max77843: support USB accessories as external USB hosts In-reply-to: <20170402053542.29570-3-andi@etezian.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBJsWRmVeSWpSXmKPExsWy7bCmum4P+6MIg1dHJC1uLzrLbLH9yDNW i8U/njNZ7Gg4wmpx/vwGdovLu+awWdxuXMFmMWPySzYHDo/rSz4xe+ycdZfdY9OqTjaPvi2r GD0+b5ILYI1KtclITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1 y8wBukVJoSwxpxQoFJBYXKykb2dTlF9akqqQkV9cYqsUbWhopGdoYK5nZGSkZ2Ica2VkClSS kJox4/YK5oKnuhWPV0xla2A8odTFyMkhIWAiMfXLSlYIW0ziwr31bF2MXBxCAksZJQ5+/MIG khASaGeSmLOOC6Zh1/EPUEVzGCWaf75nB0nwCghK/Jh8j6WLkYODWUBe4silbJAws4CmxNbd 69kh6u8xSnTvbWUDqeEV0JL491kepIZ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4wg5aICERLdJypBwiIC5RIvd31m BBnJLLCdUWLrq3ZmkISwQKzEzXOrWSB2bWWU6N0yiRUkwSlgJrH9cBvrBEbBWUhOnYVw6iwk py5gZF7FKJFakFxQnJSea5SXWq5XnJhbXJqXrpecn7uJERyDz6R3MB7e5X6IUYCDUYmHV8P5 YYQQa2JZcWXuIUYJDmYlEd66n0Ah3pTEyqrUovz4otKc1OJDjKZAz05klhJNzgemh7ySeEMT cxNzYwMLc0tLEyMlcd7G2c/ChQTSE0tSs1NTC1KLYPqYODilGhjZ52Z6TSla/1rqlkjwCgOL go/b619MzLKsDDqZ8VTwi3OXiIXT5KXlMxkOr2Rft7n4w1Jr5x2/ipKSLyscKl7yN/GM79w3 7eqvBfONT7oVWi7QfyZmkdl3eJ/qn/+mSe+4xLfy9TKHfWI8s/OzT6un5xZON/v4QoVX/Gpn MjcfPpc9Wc9NiVuJpTgj0VCLuag4EQCznV141wIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170403082756epcas5p124c6289b91bff8860e866c68afa8c8c1 X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?7LWc7LCs7JqwG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbU2VuaW9yIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?Q2hhbndvbyBDaG9pG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtTZW5pb3IgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1NUQUYbQzEwVjgxMTE=?= CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170402053626epcas4p28872c873de3f935bc174ff74d0069e76 X-RootMTR: 20170402053626epcas4p28872c873de3f935bc174ff74d0069e76 References: <20170402053542.29570-1-andi@etezian.org> <20170402053542.29570-3-andi@etezian.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5720 Lines: 141 Hi, On 2017년 04월 02일 14:35, Andi Shyti wrote: > From: Andi Shyti > > The ADC state defines the resistance that a USB device has in > order to distinguish between devices. > > The external accessories (like the Gear VR) are defined as: > > MAX77843_MUIC_ADC_RESERVED_ACC_1 > MAX77843_MUIC_ADC_RESERVED_ACC_2 > MAX77843_MUIC_ADC_RESERVED_ACC_3 > MAX77843_MUIC_ADC_RESERVED_ACC_4 > MAX77843_MUIC_ADC_RESERVED_ACC_5 > > and they should be set as such in the extcon driver. > > Do not ignore interrupts generated by external accessories by > handling cables of the type from any of the above. > > Do not handle any charging related action. This can be > misleading as also external devices might have some power and in > such cases the MUIC might consider them as power providers. In > this case check the value of the adc and if it corresponds to > one or the MAX77843_MUIC_ADC_RESERVED_ACC_*, return a no-action > value (MAX77843_MUIC_CHG_NONE). > > Signed-off-by: Andi Shyti > --- > drivers/extcon/extcon-max77843.c | 24 +++++++++++++++++++----- > 1 file changed, 19 insertions(+), 5 deletions(-) > > diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c > index fcdabc4b4025..154d65afd45a 100644 > --- a/drivers/extcon/extcon-max77843.c > +++ b/drivers/extcon/extcon-max77843.c > @@ -271,6 +271,20 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info, > } else { > *attached = true; > switch (adc) { > + /* > + * the MAX77843_MUIC_ADC_RESERVED_ACC_* type are > + * external eccessories and as such they don't s/eccessories/accessories > + * need any charging action. In this case just > + * return MAX77843_MUIC_CHG_NONE so that charging type > + * interrupts are ignored. > + */ > + case MAX77843_MUIC_ADC_RESERVED_ACC_1: > + case MAX77843_MUIC_ADC_RESERVED_ACC_2: > + case MAX77843_MUIC_ADC_RESERVED_ACC_3: > + case MAX77843_MUIC_ADC_RESERVED_ACC_4: > + case MAX77843_MUIC_ADC_RESERVED_ACC_5: > + info->prev_chg_type = MAX77843_MUIC_CHG_NONE; > + break; > case MAX77843_MUIC_ADC_GROUND: > info->prev_chg_type = MAX77843_MUIC_CHG_GND; > break; > @@ -403,6 +417,11 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info) > > switch (cable_type) { > case MAX77843_MUIC_ADC_GROUND: > + case MAX77843_MUIC_ADC_RESERVED_ACC_1: > + case MAX77843_MUIC_ADC_RESERVED_ACC_2: > + case MAX77843_MUIC_ADC_RESERVED_ACC_3: > + case MAX77843_MUIC_ADC_RESERVED_ACC_4: > + case MAX77843_MUIC_ADC_RESERVED_ACC_5: > ret = max77843_muic_adc_gnd_handler(info); > if (ret < 0) > return ret; > @@ -427,11 +446,6 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info) > case MAX77843_MUIC_ADC_REMOTE_S10_BUTTON: > case MAX77843_MUIC_ADC_REMOTE_S11_BUTTON: > case MAX77843_MUIC_ADC_REMOTE_S12_BUTTON: > - case MAX77843_MUIC_ADC_RESERVED_ACC_1: > - case MAX77843_MUIC_ADC_RESERVED_ACC_2: > - case MAX77843_MUIC_ADC_RESERVED_ACC_3: > - case MAX77843_MUIC_ADC_RESERVED_ACC_4: > - case MAX77843_MUIC_ADC_RESERVED_ACC_5: > case MAX77843_MUIC_ADC_AUDIO_DEVICE_TYPE2: > case MAX77843_MUIC_ADC_PHONE_POWERED_DEV: > case MAX77843_MUIC_ADC_TTY_CONVERTER: > The extcon-max77843.c driver was implemented with real use-case by testing the various kind of external connectors. I want to apply the part for real use-case of this patch. As I knew, you tested this patch with only MAX77843_MUIC_ADC_RESERVED_ACC_4. So, I prefer to apply following patch only for MAX77843_MUIC_ADC_RESERVED_ACC_4. -- drivers/extcon/extcon-max77843.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c index fcdabc4b4025..45367d74bc01 100644 --- a/drivers/extcon/extcon-max77843.c +++ b/drivers/extcon/extcon-max77843.c @@ -271,6 +271,16 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info, } else { *attached = true; switch (adc) { + case MAX77843_MUIC_ADC_RESERVED_ACC_4: + /* + * The MAX77843_MUIC_ADC_RESERVED_ACC_* type are + * external accessories and as such they don't + * need any charging action. In this case just + * return MAX77843_MUIC_CHG_NONE so that + * charging type interrupts are ignored. + */ + info->prev_chg_type = MAX77843_MUIC_CHG_NONE; + break; case MAX77843_MUIC_ADC_GROUND: info->prev_chg_type = MAX77843_MUIC_CHG_GND; break; @@ -403,6 +413,7 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info) switch (cable_type) { case MAX77843_MUIC_ADC_GROUND: + case MAX77843_MUIC_ADC_RESERVED_ACC_4: ret = max77843_muic_adc_gnd_handler(info); if (ret < 0) return ret; @@ -430,7 +441,6 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info) case MAX77843_MUIC_ADC_RESERVED_ACC_1: case MAX77843_MUIC_ADC_RESERVED_ACC_2: case MAX77843_MUIC_ADC_RESERVED_ACC_3: - case MAX77843_MUIC_ADC_RESERVED_ACC_4: case MAX77843_MUIC_ADC_RESERVED_ACC_5: case MAX77843_MUIC_ADC_AUDIO_DEVICE_TYPE2: case MAX77843_MUIC_ADC_PHONE_POWERED_DEV: -- Best Regards, Chanwoo Choi Samsung Electronics