Skip to content

Commit

Permalink
i2c: mux: mlxcpld: Extend supported mux number
Browse files Browse the repository at this point in the history
Allow to extend mux number supported by driver.
Currently it is limited by eight, which is not enough for new coming
Mellanox modular system with line cards, which require up to 64 mux
support.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Michael Shych <michaelsh@nvidia.com>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
  • Loading branch information
vadimp-nvidia authored and wsakernel committed Feb 9, 2021
1 parent c52a1c5 commit 699c050
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/i2c/muxes/i2c-mux-mlxcpld.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <linux/platform_device.h>
#include <linux/slab.h>

#define CPLD_MUX_MAX_NCHANS 8

/* mlxcpld_mux - mux control structure:
* @last_val - last selected register value or -1 if mux deselected
* @client - I2C device client
Expand Down Expand Up @@ -142,7 +140,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
if (!i2c_check_functionality(client->adapter, func))
return -ENODEV;

muxc = i2c_mux_alloc(client->adapter, &pdev->dev, CPLD_MUX_MAX_NCHANS,
muxc = i2c_mux_alloc(client->adapter, &pdev->dev, pdata->num_adaps,
sizeof(*data), 0, mlxcpld_mux_select_chan,
mlxcpld_mux_deselect);
if (!muxc)
Expand All @@ -155,11 +153,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
data->last_val = -1; /* force the first selection */

/* Create an adapter for each channel. */
for (num = 0; num < CPLD_MUX_MAX_NCHANS; num++) {
if (num >= pdata->num_adaps)
/* discard unconfigured channels */
break;

for (num = 0; num < pdata->num_adaps; num++) {
err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
if (err)
goto virt_reg_failed;
Expand Down

0 comments on commit 699c050

Please sign in to comment.