linux/drivers/platform/x86/intel/int3472/clk_and_regulator.c

// SPDX-License-Identifier: GPL-2.0
/* Author: Dan Scally <[email protected]> */

#include <linux/acpi.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/device.h>
#include <linux/dmi.h>
#include <linux/gpio/consumer.h>
#include <linux/regulator/driver.h>
#include <linux/slab.h>

#include "common.h"

/*
 * 82c0d13a-78c5-4244-9bb1-eb8b539a8d11
 * This _DSM GUID allows controlling the sensor clk when it is not controlled
 * through a GPIO.
 */
static const guid_t img_clk_guid =;

static void skl_int3472_enable_clk(struct int3472_clock *clk, int enable)
{}

/*
 * 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.
 */
static const struct regulator_ops int3472_gpio_regulator_ops;

static int skl_int3472_clk_prepare(struct clk_hw *hw)
{}

static void skl_int3472_clk_unprepare(struct clk_hw *hw)
{}

static int skl_int3472_clk_enable(struct clk_hw *hw)
{}

static void skl_int3472_clk_disable(struct clk_hw *hw)
{}

static unsigned int skl_int3472_get_clk_frequency(struct int3472_discrete_device *int3472)
{}

static unsigned long skl_int3472_clk_recalc_rate(struct clk_hw *hw,
						 unsigned long parent_rate)
{}

static const struct clk_ops skl_int3472_clock_ops =;

int skl_int3472_register_dsm_clock(struct int3472_discrete_device *int3472)
{}

int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int3472,
				    struct gpio_desc *gpio)
{}

void skl_int3472_unregister_clock(struct int3472_discrete_device *int3472)
{}

/*
 * The INT3472 device is going to be the only supplier of a regulator for
 * the sensor device. But unlike the clk framework the regulator framework
 * does not allow matching by consumer-device-name only.
 *
 * Ideally all sensor drivers would use "avdd" as supply-id. But for drivers
 * where this cannot be changed because another supply-id is already used in
 * e.g. DeviceTree files an alias for the other supply-id can be added here.
 *
 * Do not forget to update GPIO_REGULATOR_SUPPLY_MAP_COUNT when changing this.
 */
static const char * const skl_int3472_regulator_map_supplies[] =;

static_assert();

/*
 * On some models there is a single GPIO regulator which is shared between
 * sensors and only listed in the ACPI resources of one sensor.
 * This DMI table contains the name of the second sensor. This is used to add
 * entries for the second sensor to the supply_map.
 */
static const struct dmi_system_id skl_int3472_regulator_second_sensor[] =;

int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
				   struct gpio_desc *gpio)
{}

void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472)
{}