mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
Revert "mfd: Add support for Maxim MAX96752F"
This reverts commit ad3d90b0ba.
Delete this unused driver.
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Change-Id: Ie3f71ea9cfb53751e7f1370ca95acfe9726e9696
This commit is contained in:
@@ -930,15 +930,6 @@ config MFD_MAX96745
|
||||
help
|
||||
Say yes here to add support for Maxim Semiconductor MAX96745.
|
||||
|
||||
config MFD_MAX96752F
|
||||
tristate "Maxim Semiconductor MAX96752F GMSL2 Deserializer Support"
|
||||
depends on I2C
|
||||
select MFD_CORE
|
||||
select REGMAP_I2C
|
||||
select I2C_MUX
|
||||
help
|
||||
Say yes here to add support for Maxim Semiconductor MAX96752F.
|
||||
|
||||
config MFD_MAX96755F
|
||||
tristate "Maxim Semiconductor MAX96755 GMSL2 Serializer Support"
|
||||
depends on I2C
|
||||
|
||||
@@ -171,7 +171,6 @@ obj-$(CONFIG_MFD_MAX8925) += max8925.o
|
||||
obj-$(CONFIG_MFD_MAX8997) += max8997.o max8997-irq.o
|
||||
obj-$(CONFIG_MFD_MAX8998) += max8998.o max8998-irq.o
|
||||
obj-$(CONFIG_MFD_MAX96745) += max96745.o
|
||||
obj-$(CONFIG_MFD_MAX96752F) += max96752f.o
|
||||
obj-$(CONFIG_MFD_MAX96755F) += max96755f.o
|
||||
obj-$(CONFIG_MFD_MAX96776) += max96776.o
|
||||
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Maxim MAX96752F MFD driver
|
||||
*
|
||||
* Copyright (C) 2022 Rockchip Electronics Co. Ltd.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-mux.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/mfd/max96752f.h>
|
||||
|
||||
static const struct mfd_cell max96752f_devs[] = {
|
||||
{
|
||||
.name = "max96752f-pinctrl",
|
||||
.of_compatible = "maxim,max96752f-pinctrl",
|
||||
}, {
|
||||
.name = "max96752f-gpio",
|
||||
.of_compatible = "maxim,max96752f-gpio",
|
||||
}, {
|
||||
.name = "max96752f-bridge",
|
||||
.of_compatible = "maxim,max96752f-bridge",
|
||||
},
|
||||
};
|
||||
|
||||
static int max96752f_select(struct i2c_mux_core *muxc, u32 chan)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct regmap_config max96752f_regmap_config = {
|
||||
.name = "max96752f",
|
||||
.reg_bits = 16,
|
||||
.val_bits = 8,
|
||||
.max_register = 0x25d,
|
||||
};
|
||||
|
||||
static const unsigned short addr_list[] = {
|
||||
0x48, 0x4a, 0x4c, 0x68, 0x6a, 0x6c, 0x28, 0x2a, I2C_CLIENT_END
|
||||
};
|
||||
|
||||
void max96752f_init(struct max96752f *max96752f)
|
||||
{
|
||||
struct i2c_client *client = max96752f->client;
|
||||
u16 addr = client->addr;
|
||||
u32 id;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; addr_list[i] != I2C_CLIENT_END; i++) {
|
||||
client->addr = addr_list[i];
|
||||
ret = regmap_read(max96752f->regmap, 0x000d, &id);
|
||||
if (ret < 0)
|
||||
continue;
|
||||
|
||||
if (id == 0x82) {
|
||||
regmap_write(max96752f->regmap, 0x0000, addr << 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
client->addr = addr;
|
||||
|
||||
regmap_update_bits(max96752f->regmap, 0x0050, STR_SEL,
|
||||
FIELD_PREP(STR_SEL, max96752f->stream_id));
|
||||
regmap_update_bits(max96752f->regmap, 0x0073, TX_SRC_ID,
|
||||
FIELD_PREP(TX_SRC_ID, max96752f->stream_id));
|
||||
}
|
||||
EXPORT_SYMBOL(max96752f_init);
|
||||
|
||||
static void max96752f_power_on(struct max96752f *max96752f)
|
||||
{
|
||||
if (max96752f->enable_gpio) {
|
||||
gpiod_direction_output(max96752f->enable_gpio, 1);
|
||||
msleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
static void max96752f_power_off(struct max96752f *max96752f)
|
||||
{
|
||||
if (max96752f->enable_gpio)
|
||||
gpiod_direction_output(max96752f->enable_gpio, 0);
|
||||
}
|
||||
|
||||
static int max96752f_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
struct device_node *child;
|
||||
struct max96752f *max96752f;
|
||||
unsigned int nr = 0;
|
||||
int ret;
|
||||
|
||||
for_each_available_child_of_node(dev->of_node, child) {
|
||||
if (!of_find_property(child, "reg", NULL))
|
||||
continue;
|
||||
|
||||
nr++;
|
||||
}
|
||||
|
||||
max96752f = devm_kzalloc(dev, sizeof(*max96752f), GFP_KERNEL);
|
||||
if (!max96752f)
|
||||
return -ENOMEM;
|
||||
|
||||
max96752f->muxc = i2c_mux_alloc(client->adapter, dev, nr, 0,
|
||||
I2C_MUX_LOCKED, max96752f_select, NULL);
|
||||
if (!max96752f->muxc)
|
||||
return -ENOMEM;
|
||||
|
||||
max96752f->dev = dev;
|
||||
max96752f->client = client;
|
||||
|
||||
max96752f->enable_gpio = devm_gpiod_get_optional(dev, "enable",
|
||||
GPIOD_ASIS);
|
||||
if (IS_ERR(max96752f->enable_gpio))
|
||||
return dev_err_probe(dev, PTR_ERR(max96752f->enable_gpio),
|
||||
"failed to get enable GPIO\n");
|
||||
|
||||
ret = device_property_read_u32(dev->parent, "reg", &max96752f->stream_id);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to get gmsl id\n");
|
||||
|
||||
i2c_set_clientdata(client, max96752f);
|
||||
|
||||
max96752f->regmap = devm_regmap_init_i2c(client,
|
||||
&max96752f_regmap_config);
|
||||
if (IS_ERR(max96752f->regmap))
|
||||
return dev_err_probe(dev, PTR_ERR(max96752f->regmap),
|
||||
"failed to initialize regmap\n");
|
||||
|
||||
max96752f_power_on(max96752f);
|
||||
max96752f_init(max96752f);
|
||||
|
||||
ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, max96752f_devs,
|
||||
ARRAY_SIZE(max96752f_devs), NULL, 0, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for_each_available_child_of_node(dev->of_node, child) {
|
||||
if (of_property_read_u32(child, "reg", &nr))
|
||||
continue;
|
||||
|
||||
ret = i2c_mux_add_adapter(max96752f->muxc, 0, nr, 0);
|
||||
if (ret) {
|
||||
i2c_mux_del_adapters(max96752f->muxc);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void max96752f_i2c_shutdown(struct i2c_client *client)
|
||||
{
|
||||
struct max96752f *max96752f = i2c_get_clientdata(client);
|
||||
|
||||
regmap_update_bits(max96752f->regmap, 0x0010, RESET_ALL,
|
||||
FIELD_PREP(RESET_ALL, 1));
|
||||
|
||||
max96752f_power_off(max96752f);
|
||||
}
|
||||
|
||||
static int __maybe_unused max96752f_suspend(struct device *dev)
|
||||
{
|
||||
struct max96752f *max96752f = dev_get_drvdata(dev);
|
||||
|
||||
max96752f_power_off(max96752f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused max96752f_resume(struct device *dev)
|
||||
{
|
||||
struct max96752f *max96752f = dev_get_drvdata(dev);
|
||||
|
||||
max96752f_power_on(max96752f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(max96752f_pm_ops, max96752f_suspend, max96752f_resume);
|
||||
|
||||
static const struct of_device_id max96752f_of_match[] = {
|
||||
{ .compatible = "maxim,max96752f", },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, max96752f_of_match);
|
||||
|
||||
static struct i2c_driver max96752f_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "max96752f",
|
||||
.of_match_table = of_match_ptr(max96752f_of_match),
|
||||
.pm = &max96752f_pm_ops,
|
||||
},
|
||||
.probe_new = max96752f_i2c_probe,
|
||||
.shutdown = max96752f_i2c_shutdown,
|
||||
};
|
||||
|
||||
module_i2c_driver(max96752f_i2c_driver);
|
||||
|
||||
MODULE_AUTHOR("Wyon Bi <bivvy.bi@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("Maxim MAX96752F MFD driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -1,114 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Defining registers address and its bit definitions of MAX96752F
|
||||
*
|
||||
* Copyright (c) 2022 Rockchip Electronics Co. Ltd.
|
||||
*/
|
||||
|
||||
#ifndef _MFD_MAX96752F_H_
|
||||
#define _MFD_MAX96752F_H_
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
|
||||
#define GPIO_A_REG(gpio) (0x0200 + ((gpio) * 3))
|
||||
#define GPIO_B_REG(gpio) (0x0201 + ((gpio) * 3))
|
||||
#define GPIO_C_REG(gpio) (0x0202 + ((gpio) * 3))
|
||||
#define OLDI_REG(x) (0x01cd + (x))
|
||||
|
||||
/* 0000h */
|
||||
#define DEV_ADDR GENMASK(7, 1)
|
||||
#define CFG_BLOCK BIT(0)
|
||||
|
||||
/* 0001h */
|
||||
#define LVDS_HALFSW BIT(7)
|
||||
#define IIC_2_EN BIT(5)
|
||||
#define IIC_1_EN BIT(4)
|
||||
#define TX_RATE GENMASK(3, 2)
|
||||
#define RX_RATE GENMASK(1, 0)
|
||||
|
||||
/* 0002h */
|
||||
#define LOCK_CFG BIT(7)
|
||||
#define VID_EN BIT(6)
|
||||
#define DIS_LOCAL_CC BIT(5)
|
||||
#define DIS_REM_CC BIT(4)
|
||||
#define AUD_TX_EN BIT(2)
|
||||
|
||||
/* 0003h */
|
||||
#define GMSL2 BIT(5)
|
||||
#define I2CSEL BIT(4)
|
||||
#define UART_2_EN BIT(3)
|
||||
#define UART_1_EN BIT(2)
|
||||
#define VIDEO_LOCK BIT(0)
|
||||
|
||||
/* 000Dh */
|
||||
#define DEV_ID GENMASK(7, 0)
|
||||
|
||||
/* 000Eh */
|
||||
#define DEV_REV GENMASK(3, 0)
|
||||
|
||||
/* 0010h */
|
||||
#define RESET_ALL BIT(7)
|
||||
#define RESET_LINK BIT(6)
|
||||
#define RESET_ONESHOT BIT(5)
|
||||
#define AUTO_LINK BIT(4)
|
||||
#define SLEEP BIT(3)
|
||||
#define LINK_CFG GENMASK(1, 0)
|
||||
|
||||
/* 0050h */
|
||||
#define STR_SEL GENMASK(1, 0)
|
||||
|
||||
/* 0073h */
|
||||
#define TX_SRC_ID GENMASK(2, 0)
|
||||
|
||||
/* 0108h */
|
||||
#define VID_LOCK BIT(6)
|
||||
|
||||
/* 0140h */
|
||||
#define AUD_RX_EN BIT(0)
|
||||
|
||||
/* 01CEh */
|
||||
#define OLDI_OUTSEL BIT(7)
|
||||
#define OLDI_FORMAT BIT(6)
|
||||
#define OLDI_4TH_LANE BIT(5)
|
||||
#define OLDI_SWAP_AB BIT(4)
|
||||
#define OLDI_SPL_EN BIT(3)
|
||||
#define OLDI_SPL_MODE GENMASK(2, 1)
|
||||
#define OLDI_SPL_POL BIT(0)
|
||||
|
||||
/* 01CFh */
|
||||
#define PD_LVDS_B BIT(7)
|
||||
#define PD_LVDS_A BIT(6)
|
||||
#define OLDI_DUP BIT(1)
|
||||
#define SSEN BIT(0)
|
||||
|
||||
/* 0200h */
|
||||
#define RES_CFG BIT(7)
|
||||
#define TX_PRIO BIT(6)
|
||||
#define TX_COMP_EN BIT(5)
|
||||
#define GPIO_OUT BIT(4)
|
||||
#define GPIO_IN BIT(3)
|
||||
#define GPIO_RX_EN BIT(2)
|
||||
#define GPIO_TX_EN BIT(1)
|
||||
#define GPIO_OUT_DIS BIT(0)
|
||||
|
||||
/* 0201h */
|
||||
#define PULL_UPDN_SEL GENMASK(7, 6)
|
||||
#define OUT_TYPE BIT(5)
|
||||
#define GPIO_TX_ID GENMASK(4, 0)
|
||||
|
||||
/* 0202h */
|
||||
#define OVR_RES_CFG BIT(7)
|
||||
#define GPIO_RX_ID GENMASK(4, 0)
|
||||
|
||||
struct max96752f {
|
||||
struct device *dev;
|
||||
struct regmap *regmap;
|
||||
struct i2c_client *client;
|
||||
struct i2c_mux_core *muxc;
|
||||
struct gpio_desc *enable_gpio;
|
||||
u32 stream_id;
|
||||
};
|
||||
|
||||
void max96752f_init(struct max96752f *max96752f);
|
||||
|
||||
#endif /* _MFD_MAX96752F_H_ */
|
||||
Reference in New Issue
Block a user