Commit 02a9bd4f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Greg Kroah-Hartman

staging: mfd: hi6421-spmi-pmic: deal with non-static functions

Several functions aren't used outside the mfd driver. So,
either remove or make them static.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/d26323ab7be5b4efb73b1950b4daaa5959277449.1597647359.git.mchehab+huawei@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 489b1a36
...@@ -73,21 +73,21 @@ u32 hisi_pmic_read(struct hisi_pmic *pmic, int reg) ...@@ -73,21 +73,21 @@ u32 hisi_pmic_read(struct hisi_pmic *pmic, int reg)
u8 read_value = 0; u8 read_value = 0;
struct spmi_device *pdev; struct spmi_device *pdev;
if (NULL == g_pmic) { if (!g_pmic) {
pr_err(" g_pmic is NULL\n"); pr_err("%s: g_pmic is NULL\n", __func__);
return 0; return 0;
} }
pdev = to_spmi_device(g_pmic->dev); pdev = to_spmi_device(g_pmic->dev);
if (NULL == pdev) { if (!pdev) {
pr_err("%s:pdev get failed!\n", __func__); pr_err("%s: pdev get failed!\n", __func__);
return 0; return 0;
} }
ret = spmi_ext_register_readl(pdev, reg, (unsigned char*)&read_value, 1);/*lint !e734 !e732 */ ret = spmi_ext_register_readl(pdev, reg, (unsigned char*)&read_value, 1);/*lint !e734 !e732 */
if (ret) { if (ret) {
pr_err("%s:spmi_ext_register_readl failed!\n", __func__); pr_err("%s: spmi_ext_register_readl failed!\n", __func__);
return ret; return 0;
} }
return (u32)read_value; return (u32)read_value;
} }
...@@ -98,34 +98,32 @@ void hisi_pmic_write(struct hisi_pmic *pmic, int reg, u32 val) ...@@ -98,34 +98,32 @@ void hisi_pmic_write(struct hisi_pmic *pmic, int reg, u32 val)
u32 ret; u32 ret;
struct spmi_device *pdev; struct spmi_device *pdev;
if (NULL == g_pmic) { if (!g_pmic) {
pr_err(" g_pmic is NULL\n"); pr_err("%s: g_pmic is NULL\n", __func__);
return; return;
} }
pdev = to_spmi_device(g_pmic->dev); pdev = to_spmi_device(g_pmic->dev);
if (NULL == pdev) { if (!pdev) {
pr_err("%s:pdev get failed!\n", __func__); pr_err("%s: pdev get failed!\n", __func__);
return; return;
} }
ret = spmi_ext_register_writel(pdev, reg, (unsigned char*)&val, 1);/*lint !e734 !e732 */ ret = spmi_ext_register_writel(pdev, reg, (unsigned char*)&val, 1);/*lint !e734 !e732 */
if (ret) { if (ret) {
pr_err("%s:spmi_ext_register_writel failed!\n", __func__); pr_err("%s: spmi_ext_register_writel failed!\n", __func__);
return ; return;
} }
} }
EXPORT_SYMBOL(hisi_pmic_write); EXPORT_SYMBOL(hisi_pmic_write);
void hisi_pmic_rmw(struct hisi_pmic *pmic, int reg, u32 mask, u32 bits)
void hisi_pmic_rmw(struct hisi_pmic *pmic, int reg,
u32 mask, u32 bits)
{ {
u32 data; u32 data;
unsigned long flags; unsigned long flags;
if (NULL == g_pmic) { if (!g_pmic) {
pr_err(" g_pmic is NULL\n"); pr_err("%s: g_pmic is NULL\n", __func__);
return; return;
} }
...@@ -137,75 +135,6 @@ void hisi_pmic_rmw(struct hisi_pmic *pmic, int reg, ...@@ -137,75 +135,6 @@ void hisi_pmic_rmw(struct hisi_pmic *pmic, int reg,
} }
EXPORT_SYMBOL(hisi_pmic_rmw); EXPORT_SYMBOL(hisi_pmic_rmw);
unsigned int hisi_pmic_reg_read(int addr)
{
return (unsigned int)hisi_pmic_read(g_pmic, addr);
}
EXPORT_SYMBOL(hisi_pmic_reg_read);
void hisi_pmic_reg_write(int addr, int val)
{
hisi_pmic_write(g_pmic, addr, val);
}
EXPORT_SYMBOL(hisi_pmic_reg_write);
void hisi_pmic_reg_write_lock(int addr, int val)
{
unsigned long flags;
if (NULL == g_pmic) {
pr_err(" g_pmic is NULL\n");
return;
}
spin_lock_irqsave(&g_pmic->lock, flags);
hisi_pmic_write(g_pmic, g_pmic->normal_lock.addr, g_pmic->normal_lock.val);
hisi_pmic_write(g_pmic, g_pmic->debug_lock.addr, g_pmic->debug_lock.val);
hisi_pmic_write(g_pmic, addr, val);
hisi_pmic_write(g_pmic, g_pmic->normal_lock.addr, 0);
hisi_pmic_write(g_pmic, g_pmic->debug_lock.addr, 0);
spin_unlock_irqrestore(&g_pmic->lock, flags);
}
int hisi_pmic_array_read(int addr, char *buff, unsigned int len)
{
unsigned int i;
if ((len > 32) || (NULL == buff)) {
return -EINVAL;
}
/*
* Here is a bug in the pmu die.
* the coul driver will read 4 bytes,
* but the ssi bus only read 1 byte, and the pmu die
* will make sampling 1/10669us about vol cur,so the driver
* read the data is not the same sampling
*/
for (i = 0; i < len; i++)
{
*(buff + i) = hisi_pmic_reg_read(addr+i);
}
return 0;
}
int hisi_pmic_array_write(int addr, char *buff, unsigned int len)
{
unsigned int i;
if ((len > 32) || (NULL == buff)) {
return -EINVAL;
}
for (i = 0; i < len; i++)
{
hisi_pmic_reg_write(addr+i, *(buff + i));
}
return 0;
}
static irqreturn_t hisi_irq_handler(int irq, void *data) static irqreturn_t hisi_irq_handler(int irq, void *data)
{ {
struct hisi_pmic *pmic = (struct hisi_pmic *)data; struct hisi_pmic *pmic = (struct hisi_pmic *)data;
...@@ -213,13 +142,13 @@ static irqreturn_t hisi_irq_handler(int irq, void *data) ...@@ -213,13 +142,13 @@ static irqreturn_t hisi_irq_handler(int irq, void *data)
int i, offset; int i, offset;
for (i = 0; i < pmic->irqarray; i++) { for (i = 0; i < pmic->irqarray; i++) {
pending = hisi_pmic_reg_read((i + pmic->irq_addr.start_addr)); pending = hisi_pmic_read(g_pmic, (i + pmic->irq_addr.start_addr));
pending &= HISI_MASK_FIELD; pending &= HISI_MASK_FIELD;
if (pending != 0) { if (pending != 0) {
pr_info("pending[%d]=0x%lx\n\r", i, pending); pr_info("pending[%d]=0x%lx\n\r", i, pending);
} }
hisi_pmic_reg_write((i + pmic->irq_addr.start_addr), pending); hisi_pmic_write(g_pmic, (i + pmic->irq_addr.start_addr), pending);
/*solve powerkey order*/ /*solve powerkey order*/
if ((HISI_IRQ_KEY_NUM == i) && ((pending & HISI_IRQ_KEY_VALUE) == HISI_IRQ_KEY_VALUE)) { if ((HISI_IRQ_KEY_NUM == i) && ((pending & HISI_IRQ_KEY_VALUE) == HISI_IRQ_KEY_VALUE)) {
...@@ -237,13 +166,13 @@ static irqreturn_t hisi_irq_handler(int irq, void *data) ...@@ -237,13 +166,13 @@ static irqreturn_t hisi_irq_handler(int irq, void *data)
/*Handle the second group irq if analysis the second group irq from dtsi*/ /*Handle the second group irq if analysis the second group irq from dtsi*/
if (1 == g_extinterrupt_flag){ if (1 == g_extinterrupt_flag){
for (i = 0; i < pmic->irqarray1; i++) { for (i = 0; i < pmic->irqarray1; i++) {
pending = hisi_pmic_reg_read((i + pmic->irq_addr1.start_addr)); pending = hisi_pmic_read(g_pmic, (i + pmic->irq_addr1.start_addr));
pending &= HISI_MASK_FIELD; pending &= HISI_MASK_FIELD;
if (pending != 0) { if (pending != 0) {
pr_info("pending[%d]=0x%lx\n\r", i, pending); pr_info("pending[%d]=0x%lx\n\r", i, pending);
} }
hisi_pmic_reg_write((i + pmic->irq_addr1.start_addr), pending); hisi_pmic_write(g_pmic, (i + pmic->irq_addr1.start_addr), pending);
if (pending) { if (pending) {
for_each_set_bit(offset, &pending, HISI_BITS) for_each_set_bit(offset, &pending, HISI_BITS)
...@@ -276,9 +205,9 @@ static void hisi_irq_mask(struct irq_data *d) ...@@ -276,9 +205,9 @@ static void hisi_irq_mask(struct irq_data *d)
offset += pmic->irq_mask_addr.start_addr; offset += pmic->irq_mask_addr.start_addr;
} }
spin_lock_irqsave(&g_pmic->lock, flags); spin_lock_irqsave(&g_pmic->lock, flags);
data = hisi_pmic_reg_read(offset); data = hisi_pmic_read(g_pmic, offset);
data |= (1 << (irqd_to_hwirq(d) & 0x07)); data |= (1 << (irqd_to_hwirq(d) & 0x07));
hisi_pmic_reg_write(offset, data); hisi_pmic_write(g_pmic, offset, data);
spin_unlock_irqrestore(&g_pmic->lock, flags); spin_unlock_irqrestore(&g_pmic->lock, flags);
} }
...@@ -303,9 +232,9 @@ static void hisi_irq_unmask(struct irq_data *d) ...@@ -303,9 +232,9 @@ static void hisi_irq_unmask(struct irq_data *d)
offset += pmic->irq_mask_addr.start_addr; offset += pmic->irq_mask_addr.start_addr;
} }
spin_lock_irqsave(&g_pmic->lock, flags); spin_lock_irqsave(&g_pmic->lock, flags);
data = hisi_pmic_reg_read(offset); data = hisi_pmic_read(g_pmic, offset);
data &= ~(1 << (irqd_to_hwirq(d) & 0x07)); /*lint !e502 */ data &= ~(1 << (irqd_to_hwirq(d) & 0x07));
hisi_pmic_reg_write(offset, data); hisi_pmic_write(g_pmic, offset, data);
spin_unlock_irqrestore(&g_pmic->lock, flags); spin_unlock_irqrestore(&g_pmic->lock, flags);
} }
...@@ -452,34 +381,6 @@ static int get_pmic_device_tree_data1(struct device_node *np, struct hisi_pmic * ...@@ -452,34 +381,6 @@ static int get_pmic_device_tree_data1(struct device_node *np, struct hisi_pmic *
return ret; return ret;
}/*lint -restore*/ }/*lint -restore*/
int hisi_get_pmic_irq_byname(unsigned int pmic_irq_list)
{
if ( NULL == g_pmic ) {
pr_err("[%s]g_pmic is NULL\n", __func__);
return -1;
}
if (pmic_irq_list > (unsigned int)g_pmic->irqnum) {
pr_err("[%s]input pmic irq number is error.\n", __func__);
return -1;
}
pr_info("%s:g_pmic->irqs[%d]=%d\n", __func__, pmic_irq_list, g_pmic->irqs[pmic_irq_list]);
return (int)g_pmic->irqs[pmic_irq_list];
}
EXPORT_SYMBOL(hisi_get_pmic_irq_byname);
int hisi_pmic_get_vbus_status(void)
{
if (0 == g_pmic_vbus.addr)
return -1;
if (hisi_pmic_reg_read(g_pmic_vbus.addr) & BIT(g_pmic_vbus.bit))
return 1;
return 0;
}
EXPORT_SYMBOL(hisi_pmic_get_vbus_status);
static void hisi_pmic_irq_prc(struct hisi_pmic *pmic) static void hisi_pmic_irq_prc(struct hisi_pmic *pmic)
{ {
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment