Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1539182rdb; Sat, 3 Feb 2024 10:18:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxkcHxNqlg9J1ilRE2G49oQCxly3C16DrF9eVdt9BHwXjkaTRuOjMG40mixAtoligim75F X-Received: by 2002:a2e:a233:0:b0:2d0:8a78:9e69 with SMTP id i19-20020a2ea233000000b002d08a789e69mr2906719ljm.52.1706984317138; Sat, 03 Feb 2024 10:18:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706984317; cv=pass; d=google.com; s=arc-20160816; b=OhOcXxgx4WMKCrSqRYTphiD0fu5X2sE/i895Yh3GR+h7xX5DAXTnUs6qMJKmnvawAu JZlYJyssjFzO1XYEZkFC72XCBDvLgjE8wJ9c9VHCy2ShpWg//sC1gJ1AYa1YWXELukwk 4guBTp4RJxx3nI1lSTIDBdLo30wRkaLSBSndVhdBVnPfkTt12yrhsTTd0aD/Xcl0ZJ/4 cHKLc+QWnUP0wleULwVblfIKqv/uKxpD2qIVKoWVDhfhSngFJYhPCWXan9dR+rd31hZo DCuT8c0LYZ719g761zuZNsf7q+TlYjo58MIde6DLfPJY/z9bJAVlw4D23DGtx1tw/o2Q WP3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=0ZJxEZ+XtnJ7hS8fEb+n+lvfPENcQvPviS7QG20pZlg=; fh=HSeIfotTV9dkm3GdI8M8RTcacyfhfeFSSbXmsKiNrWA=; b=iLFX49XNy54DxL0TfEHtYhk2+0oOZfRVJrv5wKaNxlJL2m7VTvWEkd1oHFR/TfwJ7J BYUcGA1v1nxp6nI1cRsJylz3Di6G3EShylLjyHgMHp6TVATD3KO3/7i9LJb8DUnycdwr 1YbfLeu0vl0pPbCXEKRAdVzKJ+xlNKssoeqLBZbY1y+Gbq4KdZVclwNivTfbPpfH9Z6Y ghi735IoHg9P8ot0X2/+QevMr1zsCnCuACCz6jpiBjZf1xX3LdCKt8Th/2/KadKMr1bE J0EOvcf1Xep0JY5mXgXgZtRT8qkMfKu+M8lUZgBAHyOid1edbAAWDx4lJKEI/u0F2sXZ peHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=y3ZNKGcF; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-51235-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51235-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz X-Forwarded-Encrypted: i=1; AJvYcCXa4EeJNwFsRTvt1MlTq0LtqM+E1pE+/wWJ5a4cuuk1zpNxnMqKjx9oqYQ0AfxaEkw6yF2hlX0DPfFvUSOEiDk5/UEqshNip1PJvC83xQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t17-20020aa7d4d1000000b00560095315a8si1243068edr.386.2024.02.03.10.18.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 10:18:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51235-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=y3ZNKGcF; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-51235-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51235-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DBE901F233B6 for ; Sat, 3 Feb 2024 18:18:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 282AC5FBB0; Sat, 3 Feb 2024 18:18:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="y3ZNKGcF" Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68CC85FB8D; Sat, 3 Feb 2024 18:18:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.181.215.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706984307; cv=none; b=oIkYgNwWXzhBcjzyMQHu3pX3ZC0z6qOWEKDm+6yfqqthyBQA2ByH/BIxuy6t05WOWjHQn4DlXvy0DWY0M/SknHvXGKIMFKpzy8K9XpFWU0S29njGlh0x/8ST61grZ0WeiabPJUXrioJgrJMngaFFTh5YRHDTklxCoPYlMjgB7y4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706984307; c=relaxed/simple; bh=v18Uq25xFd0lAYlqmeeW1rPPUfvDN/gZuKrB7cBLNgk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J1lXNUUiL4aBXovL0VKGeNnz6qBWk57l8p4euQSWSq4Qlhg4Nu1MyfcVtParGCXDGcZgx9yj1hLL21djHbhjdmW1NDgg/XBrU8yAwuzfAolwFB0LCGIm2n6oQ4oLQWP7sMk6XZVieeNmbWTfL+tQxCE/krPQT+CTjFwTce4bpok= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz; spf=pass smtp.mailfrom=xff.cz; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b=y3ZNKGcF; arc=none smtp.client-ip=195.181.215.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xff.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1706984294; bh=v18Uq25xFd0lAYlqmeeW1rPPUfvDN/gZuKrB7cBLNgk=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=y3ZNKGcFub4QSs9xq0iVNFE7+KJSaXXYyWbxvggkDoGYxo6ADvmOOyh3q97eGngaY 7NqT787d2NhDpOozFjmHwAAiNLLNbVsbNOK/8+dYHxKsKZ8if65gNuI2FO5qbw8JSd 8NRQYdjVNQAUC89HwrkKZJAbGcCaiysmIsGTVWWE= Date: Sat, 3 Feb 2024 19:18:13 +0100 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Pavel Machek Cc: phone-devel@vger.kernel.org, kernel list , fiona.klute@gmx.de, martijn@brixit.nl, samuel@sholland.org, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: typec: anx7688: Add driver for ANX7688 USB-C HDMI bridge Message-ID: Mail-Followup-To: =?utf-8?Q?Ond=C5=99ej?= Jirman , Pavel Machek , phone-devel@vger.kernel.org, kernel list , fiona.klute@gmx.de, martijn@brixit.nl, samuel@sholland.org, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi Pavel, On Thu, Feb 01, 2024 at 11:41:56AM +0100, Pavel Machek wrote: > From: Ondrej Jirman > > This is driver for ANX7688 USB-C HDMI, with flashing and debugging > features removed. ANX7688 is rather criticial piece on PinePhone, > there's no display and no battery charging without it. Don't remove the flashing part. Some Pinephones come without the firmware in the past. Even recently, I've seen some people in the Pine chat asking how to flash the firmware on some old PinePhone. It's a safe operation that can be done at any time and can only be done from the kernel driver. > There's likely more work to be done here, but having basic support > in mainline is needed to be able to work on the other stuff > (networking, cameras, power management). > > Signed-off-by: Ondrej Jirman I should be second in order of sign-offs. Martijn wrote a non-working skeleton https://megous.com/git/linux/commit/?h=pp-5.7&id=30e33cefd7956a2b49fb27008b4af9d868974e58 driver. Then I picked it up and developed it over years to a working thing. Almost none of the skeleton remains. License is GPLv2. > Signed-off-by: Martijn Braam > Signed-off-by: Samuel Holland > Signed-off-by: Pavel Machek > > [...] > > +static int anx7688_i2c_probe(struct i2c_client *client) > +{ > + struct anx7688 *anx7688; > + struct device *dev = &client->dev; > + struct typec_capability typec_cap = { }; > + int i, vid_h, vid_l; > + int irq_cabledet; > + int ret = 0; > + > + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL); > + if (!anx7688) > + return -ENOMEM; > + > + i2c_set_clientdata(client, anx7688); > + anx7688->client = client; > + anx7688->dev = &client->dev; > + mutex_init(&anx7688->lock); > + INIT_DELAYED_WORK(&anx7688->work, anx7688_work); > + anx7688->last_extcon_state = -1; > + > + ret = of_property_read_variable_u32_array(dev->of_node, "source-caps", > + anx7688->src_caps, > + 1, ARRAY_SIZE(anx7688->src_caps)); > + if (ret < 0) { > + dev_err(dev, "failed to get source-caps from DT\n"); > + return ret; > + } > + anx7688->n_src_caps = ret; > + > + ret = of_property_read_variable_u32_array(dev->of_node, "sink-caps", > + anx7688->snk_caps, > + 1, ARRAY_SIZE(anx7688->snk_caps)); > + if (ret < 0) { > + dev_err(dev, "failed to get sink-caps from DT\n"); > + return ret; > + } ^^^ The driver will need to follow usb-c-connector bindings and it will need a bindings documentation for itself. That's one of the missing things that I did not implement, yet. Kind regards, o.