Commit f16177c20c42e1bd780b35259a995f7718986dd4

Authored by Eric Miao
Committed by Russell King
1 parent 55b951e7e6

hwmon: add max1111_read_channel() for use by sharpsl_pm

This is not generic, and is added here for backward compatibility.
It is made an individual commit here to make it easier for revert
once the sharpsl_pm gets generic enough.

Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Showing 2 changed files with 22 additions and 0 deletions Side-by-side Diff

arch/arm/mach-pxa/sharpsl_pm.c
... ... @@ -132,8 +132,17 @@
132 132 if (machine_is_tosa()) // Ugly, better move this function into another module
133 133 return 0;
134 134  
  135 +#ifdef CONFIG_SENSORS_MAX1111
  136 + extern int max1111_read_channel(int);
  137 +
  138 + /* max1111 accepts channels from 0-3, however,
  139 + * it is encoded from 0-7 here in the code.
  140 + */
  141 + return max1111_read_channel(channel >> 1);
  142 +#else
135 143 return corgi_ssp_max1111_get((channel << MAXCTRL_SEL_SH) | MAXCTRL_PD0 | MAXCTRL_PD1
136 144 | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR);
  145 +#endif
137 146 }
138 147  
139 148 void sharpsl_pm_pxa_init(void)
drivers/hwmon/max1111.c
... ... @@ -66,6 +66,16 @@
66 66 return (v1 << 2) | (v2 >> 6);
67 67 }
68 68  
  69 +#ifdef CONFIG_SHARPSL_PM
  70 +static struct max1111_data *the_max1111;
  71 +
  72 +int max1111_read_channel(int channel)
  73 +{
  74 + return max1111_read(&the_max1111->spi->dev, channel);
  75 +}
  76 +EXPORT_SYMBOL(max1111_read_channel);
  77 +#endif
  78 +
69 79 /*
70 80 * NOTE: SPI devices do not have a default 'name' attribute, which is
71 81 * likely to be used by hwmon applications to distinguish between
... ... @@ -181,6 +191,9 @@
181 191 goto err_remove;
182 192 }
183 193  
  194 +#ifdef CONFIG_SHARPSL_PM
  195 + the_max1111 = data;
  196 +#endif
184 197 return 0;
185 198  
186 199 err_remove: