Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf4800b5 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: qcom-hv-haptics: switch API to trigger PBS for ISC configuration"

parents 67a89051 20a19395
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -3600,7 +3600,6 @@ static int haptics_init_swr_slave_regulator(struct haptics_chip *chip)
	return rc;
}

#define PBS_SW_TRG_LRA_ISC_CFG_BIT	BIT(7)
static int haptics_pbs_trigger_isc_config(struct haptics_chip *chip)
{
	int rc;
@@ -3610,7 +3609,7 @@ static int haptics_pbs_trigger_isc_config(struct haptics_chip *chip)
		return -ENODEV;
	}

	rc = qpnp_pbs_trigger_event(chip->pbs_node, PBS_SW_TRG_LRA_ISC_CFG_BIT);
	rc = qpnp_pbs_trigger_single_event(chip->pbs_node);
	if (rc < 0)
		dev_err(chip->dev, "Trigger PBS to config ISC failed, rc=%d\n",
				rc);
+40 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2018, 2020, The Linux Foundation. All rights reserved.
 */

#define pr_fmt(fmt)	"PBS: %s: " fmt, __func__
@@ -145,6 +145,45 @@ static int qpnp_pbs_wait_for_ack(struct qpnp_pbs *pbs, u8 bit_pos)
	return 0;
}

/**
 * qpnp_pbs_trigger_single_event - trigger PBS sequence which is connected
 * directly to SW_TRIGGER bit without using bitmap.
 *
 * Returns = 0 enable SW_TRIGGER in PBS client successfully.
 *
 * Returns < 0 for errors.
 *
 * This function is used to trigger the PBS that is hooked on the
 * SW_TRIGGER directly in PBS client.
 */
int qpnp_pbs_trigger_single_event(struct device_node *dev_node)
{
	struct qpnp_pbs *pbs_dev;
	int rc;

	if (!dev_node)
		return -EINVAL;

	pbs_dev = get_pbs_client_node(dev_node);
	if (IS_ERR(pbs_dev)) {
		rc = PTR_ERR(pbs_dev);
		pr_err("Unable to find the PBS dev_node, rc=%d\n", rc);
		return rc;
	}

	mutex_lock(&pbs_dev->pbs_lock);
	rc = qpnp_pbs_masked_write(pbs_dev, pbs_dev->base +
				PBS_CLIENT_TRIG_CTL, PBS_CLIENT_SW_TRIG_BIT,
				PBS_CLIENT_SW_TRIG_BIT);
	if (rc < 0)
		pr_err("Failed to write register %x rc=%d\n",
				PBS_CLIENT_TRIG_CTL, rc);
	mutex_unlock(&pbs_dev->pbs_lock);

	return rc;
}
EXPORT_SYMBOL(qpnp_pbs_trigger_single_event);

/**
 * qpnp_pbs_trigger_event - Trigger the PBS RAM sequence
 *
+10 −1
Original line number Diff line number Diff line
@@ -13,11 +13,20 @@ struct device_node;

#if IS_ENABLED(CONFIG_QPNP_PBS)
int qpnp_pbs_trigger_event(struct device_node *dev_node, u8 bitmap);
int qpnp_pbs_trigger_single_event(struct device_node *dev_node);
#else
static inline int qpnp_pbs_trigger_event(struct device_node *dev_node,
						 u8 bitmap) {
						 u8 bitmap)
{
	return -ENODEV;
}

static inline int qpnp_pbs_trigger_single_event(
					struct device_node *dev_node)
{
	return -ENODEV;
}

#endif

#endif