aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-03-28 12:50:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-28 12:50:50 -0700
commitdfdc1de64248b5e1024d8188aeaf0e59ec6cecd5 (patch)
treea1ced75e6a54c6dc0f7e41bbf517012bb0d21af6 /drivers/staging/greybus
parentMerge tag 'driver-core-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core (diff)
parentstaging: r8188eu: remove unnecessary memset in r8188eu (diff)
downloadlinux-dev-dfdc1de64248b5e1024d8188aeaf0e59ec6cecd5.tar.xz
linux-dev-dfdc1de64248b5e1024d8188aeaf0e59ec6cecd5.zip
Merge tag 'staging-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH: "Here is the big set of staging driver updates for 5.18-rc1. Loads of tiny cleanups for almost all staging drivers in here, nothing major at all. Highlights include: - remove the ashmem Android driver. It is long-dead and if there are any legacy userspace applications still using it, the Android kernel images will maintain it, the community shouldn't care about it anymore - wfx wifi driver major cleanups. Should be ready to merge out of staging soon, and will coordinate with the wifi maintainers after -rc1 is out - major cleanups and unwinding of the layers of the r8188eu driver. It's amazing just how many unneeded layers of abstraction is in there, just when we think it's done, another is found... - lots of tiny coding style cleanups in many other staging drivers. All have been in linux-next for a while with no reported problems" * tag 'staging-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (455 commits) staging: r8188eu: remove unnecessary memset in r8188eu staging: greybus: introduce pwm_ops::apply staging: rts5208: Resolve checkpatch.pl issues. staging: sm750fb: fix naming style staging: fbtft: Consider type of init sequence values in fbtft_init_display() staging: fbtft: Constify buf parameter in fbtft_dbg_hex() staging: mmal-vchiq: clear redundant item named bulk_scratch mips: dts: ralink: add MT7621 SoC staging: r8188eu: remove some unused local ieee80211 macros staging: r8188eu: make rtl8188e_process_phy_info static staging: r8188eu: remove unused function prototype staging: r8188eu: remove three unused receive defines staging: r8188eu: remove unnecessary initializations staging: rtl8192e: Fix spelling mistake "RESQUEST" -> "REQUEST" MAINTAINERS: remove the obsolete file entry for staging in ANDROID DRIVERS staging: r8188eu: proper error handling in rtw_init_drv_sw staging: r8188eu: call _cancel_timer_ex from _rtw_free_recv_priv staging: vt6656: Removed unused variable vt3342_vnt_threshold staging: vt6656: Removed unused variable bb_vga_0 staging: remove ashmem ...
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r--drivers/staging/greybus/pwm.c64
-rw-r--r--drivers/staging/greybus/sdio.c1
2 files changed, 40 insertions, 25 deletions
diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c
index 891a6a672378..ad20ec24031e 100644
--- a/drivers/staging/greybus/pwm.c
+++ b/drivers/staging/greybus/pwm.c
@@ -204,43 +204,59 @@ static void gb_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
gb_pwm_deactivate_operation(pwmc, pwm->hwpwm);
}
-static int gb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
- int duty_ns, int period_ns)
+static int gb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
+ const struct pwm_state *state)
{
+ int err;
+ bool enabled = pwm->state.enabled;
+ u64 period = state->period;
+ u64 duty_cycle = state->duty_cycle;
struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip);
- return gb_pwm_config_operation(pwmc, pwm->hwpwm, duty_ns, period_ns);
-};
+ /* Set polarity */
+ if (state->polarity != pwm->state.polarity) {
+ if (enabled) {
+ gb_pwm_disable_operation(pwmc, pwm->hwpwm);
+ enabled = false;
+ }
+ err = gb_pwm_set_polarity_operation(pwmc, pwm->hwpwm, state->polarity);
+ if (err)
+ return err;
+ }
-static int gb_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm,
- enum pwm_polarity polarity)
-{
- struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip);
+ if (!state->enabled) {
+ if (enabled)
+ gb_pwm_disable_operation(pwmc, pwm->hwpwm);
+ return 0;
+ }
- return gb_pwm_set_polarity_operation(pwmc, pwm->hwpwm, polarity);
-};
+ /*
+ * Set period and duty cycle
+ *
+ * PWM privodes 64-bit period and duty_cycle, but greybus only accepts
+ * 32-bit, so their values have to be limited to U32_MAX.
+ */
+ if (period > U32_MAX)
+ period = U32_MAX;
-static int gb_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
-{
- struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip);
+ if (duty_cycle > period)
+ duty_cycle = period;
- return gb_pwm_enable_operation(pwmc, pwm->hwpwm);
-};
+ err = gb_pwm_config_operation(pwmc, pwm->hwpwm, duty_cycle, period);
+ if (err)
+ return err;
-static void gb_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
-{
- struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip);
+ /* enable/disable */
+ if (!enabled)
+ return gb_pwm_enable_operation(pwmc, pwm->hwpwm);
- gb_pwm_disable_operation(pwmc, pwm->hwpwm);
-};
+ return 0;
+}
static const struct pwm_ops gb_pwm_ops = {
.request = gb_pwm_request,
.free = gb_pwm_free,
- .config = gb_pwm_config,
- .set_polarity = gb_pwm_set_polarity,
- .enable = gb_pwm_enable,
- .disable = gb_pwm_disable,
+ .apply = gb_pwm_apply,
.owner = THIS_MODULE,
};
diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c
index 37bf04c22dbc..25bee5335c70 100644
--- a/drivers/staging/greybus/sdio.c
+++ b/drivers/staging/greybus/sdio.c
@@ -858,7 +858,6 @@ static void gb_sdio_remove(struct gbphy_device *gbphy_dev)
gb_connection_set_data(connection, NULL);
mutex_unlock(&host->lock);
- flush_workqueue(host->mrq_workqueue);
destroy_workqueue(host->mrq_workqueue);
gb_connection_disable_rx(connection);
mmc_remove_host(mmc);