/** * struct img_ascii_lcd_config - Configuration information about an LCD model * @num_chars: the number of characters the LCD can display * @external_regmap: true if registers are in a system controller, else false * @ops: character line display operations
*/ struct img_ascii_lcd_config { unsignedint num_chars; bool external_regmap; conststruct linedisp_ops ops;
};
/** * struct img_ascii_lcd_ctx - Private data structure * @linedisp: line display structure * @base: the base address of the LCD registers * @regmap: the regmap through which LCD registers are accessed * @offset: the offset within regmap to the start of the LCD registers
*/ struct img_ascii_lcd_ctx { struct linedisp linedisp; union { void __iomem *base; struct regmap *regmap;
};
u32 offset;
};
/** * img_ascii_lcd_probe() - probe an LCD display device * @pdev: the LCD platform device * * Probe an LCD display device, ensuring that we have the required resources in * order to access the LCD & setting up private data as well as sysfs files. * * Return: 0 on success, else -ERRNO
*/ staticint img_ascii_lcd_probe(struct platform_device *pdev)
{ struct device *dev = &pdev->dev; conststruct img_ascii_lcd_config *cfg = device_get_match_data(dev); struct img_ascii_lcd_ctx *ctx; int err;
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM;
if (cfg->external_regmap) {
ctx->regmap = syscon_node_to_regmap(dev->parent->of_node); if (IS_ERR(ctx->regmap)) return PTR_ERR(ctx->regmap);
if (of_property_read_u32(dev->of_node, "offset", &ctx->offset)) return -EINVAL;
} else {
ctx->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(ctx->base)) return PTR_ERR(ctx->base);
}
err = linedisp_register(&ctx->linedisp, dev, cfg->num_chars, &cfg->ops); if (err) return err;
/* for backwards compatibility */
err = compat_only_sysfs_link_entry_to_kobj(&dev->kobj,
&ctx->linedisp.dev.kobj, "message", NULL); if (err) goto err_unregister;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.