mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:44:45 +01:00
Mux drivers for v6.16
Few cleanups and fixes for the mux drivers:
1. Simplify with spi_get_device_match_data().
2. Fix -Wunused-const-variable and -Wvoid-pointer-to-enum-cast warnings.
3. GPIO mux: add optional regulator for Lenovo T14s laptop headset.
4. MMIO mux: avoid using syscon's device_node_to_regmap(), due to
changes in the syscon code.
-----BEGIN PGP SIGNATURE-----
iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmgjIzwQHGtyemtAa2Vy
bmVsLm9yZwAKCRDBN2bmhouD118DEACYinLDzBuWpXFJN5RehVuC7VKA0bcQ3rNn
jdbIM8dL06QXZRz9yM/VcBVsPQO4FJa24JMboJDSt++wlpdxDNUklItBw+JVNoaZ
VaaeKK0ISVcPTY/bnhX2py+28zxmqe46BBRgc4P04QufZ8w6VlFbepKnQ6NQtgxY
vqN2AaqNydewqL/h+0k9daugWZqu+kZ2NaAOf2K2lTiohY5HIuy8KhPU9KJQGxOK
0nY+8uEV/SxHZkEX3u4qSgpJH/5uTFLCsUtosmWNyF+UzkK3tcp2ipMNXeQIGwfV
iKfsWncW6oJ+4jMu+GG14/PPEgn1VAPJxdI55KZy9FFP7FmZFI6lkICzOQPRHCkT
1+cNO8fs4IUPWOt52wjK23UM2P1PdoiC/zyoROORCCAMPr695fEcqSyv+uMQ3wxB
k57mv1AUJ3ZHjFYctSRNkYjl+wT+Zeu/5ur3B7j5DXgWhMTxZRXJ20Z7M4nC4wWv
2/1bRP5KkCs64E/YwfOVt3KhoBQBOM2jHXD6Wm+TYSmBiWr0qCIwr3Jy17OIxtPP
KtdNcWKJpgonT+xJBz/mmVOAUjImBBU0pxNNxanUvaXiVn4ZfKvgyeZ/+bBJwqZ/
tpSRD8D701e72IvQslQWPsGl1sDvAzoLwmFvSoVxzCNaUI4CpK+PllH3brQDhs+m
DT7kvil8fA==
=s41I
-----END PGP SIGNATURE-----
Merge tag 'mux-drv-6.16' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/krzk/linux into char-misc-next
Krzysztof writes:
Mux drivers for v6.16
Few cleanups and fixes for the mux drivers:
1. Simplify with spi_get_device_match_data().
2. Fix -Wunused-const-variable and -Wvoid-pointer-to-enum-cast warnings.
3. GPIO mux: add optional regulator for Lenovo T14s laptop headset.
4. MMIO mux: avoid using syscon's device_node_to_regmap(), due to
changes in the syscon code.
* tag 'mux-drv-6.16' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/krzk/linux:
mux: adgs1408: fix Wvoid-pointer-to-enum-cast warning
mux: gpio: add optional regulator support
dt-bindings: mux: add optional regulator binding to gpio mux
mux: mmio: Do not use syscon helper to build regmap
mux: adg792a: remove incorrect of_match_ptr annotation
mux: adgs1408: simplify with spi_get_device_match_data()
mux: mmio: Add missing word in error message
This commit is contained in:
commit
b808f1cc9c
5 changed files with 24 additions and 6 deletions
|
|
@ -25,6 +25,10 @@ properties:
|
|||
description:
|
||||
List of gpios used to control the multiplexer, least significant bit first.
|
||||
|
||||
mux-supply:
|
||||
description:
|
||||
Regulator to power on the multiplexer.
|
||||
|
||||
'#mux-control-cells':
|
||||
enum: [ 0, 1 ]
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, adg792a_of_match);
|
|||
static struct i2c_driver adg792a_driver = {
|
||||
.driver = {
|
||||
.name = "adg792a",
|
||||
.of_match_table = of_match_ptr(adg792a_of_match),
|
||||
.of_match_table = adg792a_of_match,
|
||||
},
|
||||
.probe = adg792a_probe,
|
||||
.id_table = adg792a_id,
|
||||
|
|
|
|||
|
|
@ -59,9 +59,7 @@ static int adgs1408_probe(struct spi_device *spi)
|
|||
s32 idle_state;
|
||||
int ret;
|
||||
|
||||
chip_id = (enum adgs1408_chip_id)device_get_match_data(dev);
|
||||
if (!chip_id)
|
||||
chip_id = spi_get_device_id(spi)->driver_data;
|
||||
chip_id = (kernel_ulong_t)spi_get_device_match_data(spi);
|
||||
|
||||
mux_chip = devm_mux_chip_alloc(dev, 1, 0);
|
||||
if (IS_ERR(mux_chip))
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <linux/mux/driver.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
struct mux_gpio {
|
||||
struct gpio_descs *gpios;
|
||||
|
|
@ -80,6 +81,10 @@ static int mux_gpio_probe(struct platform_device *pdev)
|
|||
mux_chip->mux->idle_state = idle_state;
|
||||
}
|
||||
|
||||
ret = devm_regulator_get_enable_optional(dev, "mux");
|
||||
if (ret && ret != -ENODEV)
|
||||
return dev_err_probe(dev, ret, "failed to get/enable mux supply\n");
|
||||
|
||||
ret = devm_mux_chip_register(dev, mux_chip);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ static const struct of_device_id mux_mmio_dt_ids[] = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids);
|
||||
|
||||
static const struct regmap_config mux_mmio_regmap_cfg = {
|
||||
.reg_bits = 32,
|
||||
.val_bits = 32,
|
||||
.reg_stride = 4,
|
||||
};
|
||||
|
||||
static int mux_mmio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
|
|
@ -40,6 +46,7 @@ static int mux_mmio_probe(struct platform_device *pdev)
|
|||
struct regmap_field **fields;
|
||||
struct mux_chip *mux_chip;
|
||||
struct regmap *regmap;
|
||||
void __iomem *base;
|
||||
int num_fields;
|
||||
int ret;
|
||||
int i;
|
||||
|
|
@ -47,7 +54,11 @@ static int mux_mmio_probe(struct platform_device *pdev)
|
|||
if (of_device_is_compatible(np, "mmio-mux")) {
|
||||
regmap = syscon_node_to_regmap(np->parent);
|
||||
} else {
|
||||
regmap = device_node_to_regmap(np);
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(base))
|
||||
regmap = ERR_PTR(-ENODEV);
|
||||
else
|
||||
regmap = regmap_init_mmio(dev, base, &mux_mmio_regmap_cfg);
|
||||
/* Fallback to checking the parent node on "real" errors. */
|
||||
if (IS_ERR(regmap) && regmap != ERR_PTR(-EPROBE_DEFER)) {
|
||||
regmap = dev_get_regmap(dev->parent, NULL);
|
||||
|
|
@ -107,7 +118,7 @@ static int mux_mmio_probe(struct platform_device *pdev)
|
|||
fields[i] = devm_regmap_field_alloc(dev, regmap, field);
|
||||
if (IS_ERR(fields[i])) {
|
||||
ret = PTR_ERR(fields[i]);
|
||||
dev_err(dev, "bitfield %d: failed allocate: %d\n",
|
||||
dev_err(dev, "bitfield %d: failed to allocate: %d\n",
|
||||
i, ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue