From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 01/12] usb: typec: ucsi: add PMIC Glink UCSI driver
Date: Mon, 13 Mar 2023 11:43:26 +0200 [thread overview]
Message-ID: <ZA7wPtttsWlQRpAR@kuha.fi.intel.com> (raw)
In-Reply-To: <20230130-topic-sm8450-upstream-pmic-glink-v3-1-4c860d265d28@linaro.org>
Hi,
On Thu, Mar 09, 2023 at 02:27:52PM +0100, Neil Armstrong wrote:
> +static void pmic_glink_ucsi_register(struct work_struct *work)
> +{
> + struct pmic_glink_ucsi *ucsi = container_of(work, struct pmic_glink_ucsi, register_work);
> +
> + ucsi_register(ucsi->ucsi);
> +}
> +
> +static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv)
> +{
> + struct pmic_glink_ucsi *ucsi = priv;
> + const struct pmic_glink_hdr *hdr = data;
> +
> + switch (hdr->opcode) {
> + case UC_UCSI_READ_BUF_REQ:
> + pmic_glink_ucsi_read_ack(ucsi, data, len);
> + break;
> + case UC_UCSI_WRITE_BUF_REQ:
> + pmic_glink_ucsi_write_ack(ucsi, data, len);
> + break;
> + case UC_UCSI_USBC_NOTIFY_IND:
> + schedule_work(&ucsi->notify_work);
> + break;
> + };
> +}
> +
> +static void pmic_glink_ucsi_pdr_notify(void *priv, int state)
> +{
> + struct pmic_glink_ucsi *ucsi = priv;
> +
> + if (state == SERVREG_SERVICE_STATE_UP)
> + schedule_work(&ucsi->register_work);
> + else if (state == SERVREG_SERVICE_STATE_DOWN)
> + ucsi_unregister(ucsi->ucsi);
> +}
> +
> +static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
> + const struct auxiliary_device_id *id)
> +{
> + struct pmic_glink_ucsi *ucsi;
> + struct device *dev = &adev->dev;
> +
> + ucsi = devm_kzalloc(dev, sizeof(*ucsi), GFP_KERNEL);
> + if (!ucsi)
> + return -ENOMEM;
> +
> + ucsi->dev = dev;
> + dev_set_drvdata(dev, ucsi);
> +
> + INIT_WORK(&ucsi->notify_work, pmic_glink_ucsi_notify);
> + INIT_WORK(&ucsi->register_work, pmic_glink_ucsi_register);
> + init_completion(&ucsi->read_ack);
> + init_completion(&ucsi->write_ack);
> + init_completion(&ucsi->sync_ack);
> + mutex_init(&ucsi->lock);
> +
> + ucsi->ucsi = ucsi_create(dev, &pmic_glink_ucsi_ops);
> + if (IS_ERR(ucsi->ucsi))
> + return PTR_ERR(ucsi->ucsi);
> +
> + ucsi_set_drvdata(ucsi->ucsi, ucsi);
> +
> + ucsi->client = devm_pmic_glink_register_client(dev,
> + PMIC_GLINK_OWNER_USBC,
> + pmic_glink_ucsi_callback,
> + pmic_glink_ucsi_pdr_notify,
> + ucsi);
> + return PTR_ERR_OR_ZERO(ucsi->client);
> +}
> +
> +static const struct auxiliary_device_id pmic_glink_ucsi_id_table[] = {
> + { .name = "pmic_glink.ucsi", },
> + {},
> +};
> +MODULE_DEVICE_TABLE(auxiliary, pmic_glink_ucsi_id_table);
> +
> +static struct auxiliary_driver pmic_glink_ucsi_driver = {
> + .name = "pmic_glink_ucsi",
> + .probe = pmic_glink_ucsi_probe,
> + .id_table = pmic_glink_ucsi_id_table,
> +};
What happens if you remove the module - I think you need to implement
the remove callback, no?
thanks,
--
heikki
next prev parent reply other threads:[~2023-03-13 9:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 13:27 [PATCH v3 00/12] soc: qcom: add UCSI function to PMIC GLINK Neil Armstrong
2023-03-09 13:27 ` [PATCH v3 01/12] usb: typec: ucsi: add PMIC Glink UCSI driver Neil Armstrong
2023-03-13 9:43 ` Heikki Krogerus [this message]
2023-03-14 8:54 ` Neil Armstrong
2023-03-09 13:27 ` [PATCH v3 02/12] dt-bindings: soc: qcom: qcom,pmic-glink: document SM8450 compatible Neil Armstrong
2023-03-09 13:27 ` [PATCH v3 03/12] dt-bindings: soc: qcom: qcom,pmic-glink: document SM8550 compatible Neil Armstrong
2023-03-09 13:27 ` [PATCH v3 04/12] soc: qcom: pmic_glink: register ucsi aux device Neil Armstrong
2023-03-10 20:56 ` Dmitry Baryshkov
2023-03-09 13:27 ` [PATCH v3 05/12] dt-bindings: usb: snps,dwc3: document HS & SS OF graph ports Neil Armstrong
2023-03-16 23:03 ` Rob Herring
2023-03-09 13:27 ` [PATCH v3 06/12] arm64: dts: qcom: sm8350: add port subnodes in dwc3 node Neil Armstrong
2023-03-09 13:27 ` [PATCH v3 07/12] arm64: dts: qcom: sm8450: " Neil Armstrong
2023-03-09 13:27 ` [PATCH v3 08/12] arm64: dts: qcom: sm8550: " Neil Armstrong
2023-03-09 13:28 ` [PATCH v3 09/12] arm64: dts: qcom: sm8350-hdk: add pmic glink node Neil Armstrong
2023-03-09 13:28 ` [PATCH v3 10/12] arm64: dts: qcom: sm8450-hdk: " Neil Armstrong
2023-03-09 13:28 ` [PATCH v3 11/12] arm64: dts: qcom: sm8550-mtp: " Neil Armstrong
2023-03-09 13:28 ` [PATCH v3 12/12] arm64: defconfig: add PMIC GLINK modules Neil Armstrong
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=ZA7wPtttsWlQRpAR@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=robh+dt@kernel.org \
--cc=will@kernel.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