17
17
* behavior of the output pin that is neither the old nor the new state,
18
18
* rather something in between.
19
19
*/
20
+ #define DEFAULT_SYMBOL_NAMESPACE "PWM_MC33XS2410"
20
21
22
+ #include <linux/auxiliary_bus.h>
21
23
#include <linux/bitfield.h>
22
24
#include <linux/delay.h>
23
25
#include <linux/err.h>
24
26
#include <linux/math64.h>
27
+ #include <linux/mc33xs2410.h>
25
28
#include <linux/minmax.h>
26
29
#include <linux/module.h>
27
30
#include <linux/of.h>
@@ -120,12 +123,19 @@ static int mc33xs2410_read_reg(struct spi_device *spi, u8 reg, u16 *val, u8 flag
120
123
return mc33xs2410_read_regs (spi , & reg , flag , val , 1 );
121
124
}
122
125
123
- static int mc33xs2410_read_reg_ctrl (struct spi_device * spi , u8 reg , u16 * val )
126
+ int mc33xs2410_read_reg_ctrl (struct spi_device * spi , u8 reg , u16 * val )
124
127
{
125
128
return mc33xs2410_read_reg (spi , reg , val , MC33XS2410_FRAME_IN_DATA_RD );
126
129
}
130
+ EXPORT_SYMBOL_GPL (mc33xs2410_read_reg_ctrl );
127
131
128
- static int mc33xs2410_modify_reg (struct spi_device * spi , u8 reg , u8 mask , u8 val )
132
+ int mc33xs2410_read_reg_diag (struct spi_device * spi , u8 reg , u16 * val )
133
+ {
134
+ return mc33xs2410_read_reg (spi , reg , val , 0 );
135
+ }
136
+ EXPORT_SYMBOL_GPL (mc33xs2410_read_reg_diag );
137
+
138
+ int mc33xs2410_modify_reg (struct spi_device * spi , u8 reg , u8 mask , u8 val )
129
139
{
130
140
u16 tmp ;
131
141
int ret ;
@@ -139,6 +149,7 @@ static int mc33xs2410_modify_reg(struct spi_device *spi, u8 reg, u8 mask, u8 val
139
149
140
150
return mc33xs2410_write_reg (spi , reg , tmp );
141
151
}
152
+ EXPORT_SYMBOL_GPL (mc33xs2410_modify_reg );
142
153
143
154
static u8 mc33xs2410_pwm_get_freq (u64 period )
144
155
{
@@ -314,6 +325,7 @@ static int mc33xs2410_reset(struct device *dev)
314
325
static int mc33xs2410_probe (struct spi_device * spi )
315
326
{
316
327
struct device * dev = & spi -> dev ;
328
+ struct auxiliary_device * adev ;
317
329
struct pwm_chip * chip ;
318
330
int ret ;
319
331
@@ -361,6 +373,10 @@ static int mc33xs2410_probe(struct spi_device *spi)
361
373
if (ret < 0 )
362
374
return dev_err_probe (dev , ret , "Failed to add pwm chip\n" );
363
375
376
+ adev = devm_auxiliary_device_create (dev , "hwmon" , NULL );
377
+ if (!adev )
378
+ return dev_err_probe (dev , - ENODEV , "Failed to register hwmon device\n" );
379
+
364
380
return 0 ;
365
381
}
366
382
0 commit comments