Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
77 lines
1.6 KiB
C
77 lines
1.6 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Link Layer for Samsung S3FWRN5 NCI based Driver
|
|
*
|
|
* Copyright (C) 2015 Samsung Electronics
|
|
* Robert Baldyga <r.baldyga@samsung.com>
|
|
* Copyright (C) 2020 Samsung Electronics
|
|
* Bongsu Jeon <bongsu.jeon@samsung.com>
|
|
*/
|
|
|
|
#include <linux/gpio.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/module.h>
|
|
|
|
#include "phy_common.h"
|
|
|
|
void s3fwrn5_phy_set_wake(void *phy_id, bool wake)
|
|
{
|
|
struct phy_common *phy = phy_id;
|
|
|
|
mutex_lock(&phy->mutex);
|
|
gpio_set_value(phy->gpio_fw_wake, wake);
|
|
if (wake)
|
|
msleep(S3FWRN5_EN_WAIT_TIME);
|
|
mutex_unlock(&phy->mutex);
|
|
}
|
|
EXPORT_SYMBOL(s3fwrn5_phy_set_wake);
|
|
|
|
bool s3fwrn5_phy_power_ctrl(struct phy_common *phy, enum s3fwrn5_mode mode)
|
|
{
|
|
if (phy->mode == mode)
|
|
return false;
|
|
|
|
phy->mode = mode;
|
|
|
|
gpio_set_value(phy->gpio_en, 1);
|
|
gpio_set_value(phy->gpio_fw_wake, 0);
|
|
if (mode == S3FWRN5_MODE_FW)
|
|
gpio_set_value(phy->gpio_fw_wake, 1);
|
|
|
|
if (mode != S3FWRN5_MODE_COLD) {
|
|
msleep(S3FWRN5_EN_WAIT_TIME);
|
|
gpio_set_value(phy->gpio_en, 0);
|
|
msleep(S3FWRN5_EN_WAIT_TIME);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
EXPORT_SYMBOL(s3fwrn5_phy_power_ctrl);
|
|
|
|
void s3fwrn5_phy_set_mode(void *phy_id, enum s3fwrn5_mode mode)
|
|
{
|
|
struct phy_common *phy = phy_id;
|
|
|
|
mutex_lock(&phy->mutex);
|
|
|
|
s3fwrn5_phy_power_ctrl(phy, mode);
|
|
|
|
mutex_unlock(&phy->mutex);
|
|
}
|
|
EXPORT_SYMBOL(s3fwrn5_phy_set_mode);
|
|
|
|
enum s3fwrn5_mode s3fwrn5_phy_get_mode(void *phy_id)
|
|
{
|
|
struct phy_common *phy = phy_id;
|
|
enum s3fwrn5_mode mode;
|
|
|
|
mutex_lock(&phy->mutex);
|
|
|
|
mode = phy->mode;
|
|
|
|
mutex_unlock(&phy->mutex);
|
|
|
|
return mode;
|
|
}
|
|
EXPORT_SYMBOL(s3fwrn5_phy_get_mode);
|