mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mfd: lm3533-core: Remove redundant pdata helpers
The lm3533_set_boost_freq() and lm3533_set_boost_ovp() functions are used only in lm3533_device_setup(), which in turn is only called by lm3533_device_init(). Incorporate their code directly into lm3533_device_init() to simplify driver readability. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Link: https://patch.msgid.link/20260731113632.158440-7-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
948c42932e
commit
cdc9de135b
|
|
@ -7,6 +7,7 @@
|
|||
* Author: Johan Hovold <jhovold@gmail.com>
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -23,10 +24,7 @@
|
|||
|
||||
|
||||
#define LM3533_BOOST_OVP_MASK 0x06
|
||||
#define LM3533_BOOST_OVP_SHIFT 1
|
||||
|
||||
#define LM3533_BOOST_FREQ_MASK 0x01
|
||||
#define LM3533_BOOST_FREQ_SHIFT 0
|
||||
|
||||
#define LM3533_BL_ID_MASK 1
|
||||
#define LM3533_LED_ID_MASK 3
|
||||
|
|
@ -80,35 +78,6 @@ static struct mfd_cell lm3533_led_devs[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static int lm3533_set_boost_freq(struct lm3533 *lm3533,
|
||||
enum lm3533_boost_freq freq)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = regmap_update_bits(lm3533->regmap, LM3533_REG_BOOST_PWM,
|
||||
LM3533_BOOST_FREQ_MASK,
|
||||
freq << LM3533_BOOST_FREQ_SHIFT);
|
||||
if (ret)
|
||||
dev_err(lm3533->dev, "failed to set boost frequency\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int lm3533_set_boost_ovp(struct lm3533 *lm3533,
|
||||
enum lm3533_boost_ovp ovp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = regmap_update_bits(lm3533->regmap, LM3533_REG_BOOST_PWM,
|
||||
LM3533_BOOST_OVP_MASK,
|
||||
ovp << LM3533_BOOST_OVP_SHIFT);
|
||||
if (ret)
|
||||
dev_err(lm3533->dev, "failed to set boost ovp\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* HVLED output config -- output hvled controlled by backlight bl
|
||||
*/
|
||||
|
|
@ -406,18 +375,6 @@ static int lm3533_device_led_init(struct lm3533 *lm3533)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lm3533_device_setup(struct lm3533 *lm3533,
|
||||
struct lm3533_platform_data *pdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = lm3533_set_boost_freq(lm3533, pdata->boost_freq);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return lm3533_set_boost_ovp(lm3533, pdata->boost_ovp);
|
||||
}
|
||||
|
||||
static int lm3533_device_init(struct lm3533 *lm3533)
|
||||
{
|
||||
struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
|
||||
|
|
@ -437,9 +394,21 @@ static int lm3533_device_init(struct lm3533 *lm3533)
|
|||
|
||||
lm3533_enable(lm3533);
|
||||
|
||||
ret = lm3533_device_setup(lm3533, pdata);
|
||||
if (ret)
|
||||
ret = regmap_update_bits(lm3533->regmap, LM3533_REG_BOOST_PWM,
|
||||
LM3533_BOOST_FREQ_MASK,
|
||||
FIELD_PREP(LM3533_BOOST_FREQ_MASK, pdata->boost_freq));
|
||||
if (ret) {
|
||||
dev_err(lm3533->dev, "failed to set boost frequency\n");
|
||||
goto err_disable;
|
||||
}
|
||||
|
||||
ret = regmap_update_bits(lm3533->regmap, LM3533_REG_BOOST_PWM,
|
||||
LM3533_BOOST_OVP_MASK,
|
||||
FIELD_PREP(LM3533_BOOST_OVP_MASK, pdata->boost_ovp));
|
||||
if (ret) {
|
||||
dev_err(lm3533->dev, "failed to set boost ovp\n");
|
||||
goto err_disable;
|
||||
}
|
||||
|
||||
lm3533_device_als_init(lm3533);
|
||||
lm3533_device_bl_init(lm3533);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user