From: James Ogletree <James.Ogletree@cirrus.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Fred Treven <Fred.Treven@cirrus.com>,
Ben Bright <Ben.Bright@cirrus.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>, Lee Jones <lee@kernel.org>,
Peng Fan <peng.fan@nxp.com>, Jean Delvare <jdelvare@suse.de>,
Jeff LaBundy <jeff@labundy.com>,
Randy Dunlap <rdunlap@infradead.org>,
Arnd Bergmann <arnd@arndb.de>,
Eddie James <eajames@linux.ibm.com>, Jacky Bai <ping.bai@nxp.com>,
Markus Schneider-Pargmann <msp@baylibre.com>,
ChiYuan Huang <cy_huang@richtek.com>,
Jerome Neanne <jneanne@baylibre.com>,
"patches@cirrus.com" <patches@cirrus.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] Input: cs40l50 - Initial support for Cirrus Logic CS40L50
Date: Wed, 9 Aug 2023 18:02:21 +0000 [thread overview]
Message-ID: <ADCCD2C5-B79B-4C50-B3CE-007B1FBF5A5E@cirrus.com> (raw)
In-Reply-To: <065fbe51-928c-4728-efc2-bde87cd48cb3@linaro.org>
> On Aug 9, 2023, at 1:47 AM, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
>
> On 08/08/2023 19:25, James Ogletree wrote:
>
>> + goto err;
>> + }
>> +
>> + cs40l50->reset_gpio = devm_gpiod_get_optional(cs40l50->dev, "reset", GPIOD_OUT_HIGH);
>> + if (IS_ERR(cs40l50->reset_gpio)) {
>> + error = PTR_ERR(cs40l50->reset_gpio);
>> + goto err;
>> + }
>> +
>> + usleep_range(CS40L50_MIN_RESET_PULSE_WIDTH_US, CS40L50_MIN_RESET_PULSE_WIDTH_US + 100);
>> +
>> + gpiod_set_value_cansleep(cs40l50->reset_gpio, 0);
>> +
>> + usleep_range(CS40L50_CP_READY_DELAY_US, CS40L50_CP_READY_DELAY_US + 1000);
>> +
>> + for (i = 0; i < CS40L50_DSP_TIMEOUT_COUNT; i++) {
>> + error = cs40l50_dsp_read(cs40l50, CS40L50_DSP1_HALO_STATE, &val);
>> + if (!error && val < 0xFFFF && val >= CS40L50_HALO_STATE_BOOT_DONE)
>> + break;
>> +
>> + usleep_range(CS40L50_DSP_POLL_US, CS40L50_DSP_POLL_US + 100);
>> + }
>> +
>> + if (i == CS40L50_DSP_TIMEOUT_COUNT) {
>> + dev_err(cs40l50->dev, "Firmware boot failed: %d, halo state = %#x\n", error, val);
>> + goto err;
>> + }
>> +
>> + cs40l50->vibe_workqueue = alloc_ordered_workqueue("cs40l50_workqueue", WQ_HIGHPRI);
>> + if (!cs40l50->vibe_workqueue) {
>> + error = -ENOMEM;
>> + goto err;
>> + }
>> +
>> + INIT_WORK(&cs40l50->vibe_start_work, cs40l50_vibe_start_worker);
>> + INIT_WORK(&cs40l50->vibe_stop_work, cs40l50_vibe_stop_worker);
>> +
>> + error = cs40l50_cs_dsp_init(cs40l50);
>> + if (error)
>> + goto err;
>> +
>> + error = cs40l50_input_init(cs40l50);
>> + if (error)
>> + goto err;
>> +
>> + error = cs40l50_patch_firmware(cs40l50);
>> + if (error)
>> + goto err;
>> +
>> + error = cs40l50_pseq_init(cs40l50);
>> + if (error)
>> + goto err;
>> +
>> + error = cs40l50_config_bst(cs40l50);
>> + if (error)
>> + goto err;
>> +
>> + error = devm_regmap_add_irq_chip(cs40l50->dev, cs40l50->regmap, cs40l50->irq,
>> + IRQF_ONESHOT | IRQF_SHARED | IRQF_TRIGGER_LOW, 0, &cs40l50_regmap_irq_chip,
>> + &cs40l50->irq_data);
>> + if (error) {
>> + dev_err(cs40l50->dev, "Failed to register IRQ chip: %d\n", error);
>> + goto err;
>> + }
>> +
>> + for (i = 0; i < ARRAY_SIZE(cs40l50_irqs); i++) {
>> + irq = regmap_irq_get_virq(cs40l50->irq_data, cs40l50_irqs[i].irq);
>> + if (irq < 0) {
>> + dev_err(cs40l50->dev, "Failed to get %s\n", cs40l50_irqs[i].name);
>> + error = irq;
>> + goto err;
>> + }
>> +
>> + error = devm_request_threaded_irq(cs40l50->dev, irq, NULL, cs40l50_irqs[i].handler,
>> + IRQF_ONESHOT | IRQF_SHARED | IRQF_TRIGGER_LOW,
>> + cs40l50_irqs[i].name, cs40l50);
>> + if (error) {
>> + dev_err(cs40l50->dev, "Failed to request IRQ %s: %d\n",
>> + cs40l50_irqs[i].name, error);
>> + goto err;
>> + }
>> + }
>> +
>> + return 0;
>> +
>> +err:
>> + cs40l50_remove(cs40l50);
>> +
>> + return error;
>> +}
>> +EXPORT_SYMBOL_GPL(cs40l50_probe);
>> +
>> +int cs40l50_remove(struct cs40l50_private *cs40l50)
>> +{
>> + disable_irq(cs40l50->irq);
>> +
>> + if (cs40l50->dsp.booted)
>> + cs_dsp_power_down(&cs40l50->dsp);
>> + if (&cs40l50->dsp)
>> + cs_dsp_remove(&cs40l50->dsp);
>> +
>> + if (cs40l50->vibe_workqueue) {
>> + flush_workqueue(cs40l50->vibe_workqueue);
>> + destroy_workqueue(cs40l50->vibe_workqueue);
>> + }
>> +
>> + gpiod_set_value_cansleep(cs40l50->reset_gpio, 1);
>> + regulator_bulk_disable(ARRAY_SIZE(cs40l50_supplies), cs40l50_supplies);
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(cs40l50_remove);
>> +
>> +MODULE_DESCRIPTION("CS40L50 Advanced Haptic Driver");
>> +MODULE_AUTHOR("James Ogletree, Cirrus Logic Inc. <james.ogletree@cirrus.com>");
>> +MODULE_LICENSE("GPL");
>
> I don't think this is a module.
It can be compiled as a module with CONFIG_INPUT_CS40L50=m. However, there is a
typo in the Kconfig entry description: the module will be called “cs40l50” not “cs40l50-core”.
That will be fixed.
Best,
James
next prev parent reply other threads:[~2023-08-09 18:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 17:25 [PATCH 1/2] dt-bindings: input: cirrus,cs40l50: Support for CS40L50 James Ogletree
2023-08-08 17:25 ` [PATCH 2/2] Input: cs40l50 - Initial support for Cirrus Logic CS40L50 James Ogletree
2023-08-09 6:47 ` Krzysztof Kozlowski
2023-08-09 18:02 ` James Ogletree [this message]
2023-08-10 6:12 ` Krzysztof Kozlowski
2023-08-14 21:44 ` James Ogletree
2023-08-15 5:08 ` Krzysztof Kozlowski
2023-08-09 6:43 ` [PATCH 1/2] dt-bindings: input: cirrus,cs40l50: Support for CS40L50 Krzysztof Kozlowski
2023-08-09 16:41 ` James Ogletree
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=ADCCD2C5-B79B-4C50-B3CE-007B1FBF5A5E@cirrus.com \
--to=james.ogletree@cirrus.com \
--cc=Ben.Bright@cirrus.com \
--cc=Fred.Treven@cirrus.com \
--cc=arnd@arndb.de \
--cc=conor+dt@kernel.org \
--cc=cy_huang@richtek.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=eajames@linux.ibm.com \
--cc=jdelvare@suse.de \
--cc=jeff@labundy.com \
--cc=jneanne@baylibre.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=msp@baylibre.com \
--cc=patches@cirrus.com \
--cc=peng.fan@nxp.com \
--cc=ping.bai@nxp.com \
--cc=rdunlap@infradead.org \
--cc=robh+dt@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
all inboxes | Powered by JetHome®