/* * 82c0d13a-78c5-4244-9bb1-eb8b539a8d11 * This _DSM GUID allows controlling the sensor clk when it is not controlled * through a GPIO.
*/ staticconst guid_t img_clk_guid =
GUID_INIT(0x82c0d13a, 0x78c5, 0x4244,
0x9b, 0xb1, 0xeb, 0x8b, 0x53, 0x9a, 0x8d, 0x11);
staticvoid skl_int3472_enable_clk(struct int3472_clock *clk, int enable)
{ struct int3472_discrete_device *int3472 = to_int3472_device(clk); union acpi_object args[3]; union acpi_object argv4;
if (clk->ena_gpio) {
gpiod_set_value_cansleep(clk->ena_gpio, enable); return;
}
/* * The regulators have to have .ops to be valid, but the only ops we actually * support are .enable and .disable which are handled via .ena_gpiod. Pass an * empty struct to clear the check without lying about capabilities.
*/ staticconststruct regulator_ops int3472_gpio_regulator_ops;
staticint skl_int3472_clk_enable(struct clk_hw *hw)
{ /* * We're just turning a GPIO on to enable the clock, which operation * has the potential to sleep. Given .enable() cannot sleep, but * .prepare() can, we toggle the GPIO in .prepare() instead. Thus, * nothing to do here.
*/ return 0;
}
staticvoid skl_int3472_clk_disable(struct clk_hw *hw)
{ /* Likewise, nothing to do here... */
}
staticunsignedint skl_int3472_get_clk_frequency(struct int3472_discrete_device *int3472)
{ union acpi_object *obj; unsignedint freq;
obj = skl_int3472_get_acpi_buffer(int3472->sensor, "SSDB"); if (IS_ERR(obj)) return 0; /* report rate as 0 on error */
if (obj->buffer.length < CIO2_SENSOR_SSDB_MCLKSPEED_OFFSET + sizeof(u32)) {
dev_err(int3472->dev, "The buffer is too small\n");
kfree(obj); return 0;
}
int skl_int3472_register_dsm_clock(struct int3472_discrete_device *int3472)
{ if (int3472->clock.cl) return 0; /* A GPIO controlled clk has already been registered */
if (!acpi_check_dsm(int3472->adev->handle, &img_clk_guid, 0, BIT(1))) return 0; /* DSM clock control is not available */
return skl_int3472_register_clock(int3472);
}
int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int3472, struct gpio_desc *gpio)
{ if (int3472->clock.cl) return -EBUSY;
int3472->clock.ena_gpio = gpio;
return skl_int3472_register_clock(int3472);
}
void skl_int3472_unregister_clock(struct int3472_discrete_device *int3472)
{ if (!int3472->clock.cl) return;
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.