phone-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ondřej Jirman" <megi@xff.cz>
To: Pavel Machek <pavel@ucw.cz>
Cc: phone-devel@vger.kernel.org,
	 kernel list <linux-kernel@vger.kernel.org>,
	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
Date: Sat, 3 Feb 2024 19:18:13 +0100	[thread overview]
Message-ID: <iikhv7e2z3pk7nr6bvtuepwyrmukym5fjtc2xspsmhxzz5jlwe@5vfs4i3w66kc> (raw)
In-Reply-To: <Zbt1dIByBZ2stzjm@mobian>

Hi Pavel,

On Thu, Feb 01, 2024 at 11:41:56AM +0100, Pavel Machek wrote:
> From: Ondrej Jirman <megi@xff.cz>
> 
> 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 <megi@xff.cz>

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 <martijn@brixit.nl>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
> 
> [...]
>
> +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.

  parent reply	other threads:[~2024-02-03 18:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 10:41 [PATCH] usb: typec: anx7688: Add driver for ANX7688 USB-C HDMI bridge Pavel Machek
2024-02-01 14:59 ` Greg KH
2024-02-02 18:09   ` Pavel Machek
2024-02-01 15:00 ` Greg KH
2024-02-03 18:18 ` Ondřej Jirman [this message]
2024-02-09 19:44   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iikhv7e2z3pk7nr6bvtuepwyrmukym5fjtc2xspsmhxzz5jlwe@5vfs4i3w66kc \
    --to=megi@xff.cz \
    --cc=fiona.klute@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=martijn@brixit.nl \
    --cc=pavel@ucw.cz \
    --cc=phone-devel@vger.kernel.org \
    --cc=samuel@sholland.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).