Skip to content

Commit 2a4e333

Browse files
miquelraynalLee Jones
authored andcommitted
mfd: ti_am335x_tscadc: Add a boolean to clarify the presence of a touchscreen
Just checking the number of wires will soon not be enough, add a boolean to indicate the actual use or not of the touchscreen. Certain checks only make sense when there is a touchscreen wired. Make these checks explicitly depend on the presence of the touchscreen. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-35-miquel.raynal@bootlin.com
1 parent e40b597 commit 2a4e333

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎drivers/mfd/ti_am335x_tscadc.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static int ti_tscadc_probe(struct platform_device *pdev)
120120
struct mfd_cell *cell;
121121
struct property *prop;
122122
const __be32 *cur;
123+
bool use_tsc = false;
123124
u32 val;
124125
int err;
125126
int tscmag_wires = 0, adc_channels = 0, cell_idx = 0, total_channels;
@@ -143,6 +144,8 @@ static int ti_tscadc_probe(struct platform_device *pdev)
143144
of_property_read_u32(node, "ti,wires", &tscmag_wires);
144145
of_property_read_u32(node, "ti,coordiante-readouts", &readouts);
145146
of_node_put(node);
147+
if (tscmag_wires)
148+
use_tsc = true;
146149

147150
node = of_get_child_by_name(pdev->dev.of_node, "adc");
148151
of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
@@ -168,7 +171,7 @@ static int ti_tscadc_probe(struct platform_device *pdev)
168171
return -EINVAL;
169172
}
170173

171-
if (readouts * 2 + 2 + adc_channels > 16) {
174+
if (use_tsc && (readouts * 2 + 2 + adc_channels > 16)) {
172175
dev_err(&pdev->dev, "Too many step configurations requested\n");
173176
return -EINVAL;
174177
}
@@ -223,7 +226,7 @@ static int ti_tscadc_probe(struct platform_device *pdev)
223226
* added manually when timely.
224227
*/
225228
tscadc->ctrl = CNTRLREG_TSC_STEPCONFIGWRT | CNTRLREG_STEPID;
226-
if (tscmag_wires > 0) {
229+
if (use_tsc) {
227230
tscadc->ctrl |= CNTRLREG_TSC_ENB;
228231
if (tscmag_wires == 5)
229232
tscadc->ctrl |= CNTRLREG_TSC_5WIRE;

0 commit comments

Comments
 (0)