Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1774414pxb; Wed, 9 Feb 2022 04:19:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwva+my+LKIM0v/XxbYIrpL7YjXHxotrqgoQCf7G7kndEL76MwOBHK5pJ3AixavC69TQgi0 X-Received: by 2002:a17:90a:ca93:: with SMTP id y19mr3114168pjt.108.1644409170805; Wed, 09 Feb 2022 04:19:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644409170; cv=none; d=google.com; s=arc-20160816; b=N4G7n+DynivCYiIe+f1ukFVv1T2iSqTJkcKm4OgseDWW9wC+buaPmcTzrtQNsQWrPU 2yC9KFOrVX4ua23XFJOSRAJW+ZU5H7L7yy/xfEYACaeVyvc+L3B85LAEsoF3CNwkjHy8 61k1pWsBPbDdpUcpJMsPLTFypOuw3v/uhnqQjfa0uMG0swPWCOteyf3P4TaW/9/lhD78 LQPJmomxy0Hj+omTiqE0JVJ8ivf87ErsoJgYEYcALf+hIRPhtM9oRwHvaqTaui9pi8Fo 1v73VVEEL4BBSXlzZ4iTRHosrDf/dKpEwVxcvu5s8Rh0Jw7Bqpt1+n+qS6m9yDk1V0+y JNmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=s2gKXuCGuMo1+8hjYi2Ki/qC2fMJ6xlt3gzOw+cIe1k=; b=j6jRcQcYMTOihwfDV1kpAeza5ahMnS8FUQuNg7RToMiEBBZ55CtJZUSyQUbmat91Pa I2RQ/gUlLm5s4u3CN3q2Ub0uwbElV6BbxeGzAVHYC4uEaVPSBvDVVYrU+qB7G/n43XKg 6/QIsrJEuq0wm5P9UwMsTrpviVuKemHC5QyTgUTzgH7We7g0c+Yew11O22G2XGgsjDRa fcq80N5hDJGTHK/Gr3pCm13IRahwYR0vP+WNQ3OOgP8r1ZFw/wt3eEZsY4AiXEcyvVb1 LtK9G6mufj70Kf9kKpIIcrKdCizalvLdsYjW5FeKUut8nbm24coPl7CFU/vtZCB0Y8Q8 /L6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l+K8KSmN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b15si15024816pfm.25.2022.02.09.04.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:19:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l+K8KSmN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CE22DE08C28B; Wed, 9 Feb 2022 02:13:57 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358180AbiBHN3B (ORCPT + 99 others); Tue, 8 Feb 2022 08:29:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357622AbiBHN2u (ORCPT ); Tue, 8 Feb 2022 08:28:50 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A92C1DCB1D; Tue, 8 Feb 2022 05:24:38 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id p15so52239072ejc.7; Tue, 08 Feb 2022 05:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s2gKXuCGuMo1+8hjYi2Ki/qC2fMJ6xlt3gzOw+cIe1k=; b=l+K8KSmNlUs9aaqjwJWukCGd0o2XiojzbY0BzX0LACRA/f3KcSxGHCURDQGYEnuVM3 OFrJoBD+5XM1r6tVWDL5noneT2ZPwLbwf44ZN8XTdgyn/hzjCe7KSnCGvTvQDhSPbrzl rXia9JxtXHQT7mu2UfyjBLoCadCA45LusypsUREitl3+7kxlXJqKNjpEejYMV5neWk1x usTl19pxhV4mVUu5E24gmE7P6j3cSiL6HWX6IXmFQgsBBdG+oK+ip0I6JVuTcemGJTwO fapx7fvkyJ765ZHxtX9k9MUDZpFUnJV///sNzE1P+IfJqHl+V8te64YQO55gvqRKdDYt WJ4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s2gKXuCGuMo1+8hjYi2Ki/qC2fMJ6xlt3gzOw+cIe1k=; b=mXS6XEjAxqm40qKh/t2eoWdGXol+v4y+Nr+c2ZkUSmheA1zEs7j0watiroNoABCtpA GFrZW5TZCcd95fppKv4i15E9FH5AsHFsHmPL9jynslOCqVlzC/nIWz8j6H+CiT6+1OVr Jlgv30TmY1ZsAfzWxWBwQFbeXZ3jZJbC6fjpvakfdeJpPa/xRZ9ymxb9CZ8xujrg0sWK TU8eBwBx60jx9Fwx5TARUJFJBFQd5Ai2RNucISgHWGyx7SbH39ku9b7U6z8wnBFlHgPf PicALpGjxE4c/7UoPUexx/8EsZwIKjQ0pgTrWdsAOKja1gQgCCaZv/vP9rIDK58Of0cm ELTw== X-Gm-Message-State: AOAM532kAlOOgGkS10C3sX8yijijE+9O/6NKS0+NxyGdaSB9nw3tVsmd NE6x0CuXu9XvzBTq3fb/P8iWRwFvWaYweDz99ZQ= X-Received: by 2002:a17:906:99c5:: with SMTP id s5mr3800882ejn.497.1644326677005; Tue, 08 Feb 2022 05:24:37 -0800 (PST) MIME-Version: 1.0 References: <20220208031944.3444-1-bjorn.andersson@linaro.org> <20220208031944.3444-7-bjorn.andersson@linaro.org> In-Reply-To: <20220208031944.3444-7-bjorn.andersson@linaro.org> From: Andy Shevchenko Date: Tue, 8 Feb 2022 15:24:00 +0200 Message-ID: Subject: Re: [PATCH v2 6/6] usb: typec: mux: Add On Semi fsa4480 driver To: Bjorn Andersson Cc: Rob Herring , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , "Rafael J. Wysocki" , Hans de Goede , USB , devicetree , Linux Kernel Mailing List , ACPI Devel Maling List , Dmitry Baryshkov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 8, 2022 at 1:26 PM Bjorn Andersson wrote: > > The ON Semiconductor FSA4480 is a USB Type-C port multimedia switch with > support for analog audio headsets. It allows sharing a common USB Type-C > port to pass USB2.0 signal, analog audio, sideband use wires and analog > microphone signal. > > Due to lacking upstream audio support for testing, the audio muxing is > left untouched, but implementation of muxing the SBU lines is provided > as a pair of TypeC mux and switch devices. This provides the necessary > support for enabling the DisplayPort altmode on devices with this > circuit. ... > +config TYPEC_MUX_FSA4480 > + tristate "ON Semi FSA4480 Analog Audio Switch driver" > + depends on I2C > + select REGMAP_I2C > + help > + Driver for the ON Semiconductor FSA4480 Analog Audio Switch, which > + provides support for muxing analog audio and sideband signals on a > + common USB Type-C connector. What would be the module name? ... > +/* > + * Copyright (C) 2021 Linaro Ltd. 2021-2022 ? > + * Copyright (C) 2018-2020 The Linux Foundation > + */ ... Missed mod_devicetable.h ? ... > +#define FSA4480_ENABLE_DEVICE BIT(7) > +#define FSA4480_ENABLE_SBU GENMASK(6, 5) > +#define FSA4480_ENABLE_USB GENMASK(4, 3) Don't forget to include bits.h ... > + /* used to serialize concurrect change requests */ concurrent ... > +static const struct regmap_config fsa4480_regmap_config = { > + .reg_bits = 8, > + .val_bits = 8, > + .max_register = FSA4480_RESET, I would create a specific macro, to avoid confusion in case if there will be more hw revisions with slightly different register layouts. > +}; ... > + fsa->regmap = devm_regmap_init_i2c(client, &fsa4480_regmap_config); > + if (IS_ERR(fsa->regmap)) { > + dev_err(dev, "failed to initialize regmap\n"); > + return PTR_ERR(fsa->regmap); return dev_err_probe(); > + } ... > + fsa->sw = typec_switch_register(dev, &sw_desc); > + if (IS_ERR(fsa->sw)) { > + dev_err(dev, "failed to register typec switch: %ld\n", PTR_ERR(fsa->sw)); > + return PTR_ERR(fsa->sw); Ditto. > + } ... > + mux_desc.fwnode = dev->fwnode; Please, avoid dereferencing fwnode, use dev_fwnode() instead. ... > + fsa->mux = typec_mux_register(dev, &mux_desc); > + if (IS_ERR(fsa->mux)) { > + typec_switch_unregister(fsa->sw); > + dev_err(dev, "failed to register typec mux: %ld\n", PTR_ERR(fsa->mux)); > + return PTR_ERR(fsa->mux); return dev_err_probe(); > + } ... > +static struct i2c_driver fsa4480_driver = { > + .driver = { > + .name = "fsa4480", > + .of_match_table = fsa4480_of_table, > + }, > + .probe_new = fsa4480_probe, > + .remove = fsa4480_remove, > + .id_table = fsa4480_table, > +}; > + Redundant blank line. > +module_i2c_driver(fsa4480_driver); -- With Best Regards, Andy Shevchenko