From patchwork Thu May 20 11:23:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 443488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6429C43461 for ; Thu, 20 May 2021 11:28:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 976D060FEE for ; Thu, 20 May 2021 11:28:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240255AbhETL34 (ORCPT ); Thu, 20 May 2021 07:29:56 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.164]:36425 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241466AbhETL1g (ORCPT ); Thu, 20 May 2021 07:27:36 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1621509957; cv=none; d=strato.com; s=strato-dkim-0002; b=MsUia02C2E5uBy4+Fgebfy1n9euxibf2rdR5VWakwLOfpwB1sioJQHhJaiZjViN3ld T1IN/lJlEiEwj8YvcSLW/l+DlLAygHBtuNLhH47d0cKIzcDnOF5Qx9TALdjvUzTRjwai 2Eins/LJpAW7crD4Xb+M4WopPuiG7XKEBW+zq+dsF4f+JtgyfR6YVpbkIRWhu25coRHH L2Azrbs8aihYBDVWBN1uTbyfgw86m8/S6zwF4QSZ1dEQab/7pcV/kAQrkF39yUGU6Y2I fVVdtys6ZtsAzSzlx9Gi8dwTw9febGB+tgXN0DGWiadj26VXYOfgIXxobbEiMDxM3Elw /RYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509957; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=QMFQUItGXEg8WHkHGki0AdlafSjTgNyjXY25dbfzkdI=; b=G/a/QLKV4dDSGl68+Tmjb3uPE8kAvmzlA07lt7rKWqutw+b8EfL1IQaY1NSyl9WuFj vRIOvnutCwMH/mPB4Vx+Hj2rV0SBqfO8+irY3FuJLjowr+0xl91luqoyA12ejvvkX4kP Xz1ho+B0iHqEZng15bddy1vX+MMJcKdq9YefKQa8R63bGw+XvGskpsM31avL4zLuq3+/ A3mRgEKwRG5PGI0LezC74NG23OECleOjlUICIqejbtDijcKfBfYx+7deW8KT7W5gVTcq +ks9yAlwNzND7a8l12gV1zZtp1tatulbxRQQ0vuFEpckCfZYDUfzUlQpShYO8p5bDEEv UdOw== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509957; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=QMFQUItGXEg8WHkHGki0AdlafSjTgNyjXY25dbfzkdI=; b=oqHa/IjJwKkR2EZrtuOO4N/noUs1TqmRxywTBLou/+9EK2rQAPFEp6TtTERStxkZnQ +12dP5gjotsYrTqqmCWYfkKDqzMQ7Q9W2XhKq0XJzHQChAdAVZLWX7SF/gJu+MuOl4Sm yQbW8kfEZHhvHGyT3zP1GMZmMB0xU4nlHDbjefmjiEm/Mt3GXrMAeF6rt0VgSsb0POkt ZHW1zaMcoNG+PFK1C7h+rWXWjpCqcEI3ZT2iOGI++m5+WPHpmiKlYjyI/YWugdyFwDHp IKnU0GcYuZ/T0MdSbg/XnwpCx3muUBl+QIqwugcGpxKbFLylCZ4nt1wAeJ7KgVWootC1 aJFw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB4G6FtFQ=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.26.1 DYNA|AUTH) with ESMTPSA id 400bd8x4KBPu22T (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 May 2021 13:25:56 +0200 (CEST) From: Stephan Gerhold To: Chanwoo Choi , MyungJoo Ham Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin , ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 1/6] extcon: sm5502: Use devm_regmap_add_irq_chip() Date: Thu, 20 May 2021 13:23:29 +0200 Message-Id: <20210520112334.129556-2-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520112334.129556-1-stephan@gerhold.net> References: <20210520112334.129556-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Use devm_regmap_add_irq_chip() to avoid having to remove the irqchip explicitly in sm5502_muic_i2c_remove(). Signed-off-by: Stephan Gerhold --- drivers/extcon/extcon-sm5502.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c index db41d1c58efd..f0d155cf7518 100644 --- a/drivers/extcon/extcon-sm5502.c +++ b/drivers/extcon/extcon-sm5502.c @@ -600,8 +600,8 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c, /* Support irq domain for SM5502 MUIC device */ irq_flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED; - ret = regmap_add_irq_chip(info->regmap, info->irq, irq_flags, 0, - &sm5502_muic_irq_chip, &info->irq_data); + ret = devm_regmap_add_irq_chip(info->dev, info->regmap, info->irq, irq_flags, + 0, &sm5502_muic_irq_chip, &info->irq_data); if (ret != 0) { dev_err(info->dev, "failed to request IRQ %d: %d\n", info->irq, ret); @@ -661,15 +661,6 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c, return 0; } -static int sm5502_muic_i2c_remove(struct i2c_client *i2c) -{ - struct sm5502_muic_info *info = i2c_get_clientdata(i2c); - - regmap_del_irq_chip(info->irq, info->irq_data); - - return 0; -} - static const struct of_device_id sm5502_dt_match[] = { { .compatible = "siliconmitus,sm5502-muic" }, { }, @@ -714,7 +705,6 @@ static struct i2c_driver sm5502_muic_i2c_driver = { .of_match_table = sm5502_dt_match, }, .probe = sm5022_muic_i2c_probe, - .remove = sm5502_muic_i2c_remove, .id_table = sm5502_i2c_id, }; From patchwork Thu May 20 11:23:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 443486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65118C433B4 for ; Thu, 20 May 2021 11:28:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 550B861057 for ; Thu, 20 May 2021 11:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236858AbhETLaB (ORCPT ); Thu, 20 May 2021 07:30:01 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.80]:22810 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241477AbhETL1n (ORCPT ); Thu, 20 May 2021 07:27:43 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1621509957; cv=none; d=strato.com; s=strato-dkim-0002; b=YiWxmdNZVNEURRgHh2zS/Lk3DU9vi6+Q4ThNObccfZ5jRlapuLMJpuT1Deif8qC20t myjhZvIkdGVHF80kNq4vou0WRYMlQ2VTIAGcQJ/+p22p9p7uZN3tsMNXkWV7gKvUFkWh uMLaCTXOgyeHqCzIOzgjbOqFF4pWgM4+Co7A++oePlvHPFZyGIhIENbXhcI6ihb1UFtg 4E2ZgDFr2nFefJvCaGj4s8E/4OH7jJG5hsb34n5P322ly06ehc+RnQMEklKEOT8pKO83 L08xhT56dDQxIenOu4yyxwSAmRqwxHiJnbMawWqMl2DX6K+ybpQJDX4oItZTgdgvtBnE oGvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509957; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=K2eJgpXpY/tpzZTBI+UgcYaqxpRI58FPkFkDl3yfQRM=; b=BC/cN54UTLVdsLnEB5NDfvyBHbU/HsZ1C18Lm3/7wsYcmzGG7cdfkq9Xt7dadFWLdK MrkMmEVY6IPKKCaX7kz8PZ9/WCYmruXve7+4a7yZWVya7SALuJk3eOOKelhLfEM64Ums BKbOgCMLl/wJFu5emuLKNKJAXvmkogvVHGPRqbkRE14QzlWlZOJoIG00zyEC6uHflJTa k5haT0yVfPgvDHhzRnSTs9AR8/KjmVyLCUfeF17fvk/mwdzPIp6Mak8zwZtJvQmvmfgI JcLBAs7aRz+FNFFfTKS8Wo+jQg8rgGhzZMZ9+7GQBaaC7jdoCv7jOR2zcD0AZfrUyQRJ 3Grw== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509957; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=K2eJgpXpY/tpzZTBI+UgcYaqxpRI58FPkFkDl3yfQRM=; b=l0hvOrJFU5Wyyv2GpR8HC9dov2u20XUE6Lcm1XhRSqSuGP9AkyuqpQxhOwfyXRdBmS mRPeAlV1O+vfUeez2yTkzW7V0LTRBEGrcp/zzqIYWE5Koj8HFmC7X5qhrHAfWmc02w9V /ftsHy5PJOAovb9wGSSq2AsVV93y+r9YmHISjDWwiWKcOdqB815/Jw08pqLuPWSydaL3 2kMekAtB2zuDhFVQWbO1lwSZVd5nXVAb98qNG6/Lu34Dt543UIrOlE4HkhZJ6cWdzUmg 3pCRcNQaq5SxBXgeh6+mcnyiKIltWtX2acDW2JlFgNvGEB3FmYroSlzGODWsnY4PHLVN POoQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB4G6FtFQ=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.26.1 DYNA|AUTH) with ESMTPSA id 400bd8x4KBPv22U (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 May 2021 13:25:57 +0200 (CEST) From: Stephan Gerhold To: Chanwoo Choi , MyungJoo Ham Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin , ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 2/6] extcon: sm5502: Implement i2c_driver->probe_new() Date: Thu, 20 May 2021 13:23:30 +0200 Message-Id: <20210520112334.129556-3-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520112334.129556-1-stephan@gerhold.net> References: <20210520112334.129556-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org sm5022_muic_i2c_probe() does not use the i2c_device_id, so implement i2c_driver->probe_new() instead of probe(). Signed-off-by: Stephan Gerhold --- drivers/extcon/extcon-sm5502.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c index f0d155cf7518..907ecd01ebb7 100644 --- a/drivers/extcon/extcon-sm5502.c +++ b/drivers/extcon/extcon-sm5502.c @@ -563,8 +563,7 @@ static void sm5502_init_dev_type(struct sm5502_muic_info *info) } } -static int sm5022_muic_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static int sm5022_muic_i2c_probe(struct i2c_client *i2c) { struct device_node *np = i2c->dev.of_node; struct sm5502_muic_info *info; @@ -704,7 +703,7 @@ static struct i2c_driver sm5502_muic_i2c_driver = { .pm = &sm5502_muic_pm_ops, .of_match_table = sm5502_dt_match, }, - .probe = sm5022_muic_i2c_probe, + .probe_new = sm5022_muic_i2c_probe, .id_table = sm5502_i2c_id, }; From patchwork Thu May 20 11:23:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 443487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA21C43460 for ; Thu, 20 May 2021 11:28:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FE9160FEE for ; Thu, 20 May 2021 11:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241210AbhETL36 (ORCPT ); Thu, 20 May 2021 07:29:58 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:18700 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241471AbhETL1h (ORCPT ); Thu, 20 May 2021 07:27:37 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1621509958; cv=none; d=strato.com; s=strato-dkim-0002; b=sy10FlllC1Fgizp2EP+bAeb7KDOxxOzQHZM+MGFKv05AaHKvYqh7rkKBbDoCPrOXmi NI8K7v8D4XdUplY1A97cECFxEUmjabdTIPzytDQCZkc4UKYHHwBV2oPOE4lugO2bi+15 VRIfecmQHO5jV/lpYtdwBwuoZFqfBj+P1OCCtZZDHj/x2XDFtQoTfnlAE21aJLgIjPH7 ICJv0i6UlNSPnnL65ClKHzvcFn1PIPZeTRD2KKILLVTRtzhr7xBQIgrrii3+DDr8Sgg9 RSpP0SaNqDYU+JAQnXUC/cs4k39tNKcRkZuZHoMM0ODxV2ADEWrT4ctPemnCP/Owk5/J WTmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509958; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=QJ7EL3rdKbTeB2eISpfKJ6qyYsqnmKEy5taAecFN25g=; b=L/VTzvlJg9qBg9+D09yJ2Nj14dnCLARMZFow0Q2/JMghKWItVAIWmqvRBktSAKGf2o TDA/T1mGXC2huV6FFpl02NWX+aY2xLL9MqmA+kKSt2AwNDW83+tjZRMK8X15e2sJwWVG 0zgCVHITTDPzTS73LkxjQtVr6MBllO/osSUEwDopjpPEMVQvEZAX9dG8AhjILQoh65xL ACb/67Ey5A4dknRFO40oVAxchNn6pbc6EfmfMzxWtJFxmdb3+liCp6FsY9YZyp8Gqkaj qMqHZJDIkBxJ4tkat8qn9mDR4rqwZ92NoShl+FcVwr+2MohzLkYhzCbb1MP77gFl307o vf6Q== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509958; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=QJ7EL3rdKbTeB2eISpfKJ6qyYsqnmKEy5taAecFN25g=; b=Ob+RciMyx+BYZ6xZ5HrnG/72nFAOfT3/8LomyCVrg8NJHbuiOm//wNdELiEvPe1Slt 6aU+zwabVwJTrMJogewDdZmuao8zy0IXfxlHXFKrOYj/0Aa+6GHIZA7HjnPfzXAYuvs4 QqPzWQ3cjc+0L88p7YlECI3wSsyYK/pMAhUzuf9Djw8ejQv6j65gZ7iTPO+YfVzhOx9t /Ji4pIgRbuRMXEoVmjtuxYVIgHAJdtGL2xDcw6pYfudUrLJPavkRCnKYNdWble8wtC7M +RFb36AhxYsrxUh70jEYTgEI99jcCfIGWkASHgho4HDXRqQuhHsmUczUzhyCJScRmFNG v1xg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB4G6FtFQ=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.26.1 DYNA|AUTH) with ESMTPSA id 400bd8x4KBPv22V (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 May 2021 13:25:57 +0200 (CEST) From: Stephan Gerhold To: Chanwoo Choi , MyungJoo Ham Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin , ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 3/6] extcon: sm5502: Drop invalid register write in sm5502_reg_data Date: Thu, 20 May 2021 13:23:31 +0200 Message-Id: <20210520112334.129556-4-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520112334.129556-1-stephan@gerhold.net> References: <20210520112334.129556-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org When sm5502_init_dev_type() iterates over sm5502_reg_data to initialize the registers it is limited by ARRAY_SIZE(sm5502_reg_data). There is no need to add another empty element to sm5502_reg_data. Having the additional empty element in sm5502_reg_data will just result in writing 0xff to register 0x00, which does not really make sense. Fixes: 914b881f9452 ("extcon: sm5502: Add support new SM5502 extcon device driver") Signed-off-by: Stephan Gerhold --- drivers/extcon/extcon-sm5502.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c index 907ecd01ebb7..9f40bb9f1f81 100644 --- a/drivers/extcon/extcon-sm5502.c +++ b/drivers/extcon/extcon-sm5502.c @@ -88,7 +88,6 @@ static struct reg_data sm5502_reg_data[] = { | SM5502_REG_INTM2_MHL_MASK, .invert = true, }, - { } }; /* List of detectable cables */ From patchwork Thu May 20 11:23:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 444881 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B13F9C43462 for ; Thu, 20 May 2021 11:28:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BD9D61358 for ; Thu, 20 May 2021 11:28:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241308AbhETLaA (ORCPT ); Thu, 20 May 2021 07:30:00 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([81.169.146.168]:9021 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241478AbhETL1n (ORCPT ); Thu, 20 May 2021 07:27:43 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1621509958; cv=none; d=strato.com; s=strato-dkim-0002; b=kgtEbhr4OPZfh3xyLyj8TtSVTz+m2R51PCDuT0+OnwYsRH794ekSwe2UtH+f9A5fxm rLCY+xwoENnaBCqACqI634nrKOtVAVPvHbXiicraKLS4IlMMALYHVcK0lW/qlxaVUjs+ mR6gu7nRTLkMuWZFoHLDbbSw0inVyHeaiiUevUE4/VZn9t2RAQhjbUHv2paRuC5KILgr MGkAIG9zxixpaPokw1E4yJymKTY3EsLncFZfweX4YJ4aj+GLNa4Rs0C/gOkRKflPuhbd egrIrtnIBtgjeT7ct6YAqGMov5n2wonTI5DZ8MtM6GjSSwwS4YdZGKaZn6YjpJxHVO8s TCRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509958; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=ja+Dyqh1Z6Ju11L3zE36ZgR2UU7d8g6j7i6GUDH+quk=; b=rv5PJzVPlktJhImPBjsrcFC0T39VK4t3E9R0CrCgQ1pjAhqhNGFCT2Y6QWggB9Wd6c NIqc9KkbOx7TAv07sAcnRs8i1iXp/8+kRT1bevZx+twsMqodhwCX8Ve80wsU01AYmvA0 y9hiHOgWBiFdSAZq9Ei8OYXnrxEMeHJmlk/GyeAZtSXfXjZmo1fSeZLyR9TBmjbFbwnI 6axM3gAHdkgz+8BPuqQ6N7OqspW65LJ5Fi4ki49u7ZKPmFC/HKavOpJnP/PCy3g+QtBX a9L9UdM1nMCfRGw66mD6ue+gHbR9B987EI+3Rz3f1kkn7M7bHQkoRoThnHcoGsgGBH2U fY9A== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509958; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=ja+Dyqh1Z6Ju11L3zE36ZgR2UU7d8g6j7i6GUDH+quk=; b=Y+PMpJY/PwStsGVv+it4bK+Ja5DYD/U1Fnzt/vpg9lcBPAxQeZPs5AyMX5PsBdZZD+ 88F6Q8FZOscynNRsSh2VJkYrEE0/n0kPrODchdT+pTtw8IYTFcrvlB33dFrSXm2wEM25 56GShHPHToThF8h3buqm3X3UFBrswTAxU229oEHuEgcmoAuqxvqks1ZYy+ST9Qb5H8CF oQ3cUwWHBDoEs5Wezzha40BTQ4he4RNQFyVkXCyyp0nBH/91jnEbcZasJ7mnCdx5c0RE y9NQOtj28mrDwWz2Coc9aUsiYQ6VRMOFGPXlULC67DLkMTq4vFOXy2cXzRjPn5eNlHsy eYzw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB4G6FtFQ=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.26.1 DYNA|AUTH) with ESMTPSA id 400bd8x4KBPw22W (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 May 2021 13:25:58 +0200 (CEST) From: Stephan Gerhold To: Chanwoo Choi , MyungJoo Ham Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin , ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 4/6] dt-bindings: extcon: sm5502: Convert to DT schema Date: Thu, 20 May 2021 13:23:32 +0200 Message-Id: <20210520112334.129556-5-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520112334.129556-1-stephan@gerhold.net> References: <20210520112334.129556-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Convert the extcon-sm5502 device tree bindings to DT schema. Signed-off-by: Stephan Gerhold --- .../bindings/extcon/extcon-sm5502.txt | 21 -------- .../extcon/siliconmitus,sm5502-muic.yaml | 50 +++++++++++++++++++ 2 files changed, 50 insertions(+), 21 deletions(-) delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-sm5502.txt create mode 100644 Documentation/devicetree/bindings/extcon/siliconmitus,sm5502-muic.yaml diff --git a/Documentation/devicetree/bindings/extcon/extcon-sm5502.txt b/Documentation/devicetree/bindings/extcon/extcon-sm5502.txt deleted file mode 100644 index fc3888e09549..000000000000 --- a/Documentation/devicetree/bindings/extcon/extcon-sm5502.txt +++ /dev/null @@ -1,21 +0,0 @@ - -* SM5502 MUIC (Micro-USB Interface Controller) device - -The Silicon Mitus SM5502 is a MUIC (Micro-USB Interface Controller) device -which can detect the state of external accessory when external accessory is -attached or detached and button is pressed or released. It is interfaced to -the host controller using an I2C interface. - -Required properties: -- compatible: Should be "siliconmitus,sm5502-muic" -- reg: Specifies the I2C slave address of the MUIC block. It should be 0x25 -- interrupts: Interrupt specifiers for detection interrupt sources. - -Example: - - sm5502@25 { - compatible = "siliconmitus,sm5502-muic"; - interrupt-parent = <&gpx1>; - interrupts = <5 0>; - reg = <0x25>; - }; diff --git a/Documentation/devicetree/bindings/extcon/siliconmitus,sm5502-muic.yaml b/Documentation/devicetree/bindings/extcon/siliconmitus,sm5502-muic.yaml new file mode 100644 index 000000000000..0432b0502e0b --- /dev/null +++ b/Documentation/devicetree/bindings/extcon/siliconmitus,sm5502-muic.yaml @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/extcon/siliconmitus,sm5502-muic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SM5502 MUIC (Micro-USB Interface Controller) device + +maintainers: + - Chanwoo Choi + +description: + The Silicon Mitus SM5502 is a MUIC (Micro-USB Interface Controller) device + which can detect the state of external accessory when external accessory is + attached or detached and button is pressed or released. It is interfaced to + the host controller using an I2C interface. + +properties: + compatible: + enum: + - siliconmitus,sm5502-muic + + reg: + maxItems: 1 + description: I2C slave address of the device. Usually 0x25 for SM5502. + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + extcon@25 { + compatible = "siliconmitus,sm5502-muic"; + reg = <0x25>; + interrupt-parent = <&msmgpio>; + interrupts = <12 IRQ_TYPE_EDGE_FALLING>; + }; + }; From patchwork Thu May 20 11:23:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 443485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ADBEC433ED for ; Thu, 20 May 2021 11:28:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7FABC6100A for ; Thu, 20 May 2021 11:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241346AbhETLaC (ORCPT ); Thu, 20 May 2021 07:30:02 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([81.169.146.170]:27285 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241483AbhETL1o (ORCPT ); Thu, 20 May 2021 07:27:44 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1621509958; cv=none; d=strato.com; s=strato-dkim-0002; b=GDx9DO8+B6qQBe4gvli1ho6qi/qluGb1O3JTJacqR4s9fmB8Obx6eOYSLYSqyF574Y 74laAnxdy8s83rkDTfsb9zvzcDctVhIAjJMo5brdyjulGB2NZz817AQ7Nh7IJxOCQxov tapPlGwzsvWT+ZAIMRJ5SlJHENGeuyZ/qbFf9gYKqAx7TVkGCc/EkGN5o2p3orJbmEKw Ky+5fnkunFR4Upp5KGOIiaPh0fTlLd9cI0wPFTYLGxVOoMc7PgWPt93m4+f1h9wTL8Ne q3pmfVTtclNC3+FkT5OXAx4A4oWmrIiux1QHr1CNWgEIxjk1IFb3j6UmA+1wT3hONNsL XtbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509958; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=WusjepEf0ImZGQpetBmFDA0rblZD8nyERdVuhtSp86Q=; b=B+X/P+JeEtIaJwYWoiPQ6eB3KXYY21ya7gQw7GTOifcK7BDT4zMerZNjrcPJFgfEKR lPdAbfOVff/FIk455kWdnvmADjEUHxqVSLkrO6UUwL+NbT2xgfgk3h6rQ0hFih864Lom Puxd+qBy1kOKtqE8aYxSsVwf6IXe8a5Ac+EzootHa8bYMfJtHgr+dvvdAjAVz//qgOKL BpG3drkOGbo7RrBuhoeMTNsrrqrtyCX38cu6OwwpNcUbY3Yd7qkncXXceq79Xh+x9Nxz /8zwxiHRz2ofn4dli/vjZRB95RlnGNFcblGRWiHixWYRokMe8prG+NjaETmovKlT0iEf Dn6A== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509958; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=WusjepEf0ImZGQpetBmFDA0rblZD8nyERdVuhtSp86Q=; b=FUw3GgIQXe23hDTOe4lQc9IGF/2vlesAIEnkLX/snJNwERSkEF6o6DSeUhAGd9JtbY x5wMpJdk9ccRG8P2dlIaGEMeo+pNtBVgZqyz54GTa0lFt599jnMZ67oYIXFiL00DUNNF 0XzAzlvage7jyEbwL9tfMWR9EXafWefQjesKgBUD8wH/mMH4eDp0gVy1fbvvElCY/868 /z+vwLm0IDXyC5wP1sEw0klQ2yN/8s/dYF0491Hn6BOCdq04Bi9s50NvbvCOveHsb1aa P1mNRpVmzhZODiafR8bT+yIaeWxqDC3PjLOCkmPm0v/bh7G/tw3BCzNXBrfX3Mdz6eyi w5XA== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB4G6FtFQ=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.26.1 DYNA|AUTH) with ESMTPSA id 400bd8x4KBPw22X (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 May 2021 13:25:58 +0200 (CEST) From: Stephan Gerhold To: Chanwoo Choi , MyungJoo Ham Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin , ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 5/6] dt-bindings: extcon: sm5502: Document siliconmitus, sm5504-muic Date: Thu, 20 May 2021 13:23:33 +0200 Message-Id: <20210520112334.129556-6-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520112334.129556-1-stephan@gerhold.net> References: <20210520112334.129556-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Document support for SM5504 with the new siliconmitus,sm5504-muic compatible. Signed-off-by: Stephan Gerhold --- .../bindings/extcon/siliconmitus,sm5502-muic.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/extcon/siliconmitus,sm5502-muic.yaml b/Documentation/devicetree/bindings/extcon/siliconmitus,sm5502-muic.yaml index 0432b0502e0b..fd2e55088888 100644 --- a/Documentation/devicetree/bindings/extcon/siliconmitus,sm5502-muic.yaml +++ b/Documentation/devicetree/bindings/extcon/siliconmitus,sm5502-muic.yaml @@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/extcon/siliconmitus,sm5502-muic.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: SM5502 MUIC (Micro-USB Interface Controller) device +title: SM5502/SM5504 MUIC (Micro-USB Interface Controller) device maintainers: - Chanwoo Choi @@ -19,10 +19,12 @@ properties: compatible: enum: - siliconmitus,sm5502-muic + - siliconmitus,sm5504-muic reg: maxItems: 1 - description: I2C slave address of the device. Usually 0x25 for SM5502. + description: I2C slave address of the device. Usually 0x25 for SM5502, + 0x14 for SM5504. interrupts: maxItems: 1 From patchwork Thu May 20 11:23:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 444882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B980BC43461 for ; Thu, 20 May 2021 11:28:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CC5E60FF0 for ; Thu, 20 May 2021 11:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238962AbhETL37 (ORCPT ); Thu, 20 May 2021 07:29:59 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([81.169.146.168]:13617 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241470AbhETL1h (ORCPT ); Thu, 20 May 2021 07:27:37 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1621509959; cv=none; d=strato.com; s=strato-dkim-0002; b=QdQGoosK5eEGMVA7/yRACZ9FVNifkr2uaBXA7X7Fj3OUsXRJbh+zR7z4IE+3p0Eas6 CNQz0YCIJwZmu252OcgfzTuZWtvB54AAHBDz7XkmEnuhIt1nqROWlyE5mAms/2t1uRu0 BZEzs4M/S8/ktMUjCFOCh+F0j14y/sG4kB2c4iDnNzuDxYrBYUMqittnzsTXHnDDjj3R +mhTCMZfeze9JjlIbehMeww8pjAop2IxEsmUbDtZ6Ab3q5N3cTCsBlvSpnAserwGJyJ3 ktj29lpXAp/SIuPmFxYI0gKZ5Jc9rcqMYKA2wyg3npHHt4QyVHcu7uqIKi6t2a6QfwxC XO7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509959; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=kw7a0RxRU8YCQxK+PGjEsWQ+2SyP8ysJNAGd1toqkRU=; b=JOqd3gOjtOceKjce8HTx5vhrkN2R9RNMIqTbFZxxmPvla3sYc11B/mnSoCB0jgv9gd P124nFmo/68HVcAgvidQNAKYeWgMFQ1ySSRglRkAf7h3rXnowzEs/d1+4JPf4bsXRBMv jXD5k5JNL0yc5kuhDsi19SyIWUYroxbgai1m5haeTKq/7Fj5lQQjpiSozw7tMim7ygJ2 toAYDj5Dq8ffQ0NbxLKMIRxUe9vZH6VDt09IEJcu0VOtfujlXfxGf9F3NJN7ToPH4y/i NcgXC0Xq10sYFg0UGQebpH4+K1tXcV9oTrgbmaulM3SmO+9+5HPe0N8otBjNT9+amI3A 3UEg== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1621509959; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=kw7a0RxRU8YCQxK+PGjEsWQ+2SyP8ysJNAGd1toqkRU=; b=dkkH2e80pHsdqIHfpu2NF6Y/RUIHJpIJfrotYbqA39RC5pWzdEEIoy5+UgV21C8r+S IVCN1XUvE59KvbwbjN7AkWUbOU0AbZDHc26yk2c/bzEuCgoKKfZOcuG8Y/s3hF0EfUqI 1VbXcuokhYlYgIdfUE+NxAXs7jF3GBe1ZTkuvcHCfVSZ5Mu54YfQ6Ce6Qk92rwRVU1kv IkXq8nOI4+nj0skjqiWRoBEXECk3Im76MZOohi1GzkRFRyycpzlRPSwIw0sOVLEBMV6T kCDaODFIomYoBT9DSez2KPaihvtnSvt9RjjZ7BSNcWIdGsD1Pz//DQ87mX0U+eSdfZBC OG2Q== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB4G6FtFQ=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.26.1 DYNA|AUTH) with ESMTPSA id 400bd8x4KBPw22Y (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 May 2021 13:25:58 +0200 (CEST) From: Stephan Gerhold To: Chanwoo Choi , MyungJoo Ham Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin , ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 6/6] extcon: sm5502: Add support for SM5504 Date: Thu, 20 May 2021 13:23:34 +0200 Message-Id: <20210520112334.129556-7-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520112334.129556-1-stephan@gerhold.net> References: <20210520112334.129556-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org SM5504 is another MUIC from Silicon Mitus that is fairly similar to SM5502. They seem to use the same register set, but: - SM5504 has some additional bits in SM5502_REG_CONTROL - SM5504 has a quite different set of interrupts - SM5504 reports USB OTG as dev_type1 = BIT(0) instead of BIT(7) Overall it's minor and we can support this using the existing enum sm5502_types plus a few switch/if statements. Signed-off-by: Stephan Gerhold Reported-by: kernel test robot --- Interestingly enough the register set (and especially the interrupts) also look *very* similar to Richtek RT8973A (extcon-rt8973a) but I didn't investigate this further. Note that the changes in this patch are mostly based on guesswork based on a SM5504 driver from Nitin Chaudhary [1] used in some Samsung vendor kernels, since I was not able to find a public datasheet for SM5504. [1]: https://github.com/NitinChaudharyUSC/MSM8x16_8x26/blob/master/drivers/misc/sm5504.c --- drivers/extcon/Kconfig | 2 +- drivers/extcon/extcon-sm5502.c | 164 +++++++++++++++++++++++++++++---- drivers/extcon/extcon-sm5502.h | 79 ++++++++++++++++ 3 files changed, 228 insertions(+), 17 deletions(-) diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig index e3db936becfd..c69d40ae5619 100644 --- a/drivers/extcon/Kconfig +++ b/drivers/extcon/Kconfig @@ -154,7 +154,7 @@ config EXTCON_RT8973A from abnormal high input voltage (up to 28V). config EXTCON_SM5502 - tristate "Silicon Mitus SM5502 EXTCON support" + tristate "Silicon Mitus SM5502/SM5504 EXTCON support" depends on I2C select IRQ_DOMAIN select REGMAP_I2C diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c index 9f40bb9f1f81..9d8f208c68cc 100644 --- a/drivers/extcon/extcon-sm5502.c +++ b/drivers/extcon/extcon-sm5502.c @@ -40,6 +40,7 @@ struct sm5502_muic_info { struct i2c_client *i2c; struct regmap *regmap; + enum sm5502_types type; struct regmap_irq_chip_data *irq_data; struct muic_irq *muic_irqs; unsigned int num_muic_irqs; @@ -90,6 +91,33 @@ static struct reg_data sm5502_reg_data[] = { }, }; +/* Default value of SM5504 register to bring up MUIC device. */ +static struct reg_data sm5504_reg_data[] = { + { + .reg = SM5502_REG_RESET, + .val = SM5502_REG_RESET_MASK, + .invert = true, + }, { + .reg = SM5502_REG_INTMASK1, + .val = SM5504_REG_INTM1_ATTACH_MASK + | SM5504_REG_INTM1_DETACH_MASK, + .invert = false, + }, { + .reg = SM5502_REG_INTMASK2, + .val = SM5504_REG_INTM2_RID_CHG_MASK + | SM5504_REG_INTM2_UVLO_MASK + | SM5504_REG_INTM2_POR_MASK, + .invert = true, + }, { + .reg = SM5502_REG_CONTROL, + .val = SM5502_REG_CONTROL_MANUAL_SW_MASK + | SM5504_REG_CONTROL_CHGTYP_MASK + | SM5504_REG_CONTROL_USBCHDEN_MASK + | SM5504_REG_CONTROL_ADC_EN_MASK, + .invert = true, + }, +}; + /* List of detectable cables */ static const unsigned int sm5502_extcon_cable[] = { EXTCON_USB, @@ -198,6 +226,55 @@ static const struct regmap_irq_chip sm5502_muic_irq_chip = { .num_irqs = ARRAY_SIZE(sm5502_irqs), }; +/* List of supported interrupt for SM5504 */ +static struct muic_irq sm5504_muic_irqs[] = { + { SM5504_IRQ_INT1_ATTACH, "muic-attach" }, + { SM5504_IRQ_INT1_DETACH, "muic-detach" }, + { SM5504_IRQ_INT1_CHG_DET, "muic-chg-det" }, + { SM5504_IRQ_INT1_DCD_OUT, "muic-dcd-out" }, + { SM5504_IRQ_INT1_OVP_EVENT, "muic-ovp-event" }, + { SM5504_IRQ_INT1_CONNECT, "muic-connect" }, + { SM5504_IRQ_INT1_ADC_CHG, "muic-adc-chg" }, + { SM5504_IRQ_INT2_RID_CHG, "muic-rid-chg" }, + { SM5504_IRQ_INT2_UVLO, "muic-uvlo" }, + { SM5504_IRQ_INT2_POR, "muic-por" }, + { SM5504_IRQ_INT2_OVP_FET, "muic-ovp-fet" }, + { SM5504_IRQ_INT2_OCP_LATCH, "muic-ocp-latch" }, + { SM5504_IRQ_INT2_OCP_EVENT, "muic-ocp-event" }, + { SM5504_IRQ_INT2_OVP_OCP_EVENT, "muic-ovp-ocp-event" }, +}; + +/* Define interrupt list of SM5504 to register regmap_irq */ +static const struct regmap_irq sm5504_irqs[] = { + /* INT1 interrupts */ + { .reg_offset = 0, .mask = SM5504_IRQ_INT1_ATTACH_MASK, }, + { .reg_offset = 0, .mask = SM5504_IRQ_INT1_DETACH_MASK, }, + { .reg_offset = 0, .mask = SM5504_IRQ_INT1_CHG_DET_MASK, }, + { .reg_offset = 0, .mask = SM5504_IRQ_INT1_DCD_OUT_MASK, }, + { .reg_offset = 0, .mask = SM5504_IRQ_INT1_OVP_MASK, }, + { .reg_offset = 0, .mask = SM5504_IRQ_INT1_CONNECT_MASK, }, + { .reg_offset = 0, .mask = SM5504_IRQ_INT1_ADC_CHG_MASK, }, + + /* INT2 interrupts */ + { .reg_offset = 1, .mask = SM5504_IRQ_INT2_RID_CHG_MASK,}, + { .reg_offset = 1, .mask = SM5504_IRQ_INT2_UVLO_MASK, }, + { .reg_offset = 1, .mask = SM5504_IRQ_INT2_POR_MASK, }, + { .reg_offset = 1, .mask = SM5504_IRQ_INT2_OVP_FET_MASK, }, + { .reg_offset = 1, .mask = SM5504_IRQ_INT2_OCP_LATCH_MASK, }, + { .reg_offset = 1, .mask = SM5504_IRQ_INT2_OCP_EVENT_MASK, }, + { .reg_offset = 1, .mask = SM5504_IRQ_INT2_OVP_OCP_EVENT_MASK, }, +}; + +static const struct regmap_irq_chip sm5504_muic_irq_chip = { + .name = "sm5504", + .status_base = SM5502_REG_INT1, + .mask_base = SM5502_REG_INTMASK1, + .mask_invert = false, + .num_regs = 2, + .irqs = sm5504_irqs, + .num_irqs = ARRAY_SIZE(sm5504_irqs), +}; + /* Define regmap configuration of SM5502 for I2C communication */ static bool sm5502_muic_volatile_reg(struct device *dev, unsigned int reg) { @@ -276,9 +353,14 @@ static int sm5502_muic_set_path(struct sm5502_muic_info *info, /* Return cable type of attached or detached accessories */ static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info) { - unsigned int cable_type, adc, dev_type1; + unsigned int cable_type, adc, dev_type1, otg_dev_type1; int ret; + if (info->type == TYPE_SM5504) + otg_dev_type1 = SM5504_REG_DEV_TYPE1_USB_OTG_MASK; + else + otg_dev_type1 = SM5502_REG_DEV_TYPE1_USB_OTG_MASK; + /* Read ADC value according to external cable or button */ ret = regmap_read(info->regmap, SM5502_REG_ADC, &adc); if (ret) { @@ -301,11 +383,9 @@ static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info) return ret; } - switch (dev_type1) { - case SM5502_REG_DEV_TYPE1_USB_OTG_MASK: + if (dev_type1 == otg_dev_type1) { cable_type = SM5502_MUIC_ADC_GROUND_USB_OTG; - break; - default: + } else { dev_dbg(info->dev, "cannot identify the cable type: adc(0x%x), dev_type1(0x%x)\n", adc, dev_type1); @@ -358,6 +438,11 @@ static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info) return ret; } + if (dev_type1 == otg_dev_type1) { + cable_type = SM5502_MUIC_ADC_OPEN_USB_OTG; + break; + } + switch (dev_type1) { case SM5502_REG_DEV_TYPE1_USB_SDP_MASK: cable_type = SM5502_MUIC_ADC_OPEN_USB; @@ -365,9 +450,6 @@ static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info) case SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK: cable_type = SM5502_MUIC_ADC_OPEN_TA; break; - case SM5502_REG_DEV_TYPE1_USB_OTG_MASK: - cable_type = SM5502_MUIC_ADC_OPEN_USB_OTG; - break; default: dev_dbg(info->dev, "cannot identify the cable type: adc(0x%x)\n", @@ -497,6 +579,34 @@ static int sm5502_parse_irq(struct sm5502_muic_info *info, int irq_type) return 0; } +static int sm5504_parse_irq(struct sm5502_muic_info *info, int irq_type) +{ + switch (irq_type) { + case SM5504_IRQ_INT1_ATTACH: + info->irq_attach = true; + break; + case SM5504_IRQ_INT1_DETACH: + info->irq_detach = true; + break; + case SM5504_IRQ_INT1_CHG_DET: + case SM5504_IRQ_INT1_DCD_OUT: + case SM5504_IRQ_INT1_OVP_EVENT: + case SM5504_IRQ_INT1_CONNECT: + case SM5504_IRQ_INT1_ADC_CHG: + case SM5504_IRQ_INT2_RID_CHG: + case SM5504_IRQ_INT2_UVLO: + case SM5504_IRQ_INT2_POR: + case SM5504_IRQ_INT2_OVP_FET: + case SM5504_IRQ_INT2_OCP_LATCH: + case SM5504_IRQ_INT2_OCP_EVENT: + case SM5504_IRQ_INT2_OVP_OCP_EVENT: + default: + break; + } + + return 0; +} + static irqreturn_t sm5502_muic_irq_handler(int irq, void *data) { struct sm5502_muic_info *info = data; @@ -506,7 +616,10 @@ static irqreturn_t sm5502_muic_irq_handler(int irq, void *data) if (irq == info->muic_irqs[i].virq) irq_type = info->muic_irqs[i].irq; - ret = sm5502_parse_irq(info, irq_type); + if (info->type == TYPE_SM5504) + ret = sm5504_parse_irq(info, irq_type); + else + ret = sm5502_parse_irq(info, irq_type); if (ret < 0) { dev_warn(info->dev, "cannot handle is interrupt:%d\n", irq_type); @@ -565,6 +678,7 @@ static void sm5502_init_dev_type(struct sm5502_muic_info *info) static int sm5022_muic_i2c_probe(struct i2c_client *i2c) { struct device_node *np = i2c->dev.of_node; + const struct regmap_irq_chip *irq_chip; struct sm5502_muic_info *info; int i, ret, irq_flags; @@ -579,10 +693,26 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c) info->dev = &i2c->dev; info->i2c = i2c; info->irq = i2c->irq; - info->muic_irqs = sm5502_muic_irqs; - info->num_muic_irqs = ARRAY_SIZE(sm5502_muic_irqs); - info->reg_data = sm5502_reg_data; - info->num_reg_data = ARRAY_SIZE(sm5502_reg_data); + info->type = (enum sm5502_types)device_get_match_data(info->dev); + + switch (info->type) { + case TYPE_SM5502: + irq_chip = &sm5502_muic_irq_chip; + info->muic_irqs = sm5502_muic_irqs; + info->num_muic_irqs = ARRAY_SIZE(sm5502_muic_irqs); + info->reg_data = sm5502_reg_data; + info->num_reg_data = ARRAY_SIZE(sm5502_reg_data); + break; + case TYPE_SM5504: + irq_chip = &sm5504_muic_irq_chip; + info->muic_irqs = sm5504_muic_irqs; + info->num_muic_irqs = ARRAY_SIZE(sm5504_muic_irqs); + info->reg_data = sm5504_reg_data; + info->num_reg_data = ARRAY_SIZE(sm5504_reg_data); + break; + default: + return -EINVAL; + } mutex_init(&info->mutex); @@ -598,8 +728,8 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c) /* Support irq domain for SM5502 MUIC device */ irq_flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED; - ret = devm_regmap_add_irq_chip(info->dev, info->regmap, info->irq, irq_flags, - 0, &sm5502_muic_irq_chip, &info->irq_data); + ret = devm_regmap_add_irq_chip(info->dev, info->regmap, info->irq, + irq_flags, 0, irq_chip, &info->irq_data); if (ret != 0) { dev_err(info->dev, "failed to request IRQ %d: %d\n", info->irq, ret); @@ -660,7 +790,8 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c) } static const struct of_device_id sm5502_dt_match[] = { - { .compatible = "siliconmitus,sm5502-muic" }, + { .compatible = "siliconmitus,sm5502-muic", .data = (void *)TYPE_SM5502 }, + { .compatible = "siliconmitus,sm5504-muic", .data = (void *)TYPE_SM5504 }, { }, }; MODULE_DEVICE_TABLE(of, sm5502_dt_match); @@ -692,6 +823,7 @@ static SIMPLE_DEV_PM_OPS(sm5502_muic_pm_ops, static const struct i2c_device_id sm5502_i2c_id[] = { { "sm5502", TYPE_SM5502 }, + { "sm5504", TYPE_SM5504 }, { } }; MODULE_DEVICE_TABLE(i2c, sm5502_i2c_id); diff --git a/drivers/extcon/extcon-sm5502.h b/drivers/extcon/extcon-sm5502.h index ce1f1ec310c4..0ce00274ed86 100644 --- a/drivers/extcon/extcon-sm5502.h +++ b/drivers/extcon/extcon-sm5502.h @@ -10,6 +10,7 @@ enum sm5502_types { TYPE_SM5502, + TYPE_SM5504, }; /* SM5502 registers */ @@ -93,6 +94,13 @@ enum sm5502_reg { #define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT) #define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT) +#define SM5504_REG_CONTROL_CHGTYP_SHIFT 5 +#define SM5504_REG_CONTROL_USBCHDEN_SHIFT 6 +#define SM5504_REG_CONTROL_ADC_EN_SHIFT 7 +#define SM5504_REG_CONTROL_CHGTYP_MASK (0x1 << SM5504_REG_CONTROL_CHGTYP_SHIFT) +#define SM5504_REG_CONTROL_USBCHDEN_MASK (0x1 << SM5504_REG_CONTROL_USBCHDEN_SHIFT) +#define SM5504_REG_CONTROL_ADC_EN_MASK (0x1 << SM5504_REG_CONTROL_ADC_EN_SHIFT) + #define SM5502_REG_INTM1_ATTACH_SHIFT 0 #define SM5502_REG_INTM1_DETACH_SHIFT 1 #define SM5502_REG_INTM1_KP_SHIFT 2 @@ -123,6 +131,36 @@ enum sm5502_reg { #define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT) #define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT) +#define SM5504_REG_INTM1_ATTACH_SHIFT 0 +#define SM5504_REG_INTM1_DETACH_SHIFT 1 +#define SM5504_REG_INTM1_CHG_DET_SHIFT 2 +#define SM5504_REG_INTM1_DCD_OUT_SHIFT 3 +#define SM5504_REG_INTM1_OVP_EVENT_SHIFT 4 +#define SM5504_REG_INTM1_CONNECT_SHIFT 5 +#define SM5504_REG_INTM1_ADC_CHG_SHIFT 6 +#define SM5504_REG_INTM1_ATTACH_MASK (0x1 << SM5504_REG_INTM1_ATTACH_SHIFT) +#define SM5504_REG_INTM1_DETACH_MASK (0x1 << SM5504_REG_INTM1_DETACH_SHIFT) +#define SM5504_REG_INTM1_CHG_DET_MASK (0x1 << SM5504_REG_INTM1_CHG_DET_SHIFT) +#define SM5504_REG_INTM1_DCD_OUT_MASK (0x1 << SM5504_REG_INTM1_DCD_OUT_SHIFT) +#define SM5504_REG_INTM1_OVP_EVENT_MASK (0x1 << SM5504_REG_INTM1_OVP_EVENT_SHIFT) +#define SM5504_REG_INTM1_CONNECT_MASK (0x1 << SM5504_REG_INTM1_CONNECT_SHIFT) +#define SM5504_REG_INTM1_ADC_CHG_MASK (0x1 << SM5504_REG_INTM1_ADC_CHG_SHIFT) + +#define SM5504_REG_INTM2_RID_CHG_SHIFT 0 +#define SM5504_REG_INTM2_UVLO_SHIFT 1 +#define SM5504_REG_INTM2_POR_SHIFT 2 +#define SM5504_REG_INTM2_OVP_FET_SHIFT 4 +#define SM5504_REG_INTM2_OCP_LATCH_SHIFT 5 +#define SM5504_REG_INTM2_OCP_EVENT_SHIFT 6 +#define SM5504_REG_INTM2_OVP_OCP_EVENT_SHIFT 7 +#define SM5504_REG_INTM2_RID_CHG_MASK (0x1 << SM5504_REG_INTM2_RID_CHG_SHIFT) +#define SM5504_REG_INTM2_UVLO_MASK (0x1 << SM5504_REG_INTM2_UVLO_SHIFT) +#define SM5504_REG_INTM2_POR_MASK (0x1 << SM5504_REG_INTM2_POR_SHIFT) +#define SM5504_REG_INTM2_OVP_FET_MASK (0x1 << SM5504_REG_INTM2_OVP_FET_SHIFT) +#define SM5504_REG_INTM2_OCP_LATCH_MASK (0x1 << SM5504_REG_INTM2_OCP_LATCH_SHIFT) +#define SM5504_REG_INTM2_OCP_EVENT_MASK (0x1 << SM5504_REG_INTM2_OCP_EVENT_SHIFT) +#define SM5504_REG_INTM2_OVP_OCP_EVENT_MASK (0x1 << SM5504_REG_INTM2_OVP_OCP_EVENT_SHIFT) + #define SM5502_REG_ADC_SHIFT 0 #define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT) @@ -199,6 +237,9 @@ enum sm5502_reg { #define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT) #define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT) +#define SM5504_REG_DEV_TYPE1_USB_OTG_SHIFT 0 +#define SM5504_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5504_REG_DEV_TYPE1_USB_OTG_SHIFT) + #define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0 #define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1 #define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2 @@ -277,4 +318,42 @@ enum sm5502_irq { #define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4) #define SM5502_IRQ_INT2_MHL_MASK BIT(5) +/* SM5504 Interrupts */ +enum sm5504_irq { + /* INT1 */ + SM5504_IRQ_INT1_ATTACH, + SM5504_IRQ_INT1_DETACH, + SM5504_IRQ_INT1_CHG_DET, + SM5504_IRQ_INT1_DCD_OUT, + SM5504_IRQ_INT1_OVP_EVENT, + SM5504_IRQ_INT1_CONNECT, + SM5504_IRQ_INT1_ADC_CHG, + + /* INT2 */ + SM5504_IRQ_INT2_RID_CHG, + SM5504_IRQ_INT2_UVLO, + SM5504_IRQ_INT2_POR, + SM5504_IRQ_INT2_OVP_FET, + SM5504_IRQ_INT2_OCP_LATCH, + SM5504_IRQ_INT2_OCP_EVENT, + SM5504_IRQ_INT2_OVP_OCP_EVENT, + + SM5504_IRQ_NUM, +}; + +#define SM5504_IRQ_INT1_ATTACH_MASK BIT(0) +#define SM5504_IRQ_INT1_DETACH_MASK BIT(1) +#define SM5504_IRQ_INT1_CHG_DET_MASK BIT(2) +#define SM5504_IRQ_INT1_DCD_OUT_MASK BIT(3) +#define SM5504_IRQ_INT1_OVP_MASK BIT(4) +#define SM5504_IRQ_INT1_CONNECT_MASK BIT(5) +#define SM5504_IRQ_INT1_ADC_CHG_MASK BIT(6) +#define SM5504_IRQ_INT2_RID_CHG_MASK BIT(0) +#define SM5504_IRQ_INT2_UVLO_MASK BIT(1) +#define SM5504_IRQ_INT2_POR_MASK BIT(2) +#define SM5504_IRQ_INT2_OVP_FET_MASK BIT(4) +#define SM5504_IRQ_INT2_OCP_LATCH_MASK BIT(5) +#define SM5504_IRQ_INT2_OCP_EVENT_MASK BIT(6) +#define SM5504_IRQ_INT2_OVP_OCP_EVENT_MASK BIT(7) + #endif /* __LINUX_EXTCON_SM5502_H */