2021-01-22 22:24:56 +03:00
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2016-11-11 00:26:23 +03:00
/*
2021-01-22 22:24:56 +03:00
* Mellanox i2c mux driver
2016-11-11 00:26:23 +03:00
*
2021-01-22 22:24:56 +03:00
* Copyright ( C ) 2016 - 2020 Mellanox Technologies
2016-11-11 00:26:23 +03:00
*/
# include <linux/device.h>
# include <linux/i2c.h>
# include <linux/i2c-mux.h>
# include <linux/io.h>
# include <linux/init.h>
# include <linux/module.h>
2021-01-22 22:24:58 +03:00
# include <linux/platform_data/mlxcpld.h>
2016-11-11 00:26:23 +03:00
# include <linux/platform_device.h>
# include <linux/slab.h>
/* mlxcpld_mux - mux control structure:
2021-02-08 23:16:02 +03:00
* @ last_val - last selected register value or - 1 if mux deselected
2016-11-11 00:26:23 +03:00
* @ client - I2C device client
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
* @ pdata : platform data
2016-11-11 00:26:23 +03:00
*/
struct mlxcpld_mux {
2021-02-08 23:16:02 +03:00
int last_val ;
2016-11-11 00:26:23 +03:00
struct i2c_client * client ;
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
struct mlxcpld_mux_plat_data pdata ;
2016-11-11 00:26:23 +03:00
} ;
/* MUX logic description.
* Driver can support different mux control logic , according to CPLD
* implementation .
*
* Connectivity schema .
*
* i2c - mlxcpld Digital Analog
* driver
* * - - - - - - - - * * - > mux1 ( virt bus2 ) - > mux - > |
* | I2CLPC | i2c physical * - > mux2 ( virt bus3 ) - > mux - > |
* | bridge | bus 1 * - - - - - - - - - * |
* | logic | - - - - - - - - - - - - - - - - - - - - - > * mux reg * |
* | in CPLD | * - - - - - - - - - * |
* * - - - - - - - - * i2c - mux - mlxpcld ^ * - > muxn ( virt busn ) - > mux - > |
* | driver | |
* | * - - - - - - - - - - - - - - - * | Devices
* | * CPLD ( i2c bus ) * select |
* | * registers for * - - - - - - - - *
* | * mux selection * deselect
* | * - - - - - - - - - - - - - - - *
* | |
* < - - - - - - - - > < - - - - - - - - - - - >
* i2c cntrl Board cntrl reg
* reg space space ( mux select ,
* IO , LED , WD , info )
*
*/
/* Write to mux register. Don't use i2c_transfer() and i2c_smbus_xfer()
* for this as they will try to lock adapter a second time .
*/
static int mlxcpld_mux_reg_write ( struct i2c_adapter * adap ,
2021-02-08 23:16:02 +03:00
struct mlxcpld_mux * mux , u32 val )
2016-11-11 00:26:23 +03:00
{
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
struct i2c_client * client = mux - > client ;
2021-02-08 23:16:04 +03:00
union i2c_smbus_data data ;
struct i2c_msg msg ;
u8 buf [ 3 ] ;
switch ( mux - > pdata . reg_size ) {
case 1 :
data . byte = val ;
return __i2c_smbus_xfer ( adap , client - > addr , client - > flags ,
I2C_SMBUS_WRITE , mux - > pdata . sel_reg_addr ,
I2C_SMBUS_BYTE_DATA , & data ) ;
case 2 :
buf [ 0 ] = mux - > pdata . sel_reg_addr > > 8 ;
buf [ 1 ] = mux - > pdata . sel_reg_addr ;
buf [ 2 ] = val ;
msg . addr = client - > addr ;
msg . buf = buf ;
msg . len = mux - > pdata . reg_size + 1 ;
msg . flags = 0 ;
return __i2c_transfer ( adap , & msg , 1 ) ;
default :
return - EINVAL ;
}
2016-11-11 00:26:23 +03:00
}
static int mlxcpld_mux_select_chan ( struct i2c_mux_core * muxc , u32 chan )
{
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
struct mlxcpld_mux * mux = i2c_mux_priv ( muxc ) ;
2021-02-08 23:16:04 +03:00
u32 regval = chan ;
2016-11-11 00:26:23 +03:00
int err = 0 ;
2021-02-08 23:16:04 +03:00
if ( mux - > pdata . reg_size = = 1 )
regval + = 1 ;
2016-11-11 00:26:23 +03:00
/* Only select the channel if its different from the last channel */
2021-02-08 23:16:02 +03:00
if ( mux - > last_val ! = regval ) {
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
err = mlxcpld_mux_reg_write ( muxc - > parent , mux , regval ) ;
2021-02-08 23:16:02 +03:00
mux - > last_val = err < 0 ? - 1 : regval ;
2016-11-11 00:26:23 +03:00
}
return err ;
}
static int mlxcpld_mux_deselect ( struct i2c_mux_core * muxc , u32 chan )
{
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
struct mlxcpld_mux * mux = i2c_mux_priv ( muxc ) ;
2016-11-11 00:26:23 +03:00
/* Deselect active channel */
2021-02-08 23:16:02 +03:00
mux - > last_val = - 1 ;
2016-11-11 00:26:23 +03:00
2021-02-08 23:16:02 +03:00
return mlxcpld_mux_reg_write ( muxc - > parent , mux , 0 ) ;
2016-11-11 00:26:23 +03:00
}
/* Probe/reomove functions */
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
static int mlxcpld_mux_probe ( struct platform_device * pdev )
2016-11-11 00:26:23 +03:00
{
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
struct mlxcpld_mux_plat_data * pdata = dev_get_platdata ( & pdev - > dev ) ;
struct i2c_client * client = to_i2c_client ( pdev - > dev . parent ) ;
2016-11-11 00:26:23 +03:00
struct i2c_mux_core * muxc ;
struct mlxcpld_mux * data ;
2021-02-08 23:16:03 +03:00
int num , err ;
2021-02-08 23:16:04 +03:00
u32 func ;
2016-11-11 00:26:23 +03:00
if ( ! pdata )
return - EINVAL ;
2021-02-08 23:16:04 +03:00
switch ( pdata - > reg_size ) {
case 1 :
func = I2C_FUNC_SMBUS_WRITE_BYTE_DATA ;
break ;
case 2 :
func = I2C_FUNC_I2C ;
break ;
default :
return - EINVAL ;
}
if ( ! i2c_check_functionality ( client - > adapter , func ) )
2016-11-11 00:26:23 +03:00
return - ENODEV ;
2021-02-08 23:16:05 +03:00
muxc = i2c_mux_alloc ( client - > adapter , & pdev - > dev , pdata - > num_adaps ,
2016-11-11 00:26:23 +03:00
sizeof ( * data ) , 0 , mlxcpld_mux_select_chan ,
mlxcpld_mux_deselect ) ;
if ( ! muxc )
return - ENOMEM ;
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
platform_set_drvdata ( pdev , muxc ) ;
2016-11-11 00:26:23 +03:00
data = i2c_mux_priv ( muxc ) ;
data - > client = client ;
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
memcpy ( & data - > pdata , pdata , sizeof ( * pdata ) ) ;
2021-02-08 23:16:02 +03:00
data - > last_val = - 1 ; /* force the first selection */
2016-11-11 00:26:23 +03:00
/* Create an adapter for each channel. */
2021-02-08 23:16:05 +03:00
for ( num = 0 ; num < pdata - > num_adaps ; num + + ) {
2021-02-08 23:16:03 +03:00
err = i2c_mux_add_adapter ( muxc , 0 , pdata - > chan_ids [ num ] , 0 ) ;
2016-11-11 00:26:23 +03:00
if ( err )
goto virt_reg_failed ;
}
2021-02-08 23:16:06 +03:00
/* Notify caller when all channels' adapters are created. */
if ( pdata - > completion_notify )
pdata - > completion_notify ( pdata - > handle , muxc - > parent , muxc - > adapter ) ;
2016-11-11 00:26:23 +03:00
return 0 ;
virt_reg_failed :
i2c_mux_del_adapters ( muxc ) ;
return err ;
}
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
static int mlxcpld_mux_remove ( struct platform_device * pdev )
2016-11-11 00:26:23 +03:00
{
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
struct i2c_mux_core * muxc = platform_get_drvdata ( pdev ) ;
2016-11-11 00:26:23 +03:00
i2c_mux_del_adapters ( muxc ) ;
return 0 ;
}
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
static struct platform_driver mlxcpld_mux_driver = {
. driver = {
. name = " i2c-mux-mlxcpld " ,
2016-11-11 00:26:23 +03:00
} ,
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
. probe = mlxcpld_mux_probe ,
. remove = mlxcpld_mux_remove ,
2016-11-11 00:26:23 +03:00
} ;
i2c: mux: mlxcpld: Convert driver to platform driver
Convert driver from 'i2c' to 'platform'.
The motivation is to avoid I2C addressing conflict between
‘i2c-mux-cpld’ driver, providing mux selection and deselection through
CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C
device and is multi-functional device performing logic for different
components, like LED, ‘hwmon’, interrupt control, watchdog etcetera.
For such configuration CPLD should be host I2C device, connected to the
relevant I2C bus with the relevant I2C address and all others component
drivers are supposed to be its children.
The hierarchy in such case will be like in the below example:
ls /sys/bus/i2c/devices/44-0032
i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44
ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44
channel-0, …, channel-X
Currently this driver is not activated by any kernel driver,
so this conversion doesn’t affect any user.
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>
2021-02-08 23:16:01 +03:00
module_platform_driver ( mlxcpld_mux_driver ) ;
2016-11-11 00:26:23 +03:00
MODULE_AUTHOR ( " Michael Shych (michaels@mellanox.com) " ) ;
MODULE_DESCRIPTION ( " Mellanox I2C-CPLD-MUX driver " ) ;
MODULE_LICENSE ( " Dual BSD/GPL " ) ;
MODULE_ALIAS ( " platform:i2c-mux-mlxcpld " ) ;