Skip to content

Commit b808f1c

Browse files
committed
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
2 parents d28b097 + 9761037 commit b808f1c

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

Documentation/devicetree/bindings/mux/gpio-mux.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ properties:
2525
description:
2626
List of gpios used to control the multiplexer, least significant bit first.
2727

28+
mux-supply:
29+
description:
30+
Regulator to power on the multiplexer.
31+
2832
'#mux-control-cells':
2933
enum: [ 0, 1 ]
3034

drivers/mux/adg792a.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, adg792a_of_match);
141141
static struct i2c_driver adg792a_driver = {
142142
.driver = {
143143
.name = "adg792a",
144-
.of_match_table = of_match_ptr(adg792a_of_match),
144+
.of_match_table = adg792a_of_match,
145145
},
146146
.probe = adg792a_probe,
147147
.id_table = adg792a_id,

drivers/mux/adgs1408.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ static int adgs1408_probe(struct spi_device *spi)
5959
s32 idle_state;
6060
int ret;
6161

62-
chip_id = (enum adgs1408_chip_id)device_get_match_data(dev);
63-
if (!chip_id)
64-
chip_id = spi_get_device_id(spi)->driver_data;
62+
chip_id = (kernel_ulong_t)spi_get_device_match_data(spi);
6563

6664
mux_chip = devm_mux_chip_alloc(dev, 1, 0);
6765
if (IS_ERR(mux_chip))

drivers/mux/gpio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/mux/driver.h>
1616
#include <linux/platform_device.h>
1717
#include <linux/property.h>
18+
#include <linux/regulator/consumer.h>
1819

1920
struct mux_gpio {
2021
struct gpio_descs *gpios;
@@ -80,6 +81,10 @@ static int mux_gpio_probe(struct platform_device *pdev)
8081
mux_chip->mux->idle_state = idle_state;
8182
}
8283

84+
ret = devm_regulator_get_enable_optional(dev, "mux");
85+
if (ret && ret != -ENODEV)
86+
return dev_err_probe(dev, ret, "failed to get/enable mux supply\n");
87+
8388
ret = devm_mux_chip_register(dev, mux_chip);
8489
if (ret < 0)
8590
return ret;

drivers/mux/mmio.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,32 @@ static const struct of_device_id mux_mmio_dt_ids[] = {
3333
};
3434
MODULE_DEVICE_TABLE(of, mux_mmio_dt_ids);
3535

36+
static const struct regmap_config mux_mmio_regmap_cfg = {
37+
.reg_bits = 32,
38+
.val_bits = 32,
39+
.reg_stride = 4,
40+
};
41+
3642
static int mux_mmio_probe(struct platform_device *pdev)
3743
{
3844
struct device *dev = &pdev->dev;
3945
struct device_node *np = dev->of_node;
4046
struct regmap_field **fields;
4147
struct mux_chip *mux_chip;
4248
struct regmap *regmap;
49+
void __iomem *base;
4350
int num_fields;
4451
int ret;
4552
int i;
4653

4754
if (of_device_is_compatible(np, "mmio-mux")) {
4855
regmap = syscon_node_to_regmap(np->parent);
4956
} else {
50-
regmap = device_node_to_regmap(np);
57+
base = devm_platform_ioremap_resource(pdev, 0);
58+
if (IS_ERR(base))
59+
regmap = ERR_PTR(-ENODEV);
60+
else
61+
regmap = regmap_init_mmio(dev, base, &mux_mmio_regmap_cfg);
5162
/* Fallback to checking the parent node on "real" errors. */
5263
if (IS_ERR(regmap) && regmap != ERR_PTR(-EPROBE_DEFER)) {
5364
regmap = dev_get_regmap(dev->parent, NULL);
@@ -107,7 +118,7 @@ static int mux_mmio_probe(struct platform_device *pdev)
107118
fields[i] = devm_regmap_field_alloc(dev, regmap, field);
108119
if (IS_ERR(fields[i])) {
109120
ret = PTR_ERR(fields[i]);
110-
dev_err(dev, "bitfield %d: failed allocate: %d\n",
121+
dev_err(dev, "bitfield %d: failed to allocate: %d\n",
111122
i, ret);
112123
return ret;
113124
}

0 commit comments

Comments
 (0)